From ec93e392d196bda3c808c2e338cbe0f38689255f Mon Sep 17 00:00:00 2001 From: repjarms Date: Mon, 17 Aug 2020 11:20:34 -0400 Subject: [PATCH] feat(generated code): generated code --- Source/AssistantV1/Assistant.swift | 69 +- Source/AssistantV1/Models/CaptureGroup.swift | 12 +- Source/AssistantV1/Models/Context.swift | 12 +- .../AssistantV1/Models/Counterexample.swift | 18 +- .../Models/CounterexampleCollection.swift | 2 +- Source/AssistantV1/Models/CreateEntity.swift | 28 +- Source/AssistantV1/Models/CreateIntent.swift | 22 +- Source/AssistantV1/Models/CreateValue.swift | 36 +- .../AssistantV1/Models/CreateWorkspace.swift | 50 +- Source/AssistantV1/Models/DialogNode.swift | 72 +- .../AssistantV1/Models/DialogNodeAction.swift | 18 +- .../Models/DialogNodeCollection.swift | 2 +- .../Models/DialogNodeNextStep.swift | 50 +- .../AssistantV1/Models/DialogNodeOutput.swift | 10 +- .../Models/DialogNodeOutputGeneric.swift | 85 +- .../Models/DialogNodeOutputModifiers.swift | 12 +- .../DialogNodeOutputOptionsElement.swift | 12 +- .../DialogNodeOutputOptionsElementValue.swift | 20 +- .../DialogNodeOutputTextValuesElement.swift | 10 +- .../Models/DialogNodeVisitedDetails.swift | 12 +- .../AssistantV1/Models/DialogSuggestion.swift | 22 +- .../Models/DialogSuggestionOutput.swift | 24 +- .../DialogSuggestionResponseGeneric.swift | 54 +- .../Models/DialogSuggestionValue.swift | 12 +- Source/AssistantV1/Models/Entity.swift | 2 +- .../AssistantV1/Models/EntityCollection.swift | 2 +- Source/AssistantV1/Models/EntityMention.swift | 2 +- .../Models/EntityMentionCollection.swift | 2 +- Source/AssistantV1/Models/Example.swift | 18 +- .../Models/ExampleCollection.swift | 2 +- Source/AssistantV1/Models/Intent.swift | 2 +- .../AssistantV1/Models/IntentCollection.swift | 2 +- Source/AssistantV1/Models/Log.swift | 2 +- Source/AssistantV1/Models/LogCollection.swift | 2 +- Source/AssistantV1/Models/LogMessage.swift | 10 +- Source/AssistantV1/Models/LogPagination.swift | 2 +- Source/AssistantV1/Models/Mention.swift | 12 +- .../Models/MessageContextMetadata.swift | 18 +- Source/AssistantV1/Models/MessageInput.swift | 32 +- .../AssistantV1/Models/MessageRequest.swift | 30 +- .../AssistantV1/Models/MessageResponse.swift | 2 +- Source/AssistantV1/Models/OutputData.swift | 26 +- Source/AssistantV1/Models/Pagination.swift | 2 +- Source/AssistantV1/Models/RuntimeEntity.swift | 46 +- .../Models/RuntimeEntityAlternative.swift | 8 +- .../Models/RuntimeEntityInterpretation.swift | 108 +- .../Models/RuntimeEntityRole.swift | 6 +- Source/AssistantV1/Models/RuntimeIntent.swift | 10 +- .../Models/RuntimeResponseGeneric.swift | 56 +- Source/AssistantV1/Models/Synonym.swift | 16 +- .../Models/SynonymCollection.swift | 2 +- .../AssistantV1/Models/SystemResponse.swift | 6 +- .../Models/UpdateCounterexample.swift | 18 +- .../AssistantV1/Models/UpdateDialogNode.swift | 72 +- Source/AssistantV1/Models/UpdateEntity.swift | 26 +- Source/AssistantV1/Models/UpdateExample.swift | 18 +- Source/AssistantV1/Models/UpdateIntent.swift | 22 +- Source/AssistantV1/Models/UpdateSynonym.swift | 16 +- Source/AssistantV1/Models/UpdateValue.swift | 36 +- .../AssistantV1/Models/UpdateWorkspace.swift | 50 +- Source/AssistantV1/Models/Value.swift | 2 +- .../AssistantV1/Models/ValueCollection.swift | 2 +- Source/AssistantV1/Models/Webhook.swift | 12 +- Source/AssistantV1/Models/WebhookHeader.swift | 10 +- Source/AssistantV1/Models/Workspace.swift | 2 +- .../Models/WorkspaceCollection.swift | 2 +- .../Models/WorkspaceSystemSettings.swift | 28 +- ...orkspaceSystemSettingsDisambiguation.swift | 33 +- .../WorkspaceSystemSettingsOffTopic.swift | 8 +- ...orkspaceSystemSettingsSystemEntities.swift | 6 +- .../WorkspaceSystemSettingsTooling.swift | 10 +- Source/AssistantV2/Assistant.swift | 158 ++- Source/AssistantV2/Models/CaptureGroup.swift | 12 +- .../AssistantV2/Models/DialogLogMessage.swift | 2 +- .../AssistantV2/Models/DialogNodeAction.swift | 2 +- .../DialogNodeOutputOptionsElement.swift | 2 +- .../DialogNodeOutputOptionsElementValue.swift | 2 +- .../Models/DialogNodesVisited.swift | 2 +- .../AssistantV2/Models/DialogSuggestion.swift | 6 +- .../Models/DialogSuggestionValue.swift | 2 +- Source/AssistantV2/Models/Log.swift | 92 ++ Source/AssistantV2/Models/LogCollection.swift | 38 + Source/AssistantV2/Models/LogPagination.swift | 46 + .../AssistantV2/Models/MessageContext.swift | 14 +- .../Models/MessageContextGlobal.swift | 10 +- .../MessageContextGlobalStateless.swift | 8 +- .../Models/MessageContextGlobalSystem.swift | 44 +- .../Models/MessageContextSkill.swift | 14 +- .../Models/MessageContextSkillSystem.swift | 12 +- .../Models/MessageContextSkills.swift | 42 +- .../Models/MessageContextStateless.swift | 12 +- Source/AssistantV2/Models/MessageInput.swift | 24 +- .../Models/MessageInputOptions.swift | 42 +- .../Models/MessageInputOptionsSpelling.swift | 22 +- .../Models/MessageInputOptionsStateless.swift | 20 +- .../Models/MessageInputStateless.swift | 22 +- Source/AssistantV2/Models/MessageOutput.swift | 2 +- .../Models/MessageOutputDebug.swift | 2 +- .../AssistantV2/Models/MessageRequest.swift | 18 +- .../Models/MessageRequestStateless.swift | 14 +- .../AssistantV2/Models/MessageResponse.swift | 3 +- Source/AssistantV2/Models/RuntimeEntity.swift | 46 +- .../Models/RuntimeEntityAlternative.swift | 8 +- .../Models/RuntimeEntityInterpretation.swift | 108 +- .../Models/RuntimeEntityRole.swift | 6 +- Source/AssistantV2/Models/RuntimeIntent.swift | 10 +- .../Models/RuntimeResponseGeneric.swift | 8 +- Source/AssistantV2/Models/SearchResult.swift | 5 +- .../Models/SearchResultHighlight.swift | 37 +- .../Models/SearchResultMetadata.swift | 2 +- .../AssistantV2/Models/SessionResponse.swift | 2 +- Source/CompareComplyV1/CompareComply.swift | 15 +- Source/CompareComplyV1/Models/Address.swift | 2 +- .../Models/AlignedElement.swift | 2 +- Source/CompareComplyV1/Models/Attribute.swift | 2 +- .../CompareComplyV1/Models/BatchStatus.swift | 2 +- Source/CompareComplyV1/Models/Batches.swift | 2 +- Source/CompareComplyV1/Models/BodyCells.swift | 2 +- Source/CompareComplyV1/Models/Category.swift | 10 +- .../Models/CategoryComparison.swift | 2 +- .../Models/ClassifyReturn.swift | 2 +- .../Models/ColumnHeaders.swift | 2 +- .../Models/CompareReturn.swift | 2 +- Source/CompareComplyV1/Models/Contact.swift | 2 +- Source/CompareComplyV1/Models/Contexts.swift | 2 +- .../CompareComplyV1/Models/ContractAmts.swift | 2 +- .../Models/ContractCurrencies.swift | 2 +- .../Models/ContractTerms.swift | 2 +- .../Models/ContractTypes.swift | 2 +- Source/CompareComplyV1/Models/DocCounts.swift | 2 +- Source/CompareComplyV1/Models/DocInfo.swift | 2 +- .../CompareComplyV1/Models/DocStructure.swift | 2 +- Source/CompareComplyV1/Models/Document.swift | 2 +- .../Models/EffectiveDates.swift | 2 +- Source/CompareComplyV1/Models/Element.swift | 2 +- .../Models/ElementLocations.swift | 2 +- .../CompareComplyV1/Models/ElementPair.swift | 2 +- .../Models/FeedbackDataInput.swift | 24 +- .../Models/FeedbackDataOutput.swift | 2 +- .../Models/FeedbackDeleted.swift | 2 +- .../Models/FeedbackInput.swift | 12 +- .../CompareComplyV1/Models/FeedbackList.swift | 2 +- .../Models/FeedbackReturn.swift | 2 +- .../CompareComplyV1/Models/GetFeedback.swift | 2 +- .../CompareComplyV1/Models/HTMLReturn.swift | 2 +- .../Models/Interpretation.swift | 2 +- Source/CompareComplyV1/Models/Key.swift | 2 +- .../CompareComplyV1/Models/KeyValuePair.swift | 2 +- Source/CompareComplyV1/Models/Label.swift | 10 +- .../Models/LeadingSentence.swift | 2 +- Source/CompareComplyV1/Models/Location.swift | 10 +- Source/CompareComplyV1/Models/Mention.swift | 2 +- .../Models/OriginalLabelsIn.swift | 12 +- .../Models/OriginalLabelsOut.swift | 2 +- .../CompareComplyV1/Models/Pagination.swift | 2 +- .../CompareComplyV1/Models/Paragraphs.swift | 2 +- Source/CompareComplyV1/Models/Parties.swift | 2 +- .../CompareComplyV1/Models/PaymentTerms.swift | 2 +- .../CompareComplyV1/Models/RowHeaders.swift | 2 +- .../CompareComplyV1/Models/SectionTitle.swift | 2 +- .../Models/SectionTitles.swift | 2 +- Source/CompareComplyV1/Models/ShortDoc.swift | 10 +- .../CompareComplyV1/Models/TableHeaders.swift | 2 +- .../CompareComplyV1/Models/TableReturn.swift | 2 +- .../CompareComplyV1/Models/TableTitle.swift | 2 +- Source/CompareComplyV1/Models/Tables.swift | 2 +- .../Models/TerminationDates.swift | 2 +- Source/CompareComplyV1/Models/TypeLabel.swift | 12 +- .../Models/TypeLabelComparison.swift | 2 +- .../Models/UnalignedElement.swift | 2 +- .../Models/UpdatedLabelsIn.swift | 12 +- .../Models/UpdatedLabelsOut.swift | 2 +- Source/CompareComplyV1/Models/Value.swift | 2 +- Source/DiscoveryV1/Discovery.swift | 14 +- .../Models/AggregationResult.swift | 10 +- Source/DiscoveryV1/Models/Calculation.swift | 2 +- .../DiscoveryV1/Models/CollQueryLarge.swift | 100 +- Source/DiscoveryV1/Models/Collection.swift | 2 +- .../Models/CollectionCrawlStatus.swift | 2 +- .../Models/CollectionDiskUsage.swift | 2 +- .../DiscoveryV1/Models/CollectionUsage.swift | 2 +- Source/DiscoveryV1/Models/Completions.swift | 2 +- Source/DiscoveryV1/Models/Configuration.swift | 32 +- Source/DiscoveryV1/Models/Conversions.swift | 26 +- .../Models/CreateCollectionRequest.swift | 16 +- .../Models/CreateEnvironmentRequest.swift | 14 +- .../Models/CreateEventObject.swift | 10 +- .../Models/CreateEventResponse.swift | 2 +- .../Models/CredentialDetails.swift | 120 +-- Source/DiscoveryV1/Models/Credentials.swift | 30 +- .../DiscoveryV1/Models/CredentialsList.swift | 2 +- .../Models/DeleteCollectionResponse.swift | 2 +- .../Models/DeleteConfigurationResponse.swift | 2 +- .../Models/DeleteCredentials.swift | 2 +- .../Models/DeleteDocumentResponse.swift | 2 +- .../Models/DeleteEnvironmentResponse.swift | 2 +- Source/DiscoveryV1/Models/DiskUsage.swift | 2 +- .../DiscoveryV1/Models/DocumentAccepted.swift | 2 +- .../DiscoveryV1/Models/DocumentCounts.swift | 2 +- .../DiscoveryV1/Models/DocumentStatus.swift | 2 +- Source/DiscoveryV1/Models/Enrichment.swift | 46 +- .../Models/EnrichmentOptions.swift | 20 +- Source/DiscoveryV1/Models/Environment.swift | 2 +- .../Models/EnvironmentDocuments.swift | 2 +- Source/DiscoveryV1/Models/EventData.swift | 26 +- Source/DiscoveryV1/Models/Expansion.swift | 14 +- Source/DiscoveryV1/Models/Expansions.swift | 26 +- Source/DiscoveryV1/Models/FedQueryLarge.swift | 94 +- Source/DiscoveryV1/Models/Field.swift | 2 +- Source/DiscoveryV1/Models/Filter.swift | 2 +- Source/DiscoveryV1/Models/FontSetting.swift | 18 +- Source/DiscoveryV1/Models/Gateway.swift | 2 +- Source/DiscoveryV1/Models/GatewayDelete.swift | 2 +- Source/DiscoveryV1/Models/GatewayList.swift | 2 +- Source/DiscoveryV1/Models/GatewayName.swift | 8 +- Source/DiscoveryV1/Models/HTMLSettings.swift | 18 +- Source/DiscoveryV1/Models/Histogram.swift | 2 +- Source/DiscoveryV1/Models/IndexCapacity.swift | 2 +- .../Models/ListCollectionFieldsResponse.swift | 2 +- .../Models/ListCollectionsResponse.swift | 2 +- .../Models/ListConfigurationsResponse.swift | 2 +- .../Models/ListEnvironmentsResponse.swift | 2 +- .../DiscoveryV1/Models/LogQueryResponse.swift | 2 +- .../Models/LogQueryResponseResult.swift | 2 +- .../LogQueryResponseResultDocuments.swift | 2 +- ...ogQueryResponseResultDocumentsResult.swift | 2 +- .../Models/MetricAggregation.swift | 2 +- .../Models/MetricAggregationResult.swift | 2 +- .../DiscoveryV1/Models/MetricResponse.swift | 2 +- .../Models/MetricTokenAggregation.swift | 2 +- .../Models/MetricTokenAggregationResult.swift | 2 +- .../Models/MetricTokenResponse.swift | 2 +- Source/DiscoveryV1/Models/Nested.swift | 2 +- .../DiscoveryV1/Models/NewTrainingQuery.swift | 12 +- .../Models/NluEnrichmentCategories.swift | 6 +- .../Models/NluEnrichmentConcepts.swift | 10 +- .../Models/NluEnrichmentEmotion.swift | 10 +- .../Models/NluEnrichmentEntities.swift | 28 +- .../Models/NluEnrichmentFeatures.swift | 24 +- .../Models/NluEnrichmentKeywords.swift | 12 +- .../Models/NluEnrichmentRelations.swift | 12 +- .../Models/NluEnrichmentSemanticRoles.swift | 14 +- .../Models/NluEnrichmentSentiment.swift | 10 +- .../Models/NormalizationOperation.swift | 48 +- Source/DiscoveryV1/Models/Notice.swift | 2 +- .../Models/PDFHeadingDetection.swift | 8 +- Source/DiscoveryV1/Models/PDFSettings.swift | 8 +- .../DiscoveryV1/Models/QueryAggregation.swift | 114 +-- .../Models/QueryNoticesResponse.swift | 2 +- .../Models/QueryNoticesResult.swift | 2 +- Source/DiscoveryV1/Models/QueryPassages.swift | 2 +- Source/DiscoveryV1/Models/QueryResponse.swift | 2 +- Source/DiscoveryV1/Models/QueryResult.swift | 2 +- .../Models/QueryResultMetadata.swift | 2 +- .../DiscoveryV1/Models/RetrievalDetails.swift | 2 +- Source/DiscoveryV1/Models/SduStatus.swift | 2 +- .../Models/SduStatusCustomFields.swift | 2 +- Source/DiscoveryV1/Models/SearchStatus.swift | 2 +- .../DiscoveryV1/Models/SegmentSettings.swift | 30 +- Source/DiscoveryV1/Models/Source.swift | 28 +- Source/DiscoveryV1/Models/SourceOptions.swift | 34 +- .../Models/SourceOptionsBuckets.swift | 12 +- .../Models/SourceOptionsFolder.swift | 14 +- .../Models/SourceOptionsObject.swift | 12 +- .../Models/SourceOptionsSiteColl.swift | 16 +- .../Models/SourceOptionsWebCrawl.swift | 50 +- .../DiscoveryV1/Models/SourceSchedule.swift | 26 +- Source/DiscoveryV1/Models/SourceStatus.swift | 2 +- Source/DiscoveryV1/Models/Term.swift | 2 +- Source/DiscoveryV1/Models/Timeslice.swift | 2 +- Source/DiscoveryV1/Models/TokenDict.swift | 10 +- Source/DiscoveryV1/Models/TokenDictRule.swift | 18 +- .../Models/TokenDictStatusResponse.swift | 2 +- Source/DiscoveryV1/Models/TopHits.swift | 2 +- .../DiscoveryV1/Models/TopHitsResults.swift | 2 +- .../DiscoveryV1/Models/TrainingDataSet.swift | 2 +- .../DiscoveryV1/Models/TrainingExample.swift | 12 +- .../Models/TrainingExampleList.swift | 2 +- .../Models/TrainingExamplePatch.swift | 10 +- Source/DiscoveryV1/Models/TrainingQuery.swift | 2 +- .../DiscoveryV1/Models/TrainingStatus.swift | 2 +- .../Models/UpdateCollectionRequest.swift | 12 +- .../Models/UpdateEnvironmentRequest.swift | 14 +- .../Models/WordHeadingDetection.swift | 10 +- Source/DiscoveryV1/Models/WordSettings.swift | 8 +- Source/DiscoveryV1/Models/WordStyle.swift | 10 +- Source/DiscoveryV1/Models/XPathPatterns.swift | 8 +- Source/DiscoveryV2/Discovery.swift | 963 +++++++++++++++++- Source/DiscoveryV2/Models/Collection.swift | 2 +- .../Models/CollectionDetails.swift | 93 ++ .../Models/CollectionEnrichment.swift | 57 ++ Source/DiscoveryV2/Models/Completions.swift | 2 +- .../Models/ComponentSettingsAggregation.swift | 2 +- .../Models/ComponentSettingsFieldsShown.swift | 2 +- .../ComponentSettingsFieldsShownBody.swift | 2 +- .../ComponentSettingsFieldsShownTitle.swift | 2 +- .../Models/ComponentSettingsResponse.swift | 4 +- .../DiscoveryV2/Models/CreateEnrichment.swift | 86 ++ .../Models/DefaultQueryParams.swift | 130 +++ .../Models/DefaultQueryParamsPassages.swift | 96 ++ ...faultQueryParamsSuggestedRefinements.swift | 57 ++ .../DefaultQueryParamsTableResults.swift | 66 ++ .../Models/DeleteDocumentResponse.swift | 2 +- .../DiscoveryV2/Models/DocumentAccepted.swift | 2 +- .../Models/DocumentAttribute.swift | 2 +- Source/DiscoveryV2/Models/Enrichment.swift | 72 ++ .../Models/EnrichmentOptions.swift | 82 ++ Source/DiscoveryV2/Models/Enrichments.swift | 34 + Source/DiscoveryV2/Models/Field.swift | 2 +- .../Models/ListCollectionsResponse.swift | 2 +- .../Models/ListFieldsResponse.swift | 2 +- .../Models/ListProjectsResponse.swift | 34 + Source/DiscoveryV2/Models/Notice.swift | 2 +- .../DiscoveryV2/Models/ProjectCreation.swift | 76 ++ .../DiscoveryV2/Models/ProjectDetails.swift | 74 ++ .../Models/ProjectListDetails.swift | 68 ++ ...ctListDetailsRelevancyTrainingStatus.swift | 82 ++ Source/DiscoveryV2/Models/ProjectName.swift | 48 + .../DiscoveryV2/Models/QueryAggregation.swift | 93 +- .../Models/QueryCalculationAggregation.swift | 2 +- .../Models/QueryFilterAggregation.swift | 2 +- .../Models/QueryGroupByAggregation.swift | 41 + .../QueryGroupByAggregationResult.swift | 66 ++ .../Models/QueryHistogramAggregation.swift | 2 +- .../QueryHistogramAggregationResult.swift | 2 +- Source/DiscoveryV2/Models/QueryLarge.swift | 64 +- .../Models/QueryLargePassages.swift | 24 +- .../QueryLargeSuggestedRefinements.swift | 13 +- .../Models/QueryLargeTableResults.swift | 10 +- .../Models/QueryNestedAggregation.swift | 2 +- .../Models/QueryNoticesResponse.swift | 2 +- Source/DiscoveryV2/Models/QueryResponse.swift | 2 +- Source/DiscoveryV2/Models/QueryResult.swift | 2 +- .../Models/QueryResultMetadata.swift | 2 +- .../Models/QueryResultPassage.swift | 2 +- .../Models/QuerySuggestedRefinement.swift | 2 +- .../DiscoveryV2/Models/QueryTableResult.swift | 2 +- .../Models/QueryTermAggregation.swift | 2 +- .../Models/QueryTermAggregationResult.swift | 22 +- .../Models/QueryTimesliceAggregation.swift | 2 +- .../QueryTimesliceAggregationResult.swift | 2 +- .../Models/QueryTopHitsAggregation.swift | 2 +- .../QueryTopHitsAggregationResult.swift | 2 +- .../DiscoveryV2/Models/RetrievalDetails.swift | 2 +- .../DiscoveryV2/Models/TableBodyCells.swift | 2 +- Source/DiscoveryV2/Models/TableCellKey.swift | 2 +- .../DiscoveryV2/Models/TableCellValues.swift | 2 +- .../Models/TableColumnHeaderIDs.swift | 2 +- .../Models/TableColumnHeaderTexts.swift | 2 +- .../TableColumnHeaderTextsNormalized.swift | 2 +- .../Models/TableColumnHeaders.swift | 2 +- .../Models/TableElementLocation.swift | 2 +- Source/DiscoveryV2/Models/TableHeaders.swift | 2 +- .../Models/TableKeyValuePairs.swift | 2 +- .../DiscoveryV2/Models/TableResultTable.swift | 2 +- .../Models/TableRowHeaderIDs.swift | 2 +- .../Models/TableRowHeaderTexts.swift | 2 +- .../TableRowHeaderTextsNormalized.swift | 2 +- .../DiscoveryV2/Models/TableRowHeaders.swift | 2 +- .../Models/TableTextLocation.swift | 2 +- .../DiscoveryV2/Models/TrainingExample.swift | 16 +- Source/DiscoveryV2/Models/TrainingQuery.swift | 18 +- .../DiscoveryV2/Models/TrainingQuerySet.swift | 2 +- .../DiscoveryV2/Models/UpdateCollection.swift | 66 ++ .../DiscoveryV2/Models/UpdateEnrichment.swift | 57 ++ .../LanguageTranslator.swift | 197 +++- .../Models/DeleteModelResult.swift | 2 +- .../Models/DocumentList.swift | 2 +- .../Models/DocumentStatus.swift | 2 +- .../Models/IdentifiableLanguage.swift | 2 +- .../Models/IdentifiableLanguages.swift | 2 +- .../Models/IdentifiedLanguage.swift | 2 +- .../Models/IdentifiedLanguages.swift | 2 +- .../Models/Language.swift | 86 ++ .../Models/Languages.swift | 34 + .../Models/TranslateRequest.swift | 35 +- .../Models/Translation.swift | 2 +- .../Models/TranslationModel.swift | 2 +- .../Models/TranslationModels.swift | 2 +- .../Models/TranslationResult.swift | 2 +- .../Models/Classification.swift | 2 +- .../Models/ClassificationCollection.swift | 2 +- .../Models/ClassifiedClass.swift | 2 +- .../Models/Classifier.swift | 2 +- .../Models/ClassifierList.swift | 2 +- .../Models/ClassifyCollectionInput.swift | 8 +- .../Models/ClassifyInput.swift | 8 +- .../Models/CollectionItem.swift | 2 +- .../NaturalLanguageClassifier.swift | 14 +- .../Models/AnalysisResults.swift | 2 +- .../Models/AnalysisResultsMetadata.swift | 2 +- .../Models/AnalysisResultsUsage.swift | 2 +- .../Models/Author.swift | 2 +- .../Models/CategoriesOptions.swift | 28 +- .../Models/CategoriesRelevantText.swift | 2 +- .../Models/CategoriesResult.swift | 7 +- .../Models/CategoriesResultExplanation.swift | 2 +- .../Models/ConceptsOptions.swift | 8 +- .../Models/ConceptsResult.swift | 2 +- .../Models/DeleteModelResults.swift | 2 +- .../Models/DisambiguationResult.swift | 2 +- .../Models/DocumentEmotionResults.swift | 2 +- .../Models/DocumentSentimentResults.swift | 2 +- .../Models/EmotionOptions.swift | 10 +- .../Models/EmotionResult.swift | 2 +- .../Models/EmotionScores.swift | 2 +- .../Models/EntitiesOptions.swift | 23 +- .../Models/EntitiesResult.swift | 2 +- .../Models/EntityMention.swift | 2 +- .../Models/FeatureSentimentResults.swift | 2 +- .../Models/Features.swift | 76 +- .../Models/Feed.swift | 2 +- .../Models/KeywordsOptions.swift | 12 +- .../Models/KeywordsResult.swift | 2 +- .../Models/ListModelsResults.swift | 2 +- .../Models/MetadataOptions.swift | 6 +- .../Models/Model.swift | 16 +- .../Models/Parameters.swift | 57 +- .../Models/RelationArgument.swift | 2 +- .../Models/RelationEntity.swift | 2 +- .../Models/RelationsOptions.swift | 14 +- .../Models/RelationsResult.swift | 2 +- .../Models/SemanticRolesEntity.swift | 2 +- .../Models/SemanticRolesKeyword.swift | 2 +- .../Models/SemanticRolesOptions.swift | 12 +- .../Models/SemanticRolesResult.swift | 2 +- .../Models/SemanticRolesResultAction.swift | 2 +- .../Models/SemanticRolesResultObject.swift | 2 +- .../Models/SemanticRolesResultSubject.swift | 2 +- .../Models/SemanticRolesVerb.swift | 2 +- .../Models/SentenceResult.swift | 2 +- .../Models/SentimentOptions.swift | 10 +- .../Models/SentimentResult.swift | 2 +- .../Models/SyntaxOptions.swift | 10 +- .../Models/SyntaxOptionsTokens.swift | 10 +- .../Models/SyntaxResult.swift | 2 +- .../Models/TargetedEmotionResults.swift | 2 +- .../Models/TargetedSentimentResults.swift | 2 +- .../Models/TokenResult.swift | 6 +- .../NaturalLanguageUnderstanding.swift | 30 +- .../Models/Behavior.swift | 2 +- .../Models/ConsumptionPreferences.swift | 2 +- .../ConsumptionPreferencesCategory.swift | 2 +- .../Models/Content.swift | 8 +- .../Models/ContentItem.swift | 54 +- .../Models/Profile.swift | 2 +- .../Models/ProfileContent.swift | 2 +- .../PersonalityInsightsV3/Models/Trait.swift | 2 +- .../Models/Warning.swift | 2 +- .../PersonalityInsights.swift | 24 +- .../SpeechToTextV1/Models/AcousticModel.swift | 2 +- .../Models/AcousticModels.swift | 2 +- .../SpeechToTextV1/Models/AudioDetails.swift | 2 +- .../SpeechToTextV1/Models/AudioListing.swift | 2 +- .../SpeechToTextV1/Models/AudioMetrics.swift | 2 +- .../Models/AudioMetricsDetails.swift | 2 +- .../Models/AudioMetricsHistogramBin.swift | 2 +- .../SpeechToTextV1/Models/AudioResource.swift | 2 +- .../Models/AudioResources.swift | 2 +- Source/SpeechToTextV1/Models/Corpora.swift | 2 +- Source/SpeechToTextV1/Models/Corpus.swift | 2 +- .../Models/CreateAcousticModel.swift | 26 +- .../Models/CreateLanguageModel.swift | 52 +- Source/SpeechToTextV1/Models/CustomWord.swift | 38 +- .../SpeechToTextV1/Models/CustomWords.swift | 10 +- Source/SpeechToTextV1/Models/Grammar.swift | 2 +- Source/SpeechToTextV1/Models/Grammars.swift | 2 +- .../SpeechToTextV1/Models/KeywordResult.swift | 2 +- .../SpeechToTextV1/Models/LanguageModel.swift | 2 +- .../Models/LanguageModels.swift | 2 +- .../Models/ProcessedAudio.swift | 2 +- .../Models/ProcessingMetrics.swift | 2 +- .../Models/RecognitionJob.swift | 2 +- .../Models/RecognitionJobs.swift | 2 +- .../Models/RegisterStatus.swift | 10 +- .../Models/SpeakerLabelsResult.swift | 2 +- .../SpeechToTextV1/Models/SpeechModel.swift | 2 +- .../SpeechToTextV1/Models/SpeechModels.swift | 2 +- .../Models/SpeechRecognitionAlternative.swift | 6 +- .../Models/SpeechRecognitionResult.swift | 2 +- .../Models/SpeechRecognitionResults.swift | 2 +- .../Models/SupportedFeatures.swift | 5 +- .../Models/TrainingResponse.swift | 2 +- .../Models/TrainingWarning.swift | 2 +- Source/SpeechToTextV1/Models/Word.swift | 2 +- .../Models/WordAlternativeResult.swift | 2 +- .../Models/WordAlternativeResults.swift | 2 +- Source/SpeechToTextV1/Models/WordError.swift | 2 +- Source/SpeechToTextV1/Models/Words.swift | 2 +- Source/SpeechToTextV1/SpeechToText.swift | 72 +- .../Models/CreateVoiceModel.swift | 16 +- .../TextToSpeechV1/Models/Pronunciation.swift | 2 +- .../Models/SupportedFeatures.swift | 2 +- Source/TextToSpeechV1/Models/Text.swift | 8 +- .../TextToSpeechV1/Models/Translation.swift | 24 +- .../Models/UpdateVoiceModel.swift | 14 +- Source/TextToSpeechV1/Models/Voice.swift | 2 +- Source/TextToSpeechV1/Models/VoiceModel.swift | 2 +- .../TextToSpeechV1/Models/VoiceModels.swift | 2 +- Source/TextToSpeechV1/Models/Voices.swift | 2 +- Source/TextToSpeechV1/Models/Word.swift | 26 +- Source/TextToSpeechV1/Models/Words.swift | 16 +- Source/TextToSpeechV1/TextToSpeech.swift | 64 +- .../Models/DocumentAnalysis.swift | 2 +- .../Models/SentenceAnalysis.swift | 2 +- .../ToneAnalyzerV3/Models/ToneAnalysis.swift | 2 +- .../ToneAnalyzerV3/Models/ToneCategory.swift | 2 +- .../ToneAnalyzerV3/Models/ToneChatInput.swift | 10 +- .../ToneAnalyzerV3/Models/ToneChatScore.swift | 2 +- .../ToneAnalyzerV3/Models/ToneContent.swift | 2 +- Source/ToneAnalyzerV3/Models/ToneInput.swift | 8 +- Source/ToneAnalyzerV3/Models/ToneScore.swift | 2 +- Source/ToneAnalyzerV3/Models/Utterance.swift | 14 +- .../Models/UtteranceAnalyses.swift | 2 +- .../Models/UtteranceAnalysis.swift | 2 +- Source/ToneAnalyzerV3/ToneAnalyzer.swift | 25 +- Source/VisualRecognitionV3/Models/Class.swift | 2 +- .../Models/ClassResult.swift | 2 +- .../Models/ClassifiedImage.swift | 2 +- .../Models/ClassifiedImages.swift | 2 +- .../Models/Classifier.swift | 2 +- .../Models/ClassifierResult.swift | 2 +- .../Models/Classifiers.swift | 2 +- .../Models/ErrorInfo.swift | 2 +- .../Models/WarningInfo.swift | 2 +- .../VisualRecognition.swift | 54 +- .../Models/AnalyzeResponse.swift | 2 +- .../Models/BaseCollection.swift | 24 +- .../Models/BaseTrainingDataObjects.swift | 8 +- .../Models/Collection.swift | 2 +- .../Models/CollectionObjects.swift | 2 +- .../Models/CollectionsList.swift | 2 +- .../Models/DetectedObjects.swift | 2 +- Source/VisualRecognitionV4/Models/Error.swift | 2 +- .../Models/ErrorTarget.swift | 2 +- .../Models/FileWithMetadata.swift | 12 +- Source/VisualRecognitionV4/Models/Image.swift | 2 +- .../Models/ImageDetails.swift | 2 +- .../Models/ImageDetailsList.swift | 2 +- .../Models/ImageDimensions.swift | 2 +- .../Models/ImageSource.swift | 2 +- .../Models/ImageSummary.swift | 2 +- .../Models/ImageSummaryList.swift | 2 +- .../VisualRecognitionV4/Models/Location.swift | 14 +- .../Models/ObjectDetail.swift | 2 +- .../Models/ObjectTrainingStatus.swift | 20 +- .../Models/TrainingDataObject.swift | 10 +- .../Models/TrainingDataObjects.swift | 2 +- .../Models/TrainingEvent.swift | 2 +- .../Models/TrainingEvents.swift | 2 +- .../Models/TrainingStatus.swift | 8 +- .../Models/UpdateObjectMetadata.swift | 10 +- .../VisualRecognitionV4/Models/Warning.swift | 2 +- .../VisualRecognition.swift | 32 +- 554 files changed, 5526 insertions(+), 2920 deletions(-) create mode 100644 Source/AssistantV2/Models/Log.swift create mode 100644 Source/AssistantV2/Models/LogCollection.swift create mode 100644 Source/AssistantV2/Models/LogPagination.swift create mode 100644 Source/DiscoveryV2/Models/CollectionDetails.swift create mode 100644 Source/DiscoveryV2/Models/CollectionEnrichment.swift create mode 100644 Source/DiscoveryV2/Models/CreateEnrichment.swift create mode 100644 Source/DiscoveryV2/Models/DefaultQueryParams.swift create mode 100644 Source/DiscoveryV2/Models/DefaultQueryParamsPassages.swift create mode 100644 Source/DiscoveryV2/Models/DefaultQueryParamsSuggestedRefinements.swift create mode 100644 Source/DiscoveryV2/Models/DefaultQueryParamsTableResults.swift create mode 100644 Source/DiscoveryV2/Models/Enrichment.swift create mode 100644 Source/DiscoveryV2/Models/EnrichmentOptions.swift create mode 100644 Source/DiscoveryV2/Models/Enrichments.swift create mode 100644 Source/DiscoveryV2/Models/ListProjectsResponse.swift create mode 100644 Source/DiscoveryV2/Models/ProjectCreation.swift create mode 100644 Source/DiscoveryV2/Models/ProjectDetails.swift create mode 100644 Source/DiscoveryV2/Models/ProjectListDetails.swift create mode 100644 Source/DiscoveryV2/Models/ProjectListDetailsRelevancyTrainingStatus.swift create mode 100644 Source/DiscoveryV2/Models/ProjectName.swift create mode 100644 Source/DiscoveryV2/Models/QueryGroupByAggregation.swift create mode 100644 Source/DiscoveryV2/Models/QueryGroupByAggregationResult.swift create mode 100644 Source/DiscoveryV2/Models/UpdateCollection.swift create mode 100644 Source/DiscoveryV2/Models/UpdateEnrichment.swift create mode 100644 Source/LanguageTranslatorV3/Models/Language.swift create mode 100644 Source/LanguageTranslatorV3/Models/Languages.swift diff --git a/Source/AssistantV1/Assistant.swift b/Source/AssistantV1/Assistant.swift index 14a6367ca..21181e3f2 100644 --- a/Source/AssistantV1/Assistant.swift +++ b/Source/AssistantV1/Assistant.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import IBMSwiftSDKCore public class Assistant { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/assistant/api" + public var serviceURL: String? = "https://api.us-south.assistant.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "Conversation" @@ -54,10 +54,11 @@ public class Assistant { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -83,8 +84,8 @@ public class Assistant { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -133,7 +134,6 @@ public class Assistant { **Important:** This method has been superseded by the new v2 runtime API. The v2 API offers significant advantages, including ease of deployment, automatic state management, versioning, and search capabilities. For more information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-api-overview). - There is no rate limit for this operation. - parameter workspaceID: Unique identifier of the workspace. - parameter input: An input object that includes the input text. @@ -227,7 +227,6 @@ public class Assistant { List workspaces. List the workspaces associated with a Watson Assistant service instance. - This operation is limited to 500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter pageLimit: The number of records to return in each page of results. - parameter sort: The attribute by which returned workspaces will be sorted. To reverse the sort order, prefix @@ -302,7 +301,6 @@ public class Assistant { Create a workspace based on component objects. You must provide workspace components defining the content of the new workspace. - This operation is limited to 30 requests per 30 minutes. For more information, see **Rate limiting**. - parameter name: The name of the workspace. This string cannot contain carriage return, newline, or tab characters. @@ -404,8 +402,6 @@ public class Assistant { Get information about a workspace. Get information about a workspace, optionally including all workspace content. - With **export**=`false`, this operation is limited to 6000 requests per 5 minutes. With **export**=`true`, the - limit is 20 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter export: Whether to include all element content in the returned data. If **export**=`false`, the @@ -484,7 +480,6 @@ public class Assistant { Update an existing workspace with new or modified data. You must provide component objects defining the content of the updated workspace. - This operation is limited to 30 request per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter name: The name of the workspace. This string cannot contain carriage return, newline, or tab @@ -604,7 +599,6 @@ public class Assistant { Delete workspace. Delete a workspace from the service instance. - This operation is limited to 30 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter headers: A dictionary of request headers to be sent with this request. @@ -659,8 +653,6 @@ public class Assistant { List intents. List the intents for a workspace. - With **export**=`false`, this operation is limited to 2000 requests per 30 minutes. With **export**=`true`, the - limit is 400 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter export: Whether to include all element content in the returned data. If **export**=`false`, the @@ -751,7 +743,6 @@ public class Assistant { Create a new intent. If you want to create multiple intents with a single API call, consider using the **[Update workspace](#update-workspace)** method instead. - This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The name of the intent. This string must conform to the following restrictions: @@ -834,8 +825,6 @@ public class Assistant { Get intent. Get information about an intent, optionally including all intent content. - With **export**=`false`, this operation is limited to 6000 requests per 5 minutes. With **export**=`true`, the - limit is 400 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -910,7 +899,6 @@ public class Assistant { updated intent. If you want to update multiple intents with a single API call, consider using the **[Update workspace](#update-workspace)** method instead. - This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -1006,7 +994,6 @@ public class Assistant { Delete intent. Delete an intent from a workspace. - This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -1063,7 +1050,6 @@ public class Assistant { List user input examples. List the user input examples for an intent, optionally including contextual entity mentions. - This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -1148,7 +1134,6 @@ public class Assistant { Add a new user input example to an intent. If you want to add multiple examples with a single API call, consider using the **[Update intent](#update-intent)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -1229,7 +1214,6 @@ public class Assistant { Get user input example. Get information about a user input example. - This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -1297,7 +1281,6 @@ public class Assistant { Update the text of a user input example. If you want to update multiple examples with a single API call, consider using the **[Update intent](#update-intent)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -1380,7 +1363,6 @@ public class Assistant { Delete user input example. Delete a user input example from an intent. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter intent: The intent name. @@ -1439,7 +1421,6 @@ public class Assistant { List counterexamples. List the counterexamples for a workspace. Counterexamples are examples that have been marked as irrelevant input. - This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter pageLimit: The number of records to return in each page of results. @@ -1522,7 +1503,6 @@ public class Assistant { Add a new counterexample to a workspace. Counterexamples are examples that have been marked as irrelevant input. If you want to add multiple counterexamples with a single API call, consider using the **[Update workspace](#update-workspace)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter text: The text of a user input marked as irrelevant input. This string must conform to the following @@ -1599,7 +1579,6 @@ public class Assistant { Get counterexample. Get information about a counterexample. Counterexamples are examples that have been marked as irrelevant input. - This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter text: The text of a user input counterexample (for example, `What are you wearing?`). @@ -1663,9 +1642,6 @@ public class Assistant { Update counterexample. Update the text of a counterexample. Counterexamples are examples that have been marked as irrelevant input. - If you want to update multiple counterexamples with a single API call, consider using the **[Update - workspace](#update-workspace)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter text: The text of a user input counterexample (for example, `What are you wearing?`). @@ -1744,7 +1720,6 @@ public class Assistant { Delete counterexample. Delete a counterexample from a workspace. Counterexamples are examples that have been marked as irrelevant input. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter text: The text of a user input counterexample (for example, `What are you wearing?`). @@ -1801,8 +1776,6 @@ public class Assistant { List entities. List the entities for a workspace. - With **export**=`false`, this operation is limited to 1000 requests per 30 minutes. With **export**=`true`, the - limit is 200 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter export: Whether to include all element content in the returned data. If **export**=`false`, the @@ -1893,7 +1866,6 @@ public class Assistant { Create a new entity, or enable a system entity. If you want to create multiple entities with a single API call, consider using the **[Update workspace](#update-workspace)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. This string must conform to the following restrictions: @@ -1983,8 +1955,6 @@ public class Assistant { Get entity. Get information about an entity, optionally including all entity content. - With **export**=`false`, this operation is limited to 6000 requests per 5 minutes. With **export**=`true`, the - limit is 200 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2059,7 +2029,6 @@ public class Assistant { updated entity. If you want to update multiple entities with a single API call, consider using the **[Update workspace](#update-workspace)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2161,7 +2130,6 @@ public class Assistant { Delete entity. Delete an entity from a workspace, or disable a system entity. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2219,7 +2187,6 @@ public class Assistant { List mentions for a contextual entity. An entity mention is an occurrence of a contextual entity in the context of an intent user input example. - This operation is limited to 200 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2291,7 +2258,6 @@ public class Assistant { List entity values. List the values for an entity. - This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2384,7 +2350,6 @@ public class Assistant { Create a new value for an entity. If you want to create multiple entity values with a single API call, consider using the **[Update entity](#update-entity)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2480,7 +2445,6 @@ public class Assistant { Get entity value. Get information about an entity value. - This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2557,7 +2521,6 @@ public class Assistant { of the updated entity value. If you want to update multiple entity values with a single API call, consider using the **[Update entity](#update-entity)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2666,7 +2629,6 @@ public class Assistant { Delete entity value. Delete a value from an entity. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2725,7 +2687,6 @@ public class Assistant { List entity value synonyms. List the synonyms for an entity value. - This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2812,7 +2773,6 @@ public class Assistant { Add a new synonym to an entity value. If you want to create multiple synonyms with a single API call, consider using the **[Update entity](#update-entity)** or **[Update entity value](#update-entity-value)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2892,7 +2852,6 @@ public class Assistant { Get entity value synonym. Get information about a synonym of an entity value. - This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -2962,7 +2921,6 @@ public class Assistant { Update an existing entity value synonym with new text. If you want to update multiple synonyms with a single API call, consider using the **[Update entity](#update-entity)** or **[Update entity value](#update-entity-value)** method instead. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -3044,7 +3002,6 @@ public class Assistant { Delete entity value synonym. Delete a synonym from an entity value. - This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter entity: The name of the entity. @@ -3105,7 +3062,6 @@ public class Assistant { List dialog nodes. List the dialog nodes for a workspace. - This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter pageLimit: The number of records to return in each page of results. @@ -3188,7 +3144,6 @@ public class Assistant { Create a new dialog node. If you want to create multiple dialog nodes with a single API call, consider using the **[Update workspace](#update-workspace)** method instead. - This operation is limited to 500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter dialogNode: The dialog node ID. This string must conform to the following restrictions: @@ -3325,7 +3280,6 @@ public class Assistant { Get dialog node. Get information about a dialog node. - This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter dialogNode: The dialog node ID (for example, `get_order`). @@ -3391,7 +3345,6 @@ public class Assistant { Update an existing dialog node with new or modified data. If you want to update multiple dialog nodes with a single API call, consider using the **[Update workspace](#update-workspace)** method instead. - This operation is limited to 500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter dialogNode: The dialog node ID (for example, `get_order`). @@ -3531,7 +3484,6 @@ public class Assistant { Delete dialog node. Delete a dialog node from a workspace. - This operation is limited to 500 requests per 30 minutes. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter dialogNode: The dialog node ID (for example, `get_order`). @@ -3588,8 +3540,6 @@ public class Assistant { List log events in a workspace. List the events from the log of a specific workspace. - If **cursor** is not specified, this operation is limited to 40 requests per 30 minutes. If **cursor** is - specified, the limit is 120 requests per minute. For more information, see **Rate limiting**. - parameter workspaceID: Unique identifier of the workspace. - parameter sort: How to sort the returned log events. You can sort by **request_timestamp**. To reverse the sort @@ -3671,8 +3621,6 @@ public class Assistant { List log events in all workspaces. List the events from the logs of all workspaces in the service instance. - If **cursor** is not specified, this operation is limited to 40 requests per 30 minutes. If **cursor** is - specified, the limit is 120 requests per minute. For more information, see **Rate limiting**. - parameter filter: A cacheable parameter that limits the results to those matching the specified filter. You must specify a filter query that includes a value for `language`, as well as a value for @@ -3750,7 +3698,6 @@ public class Assistant { You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes data. For more information about personal data and customer IDs, see [Information security](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security). - This operation is limited to 4 requests per minute. For more information, see **Rate limiting**. - parameter customerID: The customer ID for which all data is to be deleted. - parameter headers: A dictionary of request headers to be sent with this request. diff --git a/Source/AssistantV1/Models/CaptureGroup.swift b/Source/AssistantV1/Models/CaptureGroup.swift index 5fee2a662..210519df8 100644 --- a/Source/AssistantV1/Models/CaptureGroup.swift +++ b/Source/AssistantV1/Models/CaptureGroup.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,13 @@ public struct CaptureGroup: Codable, Equatable { } /** - Initialize a `CaptureGroup` with member variables. + Initialize a `CaptureGroup` with member variables. - - parameter group: A recognized capture group for the entity. - - parameter location: Zero-based character offsets that indicate where the entity value begins and ends in the - input text. + - parameter group: A recognized capture group for the entity. + - parameter location: Zero-based character offsets that indicate where the entity value begins and ends in the + input text. - - returns: An initialized `CaptureGroup`. + - returns: An initialized `CaptureGroup`. */ public init( group: String, diff --git a/Source/AssistantV1/Models/Context.swift b/Source/AssistantV1/Models/Context.swift index f690dae2b..9c60cae44 100644 --- a/Source/AssistantV1/Models/Context.swift +++ b/Source/AssistantV1/Models/Context.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,13 +49,13 @@ public struct Context: Codable, Equatable { } /** - Initialize a `Context` with member variables. + Initialize a `Context` with member variables. - - parameter conversationID: The unique identifier of the conversation. - - parameter system: For internal use only. - - parameter metadata: Metadata related to the message. + - parameter conversationID: The unique identifier of the conversation. + - parameter system: For internal use only. + - parameter metadata: Metadata related to the message. - - returns: An initialized `Context`. + - returns: An initialized `Context`. */ public init( conversationID: String? = nil, diff --git a/Source/AssistantV1/Models/Counterexample.swift b/Source/AssistantV1/Models/Counterexample.swift index 0b3a47b16..513b5a4d4 100644 --- a/Source/AssistantV1/Models/Counterexample.swift +++ b/Source/AssistantV1/Models/Counterexample.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,16 +44,16 @@ public struct Counterexample: Codable, Equatable { } /** - Initialize a `Counterexample` with member variables. + Initialize a `Counterexample` with member variables. - - parameter text: The text of a user input marked as irrelevant input. This string must conform to the following - restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter text: The text of a user input marked as irrelevant input. This string must conform to the following + restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `Counterexample`. + - returns: An initialized `Counterexample`. */ public init( text: String, diff --git a/Source/AssistantV1/Models/CounterexampleCollection.swift b/Source/AssistantV1/Models/CounterexampleCollection.swift index 9685d7f38..84b264233 100644 --- a/Source/AssistantV1/Models/CounterexampleCollection.swift +++ b/Source/AssistantV1/Models/CounterexampleCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/CreateEntity.swift b/Source/AssistantV1/Models/CreateEntity.swift index c6a638ef2..80f1e1df4 100644 --- a/Source/AssistantV1/Models/CreateEntity.swift +++ b/Source/AssistantV1/Models/CreateEntity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,21 +70,21 @@ public struct CreateEntity: Codable, Equatable { } /** - Initialize a `CreateEntity` with member variables. + Initialize a `CreateEntity` with member variables. - - parameter entity: The name of the entity. This string must conform to the following restrictions: - - It can contain only Unicode alphanumeric, underscore, and hyphen characters. - - If you specify an entity name beginning with the reserved prefix `sys-`, it must be the name of a system entity - that you want to enable. (Any entity content specified with the request is ignored.). - - parameter description: The description of the entity. This string cannot contain carriage return, newline, or - tab characters. - - parameter metadata: Any metadata related to the entity. - - parameter fuzzyMatch: Whether to use fuzzy matching for the entity. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - parameter values: An array of objects describing the entity values. + - parameter entity: The name of the entity. This string must conform to the following restrictions: + - It can contain only Unicode alphanumeric, underscore, and hyphen characters. + - If you specify an entity name beginning with the reserved prefix `sys-`, it must be the name of a system entity + that you want to enable. (Any entity content specified with the request is ignored.). + - parameter description: The description of the entity. This string cannot contain carriage return, newline, or + tab characters. + - parameter metadata: Any metadata related to the entity. + - parameter fuzzyMatch: Whether to use fuzzy matching for the entity. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + - parameter values: An array of objects describing the entity values. - - returns: An initialized `CreateEntity`. + - returns: An initialized `CreateEntity`. */ public init( entity: String, diff --git a/Source/AssistantV1/Models/CreateIntent.swift b/Source/AssistantV1/Models/CreateIntent.swift index 1a52cb72d..212d7eaa1 100644 --- a/Source/AssistantV1/Models/CreateIntent.swift +++ b/Source/AssistantV1/Models/CreateIntent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,18 +56,18 @@ public struct CreateIntent: Codable, Equatable { } /** - Initialize a `CreateIntent` with member variables. + Initialize a `CreateIntent` with member variables. - - parameter intent: The name of the intent. This string must conform to the following restrictions: - - It can contain only Unicode alphanumeric, underscore, hyphen, and dot characters. - - It cannot begin with the reserved prefix `sys-`. - - parameter description: The description of the intent. This string cannot contain carriage return, newline, or - tab characters. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - parameter examples: An array of user input examples for the intent. + - parameter intent: The name of the intent. This string must conform to the following restrictions: + - It can contain only Unicode alphanumeric, underscore, hyphen, and dot characters. + - It cannot begin with the reserved prefix `sys-`. + - parameter description: The description of the intent. This string cannot contain carriage return, newline, or + tab characters. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + - parameter examples: An array of user input examples for the intent. - - returns: An initialized `CreateIntent`. + - returns: An initialized `CreateIntent`. */ public init( intent: String, diff --git a/Source/AssistantV1/Models/CreateValue.swift b/Source/AssistantV1/Models/CreateValue.swift index 66badda68..75068dedf 100644 --- a/Source/AssistantV1/Models/CreateValue.swift +++ b/Source/AssistantV1/Models/CreateValue.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,25 +83,25 @@ public struct CreateValue: Codable, Equatable { } /** - Initialize a `CreateValue` with member variables. + Initialize a `CreateValue` with member variables. - - parameter value: The text of the entity value. This string must conform to the following restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter metadata: Any metadata related to the entity value. - - parameter type: Specifies the type of entity value. - - parameter synonyms: An array of synonyms for the entity value. A value can specify either synonyms or patterns - (depending on the value type), but not both. A synonym must conform to the following resrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter patterns: 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/assistant?topic=assistant-entities#entities-create-dictionary-based). - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter value: The text of the entity value. This string must conform to the following restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter metadata: Any metadata related to the entity value. + - parameter type: Specifies the type of entity value. + - parameter synonyms: An array of synonyms for the entity value. A value can specify either synonyms or patterns + (depending on the value type), but not both. A synonym must conform to the following resrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter patterns: 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/assistant?topic=assistant-entities#entities-create-dictionary-based). + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `CreateValue`. + - returns: An initialized `CreateValue`. */ public init( value: String, diff --git a/Source/AssistantV1/Models/CreateWorkspace.swift b/Source/AssistantV1/Models/CreateWorkspace.swift index aec3ebca3..ba27b5ccc 100644 --- a/Source/AssistantV1/Models/CreateWorkspace.swift +++ b/Source/AssistantV1/Models/CreateWorkspace.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,30 +124,30 @@ internal struct CreateWorkspace: Codable, Equatable { } /** - Initialize a `CreateWorkspace` with member variables. - - - parameter name: The name of the workspace. This string cannot contain carriage return, newline, or tab - characters. - - parameter description: The description of the workspace. This string cannot contain carriage return, newline, - or tab characters. - - parameter language: The language of the workspace. - - parameter metadata: Any metadata related to the workspace. - - parameter learningOptOut: Whether training data from the workspace (including artifacts such as intents and - entities) can be used by IBM for general service improvements. `true` indicates that workspace training data is - not to be used. - - parameter systemSettings: Global settings for the workspace. - - parameter workspaceID: The workspace ID of the workspace. - - parameter status: The current status of the workspace. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - parameter intents: An array of objects defining the intents for the workspace. - - parameter entities: An array of objects describing the entities for the workspace. - - parameter dialogNodes: An array of objects describing the dialog nodes in the workspace. - - parameter counterexamples: An array of objects defining input examples that have been marked as irrelevant - input. - - parameter webhooks: - - - returns: An initialized `CreateWorkspace`. + Initialize a `CreateWorkspace` with member variables. + + - parameter name: The name of the workspace. This string cannot contain carriage return, newline, or tab + characters. + - parameter description: The description of the workspace. This string cannot contain carriage return, newline, + or tab characters. + - parameter language: The language of the workspace. + - parameter metadata: Any metadata related to the workspace. + - parameter learningOptOut: Whether training data from the workspace (including artifacts such as intents and + entities) can be used by IBM for general service improvements. `true` indicates that workspace training data is + not to be used. + - parameter systemSettings: Global settings for the workspace. + - parameter workspaceID: The workspace ID of the workspace. + - parameter status: The current status of the workspace. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + - parameter intents: An array of objects defining the intents for the workspace. + - parameter entities: An array of objects describing the entities for the workspace. + - parameter dialogNodes: An array of objects describing the dialog nodes in the workspace. + - parameter counterexamples: An array of objects defining input examples that have been marked as irrelevant + input. + - parameter webhooks: + + - returns: An initialized `CreateWorkspace`. */ public init( name: String? = nil, diff --git a/Source/AssistantV1/Models/DialogNode.swift b/Source/AssistantV1/Models/DialogNode.swift index 05d92ce11..8ff7e834f 100644 --- a/Source/AssistantV1/Models/DialogNode.swift +++ b/Source/AssistantV1/Models/DialogNode.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,41 +216,41 @@ public struct DialogNode: Codable, Equatable { } /** - Initialize a `DialogNode` with member variables. - - - parameter dialogNode: The dialog node ID. This string must conform to the following restrictions: - - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. - - parameter description: The description of the dialog node. This string cannot contain carriage return, - newline, or tab characters. - - parameter conditions: The condition that will trigger the dialog node. This string cannot contain carriage - return, newline, or tab characters. - - parameter parent: The ID of the parent dialog node. This property is omitted if the dialog node has no parent. - - parameter previousSibling: The ID of the previous sibling dialog node. This property is omitted if the dialog - node has no previous sibling. - - parameter 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/assistant?topic=assistant-dialog-overview#dialog-overview-responses). - - parameter context: The context for the dialog node. - - parameter metadata: The metadata for the dialog node. - - parameter nextStep: The next step to execute following this dialog node. - - parameter title: The alias used to identify the dialog node. This string must conform to the following - restrictions: - - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. - - parameter type: How the dialog node is processed. - - parameter eventName: How an `event_handler` node is processed. - - parameter variable: The location in the dialog context where output is stored. - - parameter actions: An array of objects describing any actions to be invoked by the dialog node. - - parameter digressIn: Whether this top-level dialog node can be digressed into. - - parameter digressOut: Whether this dialog node can be returned to after a digression. - - parameter digressOutSlots: Whether the user can digress to top-level nodes while filling out slots. - - parameter userLabel: A label that can be displayed externally to describe the purpose of the node to users. - - parameter disambiguationOptOut: Whether the dialog node should be excluded from disambiguation suggestions. - Valid only when **type**=`standard` or `frame`. - - parameter disabled: For internal use only. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - - returns: An initialized `DialogNode`. + Initialize a `DialogNode` with member variables. + + - parameter dialogNode: The dialog node ID. This string must conform to the following restrictions: + - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. + - parameter description: The description of the dialog node. This string cannot contain carriage return, + newline, or tab characters. + - parameter conditions: The condition that will trigger the dialog node. This string cannot contain carriage + return, newline, or tab characters. + - parameter parent: The ID of the parent dialog node. This property is omitted if the dialog node has no parent. + - parameter previousSibling: The ID of the previous sibling dialog node. This property is omitted if the dialog + node has no previous sibling. + - parameter 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/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + - parameter context: The context for the dialog node. + - parameter metadata: The metadata for the dialog node. + - parameter nextStep: The next step to execute following this dialog node. + - parameter title: The alias used to identify the dialog node. This string must conform to the following + restrictions: + - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. + - parameter type: How the dialog node is processed. + - parameter eventName: How an `event_handler` node is processed. + - parameter variable: The location in the dialog context where output is stored. + - parameter actions: An array of objects describing any actions to be invoked by the dialog node. + - parameter digressIn: Whether this top-level dialog node can be digressed into. + - parameter digressOut: Whether this dialog node can be returned to after a digression. + - parameter digressOutSlots: Whether the user can digress to top-level nodes while filling out slots. + - parameter userLabel: A label that can be displayed externally to describe the purpose of the node to users. + - parameter disambiguationOptOut: Whether the dialog node should be excluded from disambiguation suggestions. + Valid only when **type**=`standard` or `frame`. + - parameter disabled: For internal use only. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + + - returns: An initialized `DialogNode`. */ public init( dialogNode: String, diff --git a/Source/AssistantV1/Models/DialogNodeAction.swift b/Source/AssistantV1/Models/DialogNodeAction.swift index 2a55e9c67..00e0b6709 100644 --- a/Source/AssistantV1/Models/DialogNodeAction.swift +++ b/Source/AssistantV1/Models/DialogNodeAction.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,16 +66,16 @@ public struct DialogNodeAction: Codable, Equatable { } /** - Initialize a `DialogNodeAction` with member variables. + Initialize a `DialogNodeAction` with member variables. - - parameter name: The name of the action. - - parameter resultVariable: The location in the dialog context where the result of the action is stored. - - parameter type: The type of action to invoke. - - parameter parameters: A map of key/value pairs to be provided to the action. - - parameter credentials: The name of the context variable that the client application will use to pass in - credentials for the action. + - parameter name: The name of the action. + - parameter resultVariable: The location in the dialog context where the result of the action is stored. + - parameter type: The type of action to invoke. + - parameter parameters: A map of key/value pairs to be provided to the action. + - parameter credentials: The name of the context variable that the client application will use to pass in + credentials for the action. - - returns: An initialized `DialogNodeAction`. + - returns: An initialized `DialogNodeAction`. */ public init( name: String, diff --git a/Source/AssistantV1/Models/DialogNodeCollection.swift b/Source/AssistantV1/Models/DialogNodeCollection.swift index 1a9982e04..028ee919a 100644 --- a/Source/AssistantV1/Models/DialogNodeCollection.swift +++ b/Source/AssistantV1/Models/DialogNodeCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/DialogNodeNextStep.swift b/Source/AssistantV1/Models/DialogNodeNextStep.swift index 6818f6c0c..eba210b2f 100644 --- a/Source/AssistantV1/Models/DialogNodeNextStep.swift +++ b/Source/AssistantV1/Models/DialogNodeNextStep.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,32 +102,32 @@ public struct DialogNodeNextStep: Codable, Equatable { } /** - Initialize a `DialogNodeNextStep` with member variables. + Initialize a `DialogNodeNextStep` with member variables. - - parameter behavior: What happens after the dialog node completes. The valid values depend on the node type: - - The following values are valid for any node: - - `get_user_input` - - `skip_user_input` - - `jump_to` - - If the node is of type `event_handler` and its parent node is of type `slot` or `frame`, additional values are - also valid: - - if **event_name**=`filled` and the type of the parent node is `slot`: - - `reprompt` - - `skip_all_slots` - - if **event_name**=`nomatch` and the type of the parent node is `slot`: - - `reprompt` - - `skip_slot` - - `skip_all_slots` - - if **event_name**=`generic` and the type of the parent node is `frame`: - - `reprompt` - - `skip_slot` - - `skip_all_slots` - If you specify `jump_to`, then you must also specify a value for the `dialog_node` property. - - parameter dialogNode: The ID of the dialog node to process next. This parameter is required if - **behavior**=`jump_to`. - - parameter selector: Which part of the dialog node to process next. + - parameter behavior: What happens after the dialog node completes. The valid values depend on the node type: + - The following values are valid for any node: + - `get_user_input` + - `skip_user_input` + - `jump_to` + - If the node is of type `event_handler` and its parent node is of type `slot` or `frame`, additional values are + also valid: + - if **event_name**=`filled` and the type of the parent node is `slot`: + - `reprompt` + - `skip_all_slots` + - if **event_name**=`nomatch` and the type of the parent node is `slot`: + - `reprompt` + - `skip_slot` + - `skip_all_slots` + - if **event_name**=`generic` and the type of the parent node is `frame`: + - `reprompt` + - `skip_slot` + - `skip_all_slots` + If you specify `jump_to`, then you must also specify a value for the `dialog_node` property. + - parameter dialogNode: The ID of the dialog node to process next. This parameter is required if + **behavior**=`jump_to`. + - parameter selector: Which part of the dialog node to process next. - - returns: An initialized `DialogNodeNextStep`. + - returns: An initialized `DialogNodeNextStep`. */ public init( behavior: String, diff --git a/Source/AssistantV1/Models/DialogNodeOutput.swift b/Source/AssistantV1/Models/DialogNodeOutput.swift index 256d93154..109f72ab0 100644 --- a/Source/AssistantV1/Models/DialogNodeOutput.swift +++ b/Source/AssistantV1/Models/DialogNodeOutput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,12 +44,12 @@ public struct DialogNodeOutput: Codable, Equatable { } /** - Initialize a `DialogNodeOutput` with member variables. + Initialize a `DialogNodeOutput` with member variables. - - parameter generic: An array of objects describing the output defined for the dialog node. - - parameter modifiers: Options that modify how specified output is handled. + - parameter generic: An array of objects describing the output defined for the dialog node. + - parameter modifiers: Options that modify how specified output is handled. - - returns: An initialized `DialogNodeOutput`. + - returns: An initialized `DialogNodeOutput`. */ public init( generic: [DialogNodeOutputGeneric]? = nil, diff --git a/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift b/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift index 42a47402c..a7545dc06 100644 --- a/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift +++ b/Source/AssistantV1/Models/DialogNodeOutputGeneric.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,7 @@ public struct DialogNodeOutputGeneric: Codable, Equatable { /** 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. + **Note:** The **search_skill** response type is used only by the v2 runtime API. */ public enum ResponseType: String { case text = "text" @@ -63,8 +62,7 @@ public struct DialogNodeOutputGeneric: Codable, Equatable { /** 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. + **Note:** The **search_skill** response type is used only by the v2 runtime API. */ public var responseType: String @@ -174,45 +172,44 @@ public struct DialogNodeOutputGeneric: Codable, Equatable { } /** - Initialize a `DialogNodeOutputGeneric` with member variables. - - - parameter 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 **search_skill** response type is available only for Plus and Premium users, and is used only by - the v2 runtime API. - - parameter values: A list of one or more objects defining text responses. Required when - **response_type**=`text`. - - parameter selectionPolicy: How a response is selected from the list, if more than one response is specified. - Valid only when **response_type**=`text`. - - parameter delimiter: The delimiter to use as a separator between responses when - `selection_policy`=`multiline`. - - parameter time: How long to pause, in milliseconds. The valid values are from 0 to 10000. Valid only when - **response_type**=`pause`. - - parameter typing: Whether to send a "user is typing" event during the pause. Ignored if the channel does not - support this event. Valid only when **response_type**=`pause`. - - parameter source: The URL of the image. Required when **response_type**=`image`. - - parameter title: An optional title to show before the response. Valid only when **response_type**=`image` or - `option`. - - parameter description: An optional description to show with the response. Valid only when - **response_type**=`image` or `option`. - - parameter preference: The preferred type of control to display, if supported by the channel. Valid only when - **response_type**=`option`. - - parameter options: An array of objects describing the options from which the user can choose. You can include - up to 20 options. Required when **response_type**=`option`. - - parameter messageToHumanAgent: An optional message to be sent to the human agent who will be taking over the - conversation. Valid only when **reponse_type**=`connect_to_agent`. - - parameter query: 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/discovery?topic=discovery-query-operators#query-operators). Required - when **response_type**=`search_skill`. - - parameter queryType: The type of the search query. Required when **response_type**=`search_skill`. - - parameter filter: 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/discovery?topic=discovery-query-parameters#filter). - - parameter discoveryVersion: The version of the Discovery service API to use for the query. - - - returns: An initialized `DialogNodeOutputGeneric`. + Initialize a `DialogNodeOutputGeneric` with member variables. + + - parameter 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 **search_skill** response type is used only by the v2 runtime API. + - parameter values: A list of one or more objects defining text responses. Required when + **response_type**=`text`. + - parameter selectionPolicy: How a response is selected from the list, if more than one response is specified. + Valid only when **response_type**=`text`. + - parameter delimiter: The delimiter to use as a separator between responses when + `selection_policy`=`multiline`. + - parameter time: How long to pause, in milliseconds. The valid values are from 0 to 10000. Valid only when + **response_type**=`pause`. + - parameter typing: Whether to send a "user is typing" event during the pause. Ignored if the channel does not + support this event. Valid only when **response_type**=`pause`. + - parameter source: The URL of the image. Required when **response_type**=`image`. + - parameter title: An optional title to show before the response. Valid only when **response_type**=`image` or + `option`. + - parameter description: An optional description to show with the response. Valid only when + **response_type**=`image` or `option`. + - parameter preference: The preferred type of control to display, if supported by the channel. Valid only when + **response_type**=`option`. + - parameter options: An array of objects describing the options from which the user can choose. You can include + up to 20 options. Required when **response_type**=`option`. + - parameter messageToHumanAgent: An optional message to be sent to the human agent who will be taking over the + conversation. Valid only when **reponse_type**=`connect_to_agent`. + - parameter query: 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/discovery?topic=discovery-query-operators#query-operators). Required + when **response_type**=`search_skill`. + - parameter queryType: The type of the search query. Required when **response_type**=`search_skill`. + - parameter filter: 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/discovery?topic=discovery-query-parameters#filter). + - parameter discoveryVersion: The version of the Discovery service API to use for the query. + + - returns: An initialized `DialogNodeOutputGeneric`. */ public init( responseType: String, diff --git a/Source/AssistantV1/Models/DialogNodeOutputModifiers.swift b/Source/AssistantV1/Models/DialogNodeOutputModifiers.swift index 6cc2bf42e..317704626 100644 --- a/Source/AssistantV1/Models/DialogNodeOutputModifiers.swift +++ b/Source/AssistantV1/Models/DialogNodeOutputModifiers.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,13 +33,13 @@ public struct DialogNodeOutputModifiers: Codable, Equatable { } /** - Initialize a `DialogNodeOutputModifiers` with member variables. + Initialize a `DialogNodeOutputModifiers` with member variables. - - parameter overwrite: Whether values in the output will overwrite output values in an array specified by - previously executed dialog nodes. If this option is set to `false`, new values will be appended to previously - specified values. + - parameter overwrite: Whether values in the output will overwrite output values in an array specified by + previously executed dialog nodes. If this option is set to `false`, new values will be appended to previously + specified values. - - returns: An initialized `DialogNodeOutputModifiers`. + - returns: An initialized `DialogNodeOutputModifiers`. */ public init( overwrite: Bool? = nil diff --git a/Source/AssistantV1/Models/DialogNodeOutputOptionsElement.swift b/Source/AssistantV1/Models/DialogNodeOutputOptionsElement.swift index 292f25d17..ce1e05caa 100644 --- a/Source/AssistantV1/Models/DialogNodeOutputOptionsElement.swift +++ b/Source/AssistantV1/Models/DialogNodeOutputOptionsElement.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,13 +37,13 @@ public struct DialogNodeOutputOptionsElement: Codable, Equatable { } /** - Initialize a `DialogNodeOutputOptionsElement` with member variables. + Initialize a `DialogNodeOutputOptionsElement` with member variables. - - parameter label: The user-facing label for the option. - - parameter value: An object defining the message input to be sent to the Watson Assistant service if the user - selects the corresponding option. + - parameter label: The user-facing label for the option. + - parameter value: An object defining the message input to be sent to the Watson Assistant service if the user + selects the corresponding option. - - returns: An initialized `DialogNodeOutputOptionsElement`. + - returns: An initialized `DialogNodeOutputOptionsElement`. */ public init( label: String, diff --git a/Source/AssistantV1/Models/DialogNodeOutputOptionsElementValue.swift b/Source/AssistantV1/Models/DialogNodeOutputOptionsElementValue.swift index c3e06a7fb..fa300121d 100644 --- a/Source/AssistantV1/Models/DialogNodeOutputOptionsElementValue.swift +++ b/Source/AssistantV1/Models/DialogNodeOutputOptionsElementValue.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,17 +49,17 @@ public struct DialogNodeOutputOptionsElementValue: Codable, Equatable { } /** - Initialize a `DialogNodeOutputOptionsElementValue` with member variables. + Initialize a `DialogNodeOutputOptionsElementValue` with member variables. - - parameter input: An input object that includes the input text. - - parameter intents: An array of intents to be used while processing the input. - **Note:** This property is supported for backward compatibility with applications that use the v1 **Get response - to user input** method. - - parameter entities: An array of entities to be used while processing the user input. - **Note:** This property is supported for backward compatibility with applications that use the v1 **Get response - to user input** method. + - parameter input: An input object that includes the input text. + - parameter intents: An array of intents to be used while processing the input. + **Note:** This property is supported for backward compatibility with applications that use the v1 **Get response + to user input** method. + - parameter entities: An array of entities to be used while processing the user input. + **Note:** This property is supported for backward compatibility with applications that use the v1 **Get response + to user input** method. - - returns: An initialized `DialogNodeOutputOptionsElementValue`. + - returns: An initialized `DialogNodeOutputOptionsElementValue`. */ public init( input: MessageInput? = nil, diff --git a/Source/AssistantV1/Models/DialogNodeOutputTextValuesElement.swift b/Source/AssistantV1/Models/DialogNodeOutputTextValuesElement.swift index 806e34cd0..38b98a663 100644 --- a/Source/AssistantV1/Models/DialogNodeOutputTextValuesElement.swift +++ b/Source/AssistantV1/Models/DialogNodeOutputTextValuesElement.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,12 +31,12 @@ public struct DialogNodeOutputTextValuesElement: Codable, Equatable { } /** - Initialize a `DialogNodeOutputTextValuesElement` with member variables. + Initialize a `DialogNodeOutputTextValuesElement` with member variables. - - parameter text: The text of a response. This string can include newline characters (`\n`), Markdown tagging, - or other special characters, if supported by the channel. + - parameter text: The text of a response. This string can include newline characters (`\n`), Markdown tagging, + or other special characters, if supported by the channel. - - returns: An initialized `DialogNodeOutputTextValuesElement`. + - returns: An initialized `DialogNodeOutputTextValuesElement`. */ public init( text: String? = nil diff --git a/Source/AssistantV1/Models/DialogNodeVisitedDetails.swift b/Source/AssistantV1/Models/DialogNodeVisitedDetails.swift index 3ba29c3f1..a6382eee1 100644 --- a/Source/AssistantV1/Models/DialogNodeVisitedDetails.swift +++ b/Source/AssistantV1/Models/DialogNodeVisitedDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,13 +42,13 @@ public struct DialogNodeVisitedDetails: Codable, Equatable { } /** - Initialize a `DialogNodeVisitedDetails` with member variables. + Initialize a `DialogNodeVisitedDetails` with member variables. - - parameter dialogNode: A dialog node that was triggered during processing of the input message. - - parameter title: The title of the dialog node. - - parameter conditions: The conditions that trigger the dialog node. + - parameter dialogNode: A dialog node that was triggered during processing of the input message. + - parameter title: The title of the dialog node. + - parameter conditions: The conditions that trigger the dialog node. - - returns: An initialized `DialogNodeVisitedDetails`. + - returns: An initialized `DialogNodeVisitedDetails`. */ public init( dialogNode: String? = nil, diff --git a/Source/AssistantV1/Models/DialogSuggestion.swift b/Source/AssistantV1/Models/DialogSuggestion.swift index 7f1909d70..380aa3369 100644 --- a/Source/AssistantV1/Models/DialogSuggestion.swift +++ b/Source/AssistantV1/Models/DialogSuggestion.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,18 +52,18 @@ public struct DialogSuggestion: Codable, Equatable { } /** - Initialize a `DialogSuggestion` with member variables. + Initialize a `DialogSuggestion` with member variables. - - parameter label: The user-facing label for the disambiguation option. This label is taken from the **title** - or **user_label** property of the corresponding dialog node, depending on the disambiguation options. - - parameter value: An object defining the message input, intents, and entities to be sent to the Watson - Assistant service if the user selects the corresponding disambiguation option. - - parameter output: The dialog output that will be returned from the Watson Assistant service if the user - selects the corresponding option. - - parameter dialogNode: The ID of the dialog node that the **label** property is taken from. The **label** - property is populated using the value of the dialog node's **user_label** property. + - parameter label: The user-facing label for the disambiguation option. This label is taken from the **title** + or **user_label** property of the corresponding dialog node, depending on the disambiguation options. + - parameter value: An object defining the message input, intents, and entities to be sent to the Watson + Assistant service if the user selects the corresponding disambiguation option. + - parameter output: The dialog output that will be returned from the Watson Assistant service if the user + selects the corresponding option. + - parameter dialogNode: The ID of the dialog node that the **label** property is taken from. The **label** + property is populated using the value of the dialog node's **user_label** property. - - returns: An initialized `DialogSuggestion`. + - returns: An initialized `DialogSuggestion`. */ public init( label: String, diff --git a/Source/AssistantV1/Models/DialogSuggestionOutput.swift b/Source/AssistantV1/Models/DialogSuggestionOutput.swift index 98423df7c..3157715bb 100644 --- a/Source/AssistantV1/Models/DialogSuggestionOutput.swift +++ b/Source/AssistantV1/Models/DialogSuggestionOutput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,19 +59,19 @@ public struct DialogSuggestionOutput: Codable, Equatable { } /** - Initialize a `DialogSuggestionOutput` with member variables. + Initialize a `DialogSuggestionOutput` with member variables. - - parameter text: An array of responses to the user. - - parameter 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. - - parameter 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. - - parameter generic: Output intended for any channel. It is the responsibility of the client application to - implement the supported response types. + - parameter text: An array of responses to the user. + - parameter 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. + - parameter 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. + - parameter generic: Output intended for any channel. It is the responsibility of the client application to + implement the supported response types. - - returns: An initialized `DialogSuggestionOutput`. + - returns: An initialized `DialogSuggestionOutput`. */ public init( text: [String], diff --git a/Source/AssistantV1/Models/DialogSuggestionResponseGeneric.swift b/Source/AssistantV1/Models/DialogSuggestionResponseGeneric.swift index c5f63c55d..bc7ddf1cb 100644 --- a/Source/AssistantV1/Models/DialogSuggestionResponseGeneric.swift +++ b/Source/AssistantV1/Models/DialogSuggestionResponseGeneric.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,9 +22,7 @@ public struct DialogSuggestionResponseGeneric: Codable, Equatable { /** 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. + **Note:** The **search_skill** response type is is used only by the v2 runtime API. */ public enum ResponseType: String { case text = "text" @@ -46,9 +44,7 @@ public struct DialogSuggestionResponseGeneric: Codable, Equatable { /** 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. + **Note:** The **search_skill** response type is is used only by the v2 runtime API. */ public var responseType: String @@ -125,29 +121,27 @@ public struct DialogSuggestionResponseGeneric: Codable, Equatable { } /** - Initialize a `DialogSuggestionResponseGeneric` with member variables. - - - parameter 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. - - parameter text: The text of the response. - - parameter time: How long to pause, in milliseconds. - - parameter typing: Whether to send a "user is typing" event during the pause. - - parameter source: The URL of the image. - - parameter title: The title or introductory text to show before the response. - - parameter description: The description to show with the the response. - - parameter preference: The preferred type of control to display. - - parameter options: An array of objects describing the options from which the user can choose. - - parameter messageToHumanAgent: A message to be sent to the human agent who will be taking over the - conversation. - - parameter topic: A label identifying the topic of the conversation, derived from the **title** property of the - relevant node. - - parameter 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 **title** property. - - - returns: An initialized `DialogSuggestionResponseGeneric`. + Initialize a `DialogSuggestionResponseGeneric` with member variables. + + - parameter 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 **search_skill** response type is is used only by the v2 runtime API. + - parameter text: The text of the response. + - parameter time: How long to pause, in milliseconds. + - parameter typing: Whether to send a "user is typing" event during the pause. + - parameter source: The URL of the image. + - parameter title: The title or introductory text to show before the response. + - parameter description: The description to show with the the response. + - parameter preference: The preferred type of control to display. + - parameter options: An array of objects describing the options from which the user can choose. + - parameter messageToHumanAgent: A message to be sent to the human agent who will be taking over the + conversation. + - parameter topic: A label identifying the topic of the conversation, derived from the **title** property of the + relevant node. + - parameter 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 **title** property. + + - returns: An initialized `DialogSuggestionResponseGeneric`. */ public init( responseType: String, diff --git a/Source/AssistantV1/Models/DialogSuggestionValue.swift b/Source/AssistantV1/Models/DialogSuggestionValue.swift index 63010d04b..67eb6d814 100644 --- a/Source/AssistantV1/Models/DialogSuggestionValue.swift +++ b/Source/AssistantV1/Models/DialogSuggestionValue.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,13 +45,13 @@ public struct DialogSuggestionValue: Codable, Equatable { } /** - Initialize a `DialogSuggestionValue` with member variables. + Initialize a `DialogSuggestionValue` with member variables. - - parameter input: An input object that includes the input text. - - parameter intents: An array of intents to be sent along with the user input. - - parameter entities: An array of entities to be sent along with the user input. + - parameter input: An input object that includes the input text. + - parameter intents: An array of intents to be sent along with the user input. + - parameter entities: An array of entities to be sent along with the user input. - - returns: An initialized `DialogSuggestionValue`. + - returns: An initialized `DialogSuggestionValue`. */ public init( input: MessageInput? = nil, diff --git a/Source/AssistantV1/Models/Entity.swift b/Source/AssistantV1/Models/Entity.swift index c1f91cf8f..e35ef8c9c 100644 --- a/Source/AssistantV1/Models/Entity.swift +++ b/Source/AssistantV1/Models/Entity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/EntityCollection.swift b/Source/AssistantV1/Models/EntityCollection.swift index e90abf981..58efe3400 100644 --- a/Source/AssistantV1/Models/EntityCollection.swift +++ b/Source/AssistantV1/Models/EntityCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/EntityMention.swift b/Source/AssistantV1/Models/EntityMention.swift index 5f6ba9b0f..0f404b357 100644 --- a/Source/AssistantV1/Models/EntityMention.swift +++ b/Source/AssistantV1/Models/EntityMention.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/EntityMentionCollection.swift b/Source/AssistantV1/Models/EntityMentionCollection.swift index ed626424f..cc0f1227c 100644 --- a/Source/AssistantV1/Models/EntityMentionCollection.swift +++ b/Source/AssistantV1/Models/EntityMentionCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/Example.swift b/Source/AssistantV1/Models/Example.swift index a8f006de5..cd52bd7a8 100644 --- a/Source/AssistantV1/Models/Example.swift +++ b/Source/AssistantV1/Models/Example.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,16 +50,16 @@ public struct Example: Codable, Equatable { } /** - Initialize a `Example` with member variables. + Initialize a `Example` with member variables. - - parameter text: The text of a user input example. This string must conform to the following restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter mentions: An array of contextual entity mentions. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter text: The text of a user input example. This string must conform to the following restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter mentions: An array of contextual entity mentions. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `Example`. + - returns: An initialized `Example`. */ public init( text: String, diff --git a/Source/AssistantV1/Models/ExampleCollection.swift b/Source/AssistantV1/Models/ExampleCollection.swift index 69333af3d..f1892a2f7 100644 --- a/Source/AssistantV1/Models/ExampleCollection.swift +++ b/Source/AssistantV1/Models/ExampleCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/Intent.swift b/Source/AssistantV1/Models/Intent.swift index 1cd939890..10533d028 100644 --- a/Source/AssistantV1/Models/Intent.swift +++ b/Source/AssistantV1/Models/Intent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/IntentCollection.swift b/Source/AssistantV1/Models/IntentCollection.swift index c8286a5f4..98a09bb47 100644 --- a/Source/AssistantV1/Models/IntentCollection.swift +++ b/Source/AssistantV1/Models/IntentCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/Log.swift b/Source/AssistantV1/Models/Log.swift index 86ae67539..31624fd98 100644 --- a/Source/AssistantV1/Models/Log.swift +++ b/Source/AssistantV1/Models/Log.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/LogCollection.swift b/Source/AssistantV1/Models/LogCollection.swift index 9263752f4..fc8a46ec4 100644 --- a/Source/AssistantV1/Models/LogCollection.swift +++ b/Source/AssistantV1/Models/LogCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/LogMessage.swift b/Source/AssistantV1/Models/LogMessage.swift index fb87ec54e..8a4c8cf0d 100644 --- a/Source/AssistantV1/Models/LogMessage.swift +++ b/Source/AssistantV1/Models/LogMessage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,12 +47,12 @@ public struct LogMessage: Codable, Equatable { } /** - Initialize a `LogMessage` with member variables. + Initialize a `LogMessage` with member variables. - - parameter level: The severity of the log message. - - parameter msg: The text of the log message. + - parameter level: The severity of the log message. + - parameter msg: The text of the log message. - - returns: An initialized `LogMessage`. + - returns: An initialized `LogMessage`. */ public init( level: String, diff --git a/Source/AssistantV1/Models/LogPagination.swift b/Source/AssistantV1/Models/LogPagination.swift index c33c6828c..164302b22 100644 --- a/Source/AssistantV1/Models/LogPagination.swift +++ b/Source/AssistantV1/Models/LogPagination.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/Mention.swift b/Source/AssistantV1/Models/Mention.swift index 5490d1b70..15987ff48 100644 --- a/Source/AssistantV1/Models/Mention.swift +++ b/Source/AssistantV1/Models/Mention.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,13 @@ public struct Mention: Codable, Equatable { } /** - Initialize a `Mention` with member variables. + Initialize a `Mention` with member variables. - - parameter entity: The name of the entity. - - parameter location: An array of zero-based character offsets that indicate where the entity mentions begin and - end in the input text. + - parameter entity: The name of the entity. + - parameter location: An array of zero-based character offsets that indicate where the entity mentions begin and + end in the input text. - - returns: An initialized `Mention`. + - returns: An initialized `Mention`. */ public init( entity: String, diff --git a/Source/AssistantV1/Models/MessageContextMetadata.swift b/Source/AssistantV1/Models/MessageContextMetadata.swift index fdbf3a92b..e07bb1ffc 100644 --- a/Source/AssistantV1/Models/MessageContextMetadata.swift +++ b/Source/AssistantV1/Models/MessageContextMetadata.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,16 +42,16 @@ public struct MessageContextMetadata: Codable, Equatable { } /** - Initialize a `MessageContextMetadata` with member variables. + Initialize a `MessageContextMetadata` with member variables. - - parameter deployment: A label identifying the deployment environment, used for filtering log data. This string - cannot contain carriage return, newline, or tab characters. - - parameter userID: A string value that identifies the user who is interacting with the workspace. The client - must provide a unique identifier for each individual end user who accesses the application. For Plus and Premium - plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage - return, newline, or tab characters. + - parameter deployment: A label identifying the deployment environment, used for filtering log data. This string + cannot contain carriage return, newline, or tab characters. + - parameter userID: A string value that identifies the user who is interacting with the workspace. The client + must provide a unique identifier for each individual end user who accesses the application. For Plus and Premium + plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage + return, newline, or tab characters. - - returns: An initialized `MessageContextMetadata`. + - returns: An initialized `MessageContextMetadata`. */ public init( deployment: String? = nil, diff --git a/Source/AssistantV1/Models/MessageInput.swift b/Source/AssistantV1/Models/MessageInput.swift index 8c5d15e45..253f9cb19 100644 --- a/Source/AssistantV1/Models/MessageInput.swift +++ b/Source/AssistantV1/Models/MessageInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,23 +68,23 @@ public struct MessageInput: Codable, Equatable { } /** - Initialize a `MessageInput` with member variables. + Initialize a `MessageInput` with member variables. - - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab - characters. - - parameter spellingSuggestions: Whether to use spelling correction when processing the input. This property - overrides the value of the **spelling_suggestions** property in the workspace settings. - - parameter spellingAutoCorrect: Whether to use autocorrection when processing the input. If spelling correction - is used and this property is `false`, any suggested corrections are returned in the **suggested_text** property - of the message response. If this property is `true`, any corrections are automatically applied to the user input, - and the original text is returned in the **original_text** property of the message response. This property - overrides the value of the **spelling_auto_correct** property in the workspace settings. - - parameter suggestedText: Any suggested corrections of the input text. This property is returned only if - spelling correction is enabled and autocorrection is disabled. - - parameter originalText: The original user input text. This property is returned only if autocorrection is - enabled and the user input was corrected. + - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab + characters. + - parameter spellingSuggestions: Whether to use spelling correction when processing the input. This property + overrides the value of the **spelling_suggestions** property in the workspace settings. + - parameter spellingAutoCorrect: Whether to use autocorrection when processing the input. If spelling correction + is used and this property is `false`, any suggested corrections are returned in the **suggested_text** property + of the message response. If this property is `true`, any corrections are automatically applied to the user input, + and the original text is returned in the **original_text** property of the message response. This property + overrides the value of the **spelling_auto_correct** property in the workspace settings. + - parameter suggestedText: Any suggested corrections of the input text. This property is returned only if + spelling correction is enabled and autocorrection is disabled. + - parameter originalText: The original user input text. This property is returned only if autocorrection is + enabled and the user input was corrected. - - returns: An initialized `MessageInput`. + - returns: An initialized `MessageInput`. */ public init( text: String? = nil, diff --git a/Source/AssistantV1/Models/MessageRequest.swift b/Source/AssistantV1/Models/MessageRequest.swift index 40e07613e..56ee9827a 100644 --- a/Source/AssistantV1/Models/MessageRequest.swift +++ b/Source/AssistantV1/Models/MessageRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,22 +71,22 @@ public struct MessageRequest: Codable, Equatable { } /** - Initialize a `MessageRequest` with member variables. + Initialize a `MessageRequest` with member variables. - - parameter input: An input object that includes the input text. - - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response - to continue using those intents rather than trying to recognize intents in the new input. - - parameter entities: Entities to use when evaluating the message. Include entities from the previous response - to continue using those entities rather than detecting entities in the new input. - - parameter alternateIntents: Whether to return more than one intent. A value of `true` indicates that all - matching intents are returned. - - parameter context: State information for the conversation. To maintain state, include the context from the - previous response. - - parameter output: An output object that includes the response to the user, the dialog nodes that were - triggered, and messages from the log. - - parameter actions: An array of objects describing any actions requested by the dialog node. + - parameter input: An input object that includes the input text. + - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response + to continue using those intents rather than trying to recognize intents in the new input. + - parameter entities: Entities to use when evaluating the message. Include entities from the previous response + to continue using those entities rather than detecting entities in the new input. + - parameter alternateIntents: Whether to return more than one intent. A value of `true` indicates that all + matching intents are returned. + - parameter context: State information for the conversation. To maintain state, include the context from the + previous response. + - parameter output: An output object that includes the response to the user, the dialog nodes that were + triggered, and messages from the log. + - parameter actions: An array of objects describing any actions requested by the dialog node. - - returns: An initialized `MessageRequest`. + - returns: An initialized `MessageRequest`. */ public init( input: MessageInput? = nil, diff --git a/Source/AssistantV1/Models/MessageResponse.swift b/Source/AssistantV1/Models/MessageResponse.swift index 73b502e8d..1d9629761 100644 --- a/Source/AssistantV1/Models/MessageResponse.swift +++ b/Source/AssistantV1/Models/MessageResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/OutputData.swift b/Source/AssistantV1/Models/OutputData.swift index 33460f5cd..56b5f239d 100644 --- a/Source/AssistantV1/Models/OutputData.swift +++ b/Source/AssistantV1/Models/OutputData.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,20 +66,20 @@ public struct OutputData: Codable, Equatable { } /** - Initialize a `OutputData` with member variables. + Initialize a `OutputData` with member variables. - - parameter logMessages: An array of up to 50 messages logged with the request. - - parameter text: An array of responses to the user. - - parameter 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. - - parameter 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. - - parameter generic: Output intended for any channel. It is the responsibility of the client application to - implement the supported response types. + - parameter logMessages: An array of up to 50 messages logged with the request. + - parameter text: An array of responses to the user. + - parameter 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. + - parameter 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. + - parameter generic: Output intended for any channel. It is the responsibility of the client application to + implement the supported response types. - - returns: An initialized `OutputData`. + - returns: An initialized `OutputData`. */ public init( logMessages: [LogMessage], diff --git a/Source/AssistantV1/Models/Pagination.swift b/Source/AssistantV1/Models/Pagination.swift index 4703b0f02..88028e466 100644 --- a/Source/AssistantV1/Models/Pagination.swift +++ b/Source/AssistantV1/Models/Pagination.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/RuntimeEntity.swift b/Source/AssistantV1/Models/RuntimeEntity.swift index 7978cd747..b2d5c2602 100644 --- a/Source/AssistantV1/Models/RuntimeEntity.swift +++ b/Source/AssistantV1/Models/RuntimeEntity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,28 +90,28 @@ public struct RuntimeEntity: Codable, Equatable { } /** - Initialize a `RuntimeEntity` with member variables. - - - parameter entity: An entity detected in the input. - - parameter location: An array of zero-based character offsets that indicate where the detected entity values - begin and end in the input text. - - parameter value: The entity value that was recognized in the user input. - - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. - - parameter metadata: Any metadata for the entity. - - parameter groups: The recognized capture groups for the entity, as defined by the entity pattern. - - parameter interpretation: An object containing detailed information about the entity recognized in the user - input. This property is included only if the new system entities are enabled for the workspace. - For more information about how the new system entities are interpreted, see the - [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities). - - parameter alternatives: An array of possible alternative values that the user might have intended instead of - the value returned in the **value** property. This property is returned only for `@sys-time` and `@sys-date` - entities when the user's input is ambiguous. - This property is included only if the new system entities are enabled for the workspace. - - parameter role: An object describing the role played by a system entity that is specifies the beginning or end - of a range recognized in the user input. This property is included only if the new system entities are enabled - for the workspace. - - - returns: An initialized `RuntimeEntity`. + Initialize a `RuntimeEntity` with member variables. + + - parameter entity: An entity detected in the input. + - parameter location: An array of zero-based character offsets that indicate where the detected entity values + begin and end in the input text. + - parameter value: The entity value that was recognized in the user input. + - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. + - parameter metadata: Any metadata for the entity. + - parameter groups: The recognized capture groups for the entity, as defined by the entity pattern. + - parameter interpretation: An object containing detailed information about the entity recognized in the user + input. This property is included only if the new system entities are enabled for the workspace. + For more information about how the new system entities are interpreted, see the + [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities). + - parameter alternatives: An array of possible alternative values that the user might have intended instead of + the value returned in the **value** property. This property is returned only for `@sys-time` and `@sys-date` + entities when the user's input is ambiguous. + This property is included only if the new system entities are enabled for the workspace. + - parameter role: An object describing the role played by a system entity that is specifies the beginning or end + of a range recognized in the user input. This property is included only if the new system entities are enabled + for the workspace. + + - returns: An initialized `RuntimeEntity`. */ public init( entity: String, diff --git a/Source/AssistantV1/Models/RuntimeEntityAlternative.swift b/Source/AssistantV1/Models/RuntimeEntityAlternative.swift index 17709e9c1..0311bcaab 100644 --- a/Source/AssistantV1/Models/RuntimeEntityAlternative.swift +++ b/Source/AssistantV1/Models/RuntimeEntityAlternative.swift @@ -38,12 +38,12 @@ public struct RuntimeEntityAlternative: Codable, Equatable { } /** - Initialize a `RuntimeEntityAlternative` with member variables. + Initialize a `RuntimeEntityAlternative` with member variables. - - parameter value: The entity value that was recognized in the user input. - - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. + - parameter value: The entity value that was recognized in the user input. + - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. - - returns: An initialized `RuntimeEntityAlternative`. + - returns: An initialized `RuntimeEntityAlternative`. */ public init( value: String? = nil, diff --git a/Source/AssistantV1/Models/RuntimeEntityInterpretation.swift b/Source/AssistantV1/Models/RuntimeEntityInterpretation.swift index 884d05f3e..b499f3ca5 100644 --- a/Source/AssistantV1/Models/RuntimeEntityInterpretation.swift +++ b/Source/AssistantV1/Models/RuntimeEntityInterpretation.swift @@ -213,60 +213,60 @@ public struct RuntimeEntityInterpretation: Codable, Equatable { } /** - Initialize a `RuntimeEntityInterpretation` with member variables. - - - parameter calendarType: The calendar used to represent a recognized date (for example, `Gregorian`). - - parameter datetimeLink: A unique identifier used to associate a recognized time and date. If the user input - contains a date and time that are mentioned together (for example, `Today at 5`, the same **datetime_link** value - is returned for both the `@sys-date` and `@sys-time` entities). - - parameter festival: A locale-specific holiday name (such as `thanksgiving` or `christmas`). This property is - included when a `@sys-date` entity is recognized based on a holiday name in the user input. - - parameter granularity: The precision or duration of a time range specified by a recognized `@sys-time` or - `@sys-date` entity. - - parameter rangeLink: A unique identifier used to associate multiple recognized `@sys-date`, `@sys-time`, or - `@sys-number` entities that are recognized as a range of values in the user's input (for example, `from July 4 - until July 14` or `from 20 to 25`). - - parameter rangeModifier: The word in the user input that indicates that a `sys-date` or `sys-time` entity is - part of an implied range where only one date or time is specified (for example, `since` or `until`). - - parameter relativeDay: A recognized mention of a relative day, represented numerically as an offset from the - current date (for example, `-1` for `yesterday` or `10` for `in ten days`). - - parameter relativeMonth: A recognized mention of a relative month, represented numerically as an offset from - the current month (for example, `1` for `next month` or `-3` for `three months ago`). - - parameter relativeWeek: A recognized mention of a relative week, represented numerically as an offset from the - current week (for example, `2` for `in two weeks` or `-1` for `last week). - - parameter relativeWeekend: A recognized mention of a relative date range for a weekend, represented - numerically as an offset from the current weekend (for example, `0` for `this weekend` or `-1` for `last - weekend`). - - parameter relativeYear: A recognized mention of a relative year, represented numerically as an offset from the - current year (for example, `1` for `next year` or `-5` for `five years ago`). - - parameter specificDay: A recognized mention of a specific date, represented numerically as the date within the - month (for example, `30` for `June 30`.). - - parameter specificDayOfWeek: A recognized mention of a specific day of the week as a lowercase string (for - example, `monday`). - - parameter specificMonth: A recognized mention of a specific month, represented numerically (for example, `7` - for `July`). - - parameter specificQuarter: A recognized mention of a specific quarter, represented numerically (for example, - `3` for `the third quarter`). - - parameter specificYear: A recognized mention of a specific year (for example, `2016`). - - parameter numericValue: A recognized numeric value, represented as an integer or double. - - parameter subtype: The type of numeric value recognized in the user input (`integer` or `rational`). - - parameter partOfDay: A recognized term for a time that was mentioned as a part of the day in the user's input - (for example, `morning` or `afternoon`). - - parameter relativeHour: A recognized mention of a relative hour, represented numerically as an offset from the - current hour (for example, `3` for `in three hours` or `-1` for `an hour ago`). - - parameter relativeMinute: A recognized mention of a relative time, represented numerically as an offset in - minutes from the current time (for example, `5` for `in five minutes` or `-15` for `fifteen minutes ago`). - - parameter relativeSecond: A recognized mention of a relative time, represented numerically as an offset in - seconds from the current time (for example, `10` for `in ten seconds` or `-30` for `thirty seconds ago`). - - parameter specificHour: A recognized specific hour mentioned as part of a time value (for example, `10` for - `10:15 AM`.). - - parameter specificMinute: A recognized specific minute mentioned as part of a time value (for example, `15` - for `10:15 AM`.). - - parameter specificSecond: A recognized specific second mentioned as part of a time value (for example, `30` - for `10:15:30 AM`.). - - parameter timezone: A recognized time zone mentioned as part of a time value (for example, `EST`). - - - returns: An initialized `RuntimeEntityInterpretation`. + Initialize a `RuntimeEntityInterpretation` with member variables. + + - parameter calendarType: The calendar used to represent a recognized date (for example, `Gregorian`). + - parameter datetimeLink: A unique identifier used to associate a recognized time and date. If the user input + contains a date and time that are mentioned together (for example, `Today at 5`, the same **datetime_link** value + is returned for both the `@sys-date` and `@sys-time` entities). + - parameter festival: A locale-specific holiday name (such as `thanksgiving` or `christmas`). This property is + included when a `@sys-date` entity is recognized based on a holiday name in the user input. + - parameter granularity: The precision or duration of a time range specified by a recognized `@sys-time` or + `@sys-date` entity. + - parameter rangeLink: A unique identifier used to associate multiple recognized `@sys-date`, `@sys-time`, or + `@sys-number` entities that are recognized as a range of values in the user's input (for example, `from July 4 + until July 14` or `from 20 to 25`). + - parameter rangeModifier: The word in the user input that indicates that a `sys-date` or `sys-time` entity is + part of an implied range where only one date or time is specified (for example, `since` or `until`). + - parameter relativeDay: A recognized mention of a relative day, represented numerically as an offset from the + current date (for example, `-1` for `yesterday` or `10` for `in ten days`). + - parameter relativeMonth: A recognized mention of a relative month, represented numerically as an offset from + the current month (for example, `1` for `next month` or `-3` for `three months ago`). + - parameter relativeWeek: A recognized mention of a relative week, represented numerically as an offset from the + current week (for example, `2` for `in two weeks` or `-1` for `last week). + - parameter relativeWeekend: A recognized mention of a relative date range for a weekend, represented + numerically as an offset from the current weekend (for example, `0` for `this weekend` or `-1` for `last + weekend`). + - parameter relativeYear: A recognized mention of a relative year, represented numerically as an offset from the + current year (for example, `1` for `next year` or `-5` for `five years ago`). + - parameter specificDay: A recognized mention of a specific date, represented numerically as the date within the + month (for example, `30` for `June 30`.). + - parameter specificDayOfWeek: A recognized mention of a specific day of the week as a lowercase string (for + example, `monday`). + - parameter specificMonth: A recognized mention of a specific month, represented numerically (for example, `7` + for `July`). + - parameter specificQuarter: A recognized mention of a specific quarter, represented numerically (for example, + `3` for `the third quarter`). + - parameter specificYear: A recognized mention of a specific year (for example, `2016`). + - parameter numericValue: A recognized numeric value, represented as an integer or double. + - parameter subtype: The type of numeric value recognized in the user input (`integer` or `rational`). + - parameter partOfDay: A recognized term for a time that was mentioned as a part of the day in the user's input + (for example, `morning` or `afternoon`). + - parameter relativeHour: A recognized mention of a relative hour, represented numerically as an offset from the + current hour (for example, `3` for `in three hours` or `-1` for `an hour ago`). + - parameter relativeMinute: A recognized mention of a relative time, represented numerically as an offset in + minutes from the current time (for example, `5` for `in five minutes` or `-15` for `fifteen minutes ago`). + - parameter relativeSecond: A recognized mention of a relative time, represented numerically as an offset in + seconds from the current time (for example, `10` for `in ten seconds` or `-30` for `thirty seconds ago`). + - parameter specificHour: A recognized specific hour mentioned as part of a time value (for example, `10` for + `10:15 AM`.). + - parameter specificMinute: A recognized specific minute mentioned as part of a time value (for example, `15` + for `10:15 AM`.). + - parameter specificSecond: A recognized specific second mentioned as part of a time value (for example, `30` + for `10:15:30 AM`.). + - parameter timezone: A recognized time zone mentioned as part of a time value (for example, `EST`). + + - returns: An initialized `RuntimeEntityInterpretation`. */ public init( calendarType: String? = nil, diff --git a/Source/AssistantV1/Models/RuntimeEntityRole.swift b/Source/AssistantV1/Models/RuntimeEntityRole.swift index f0081d436..ff30ca331 100644 --- a/Source/AssistantV1/Models/RuntimeEntityRole.swift +++ b/Source/AssistantV1/Models/RuntimeEntityRole.swift @@ -45,11 +45,11 @@ public struct RuntimeEntityRole: Codable, Equatable { } /** - Initialize a `RuntimeEntityRole` with member variables. + Initialize a `RuntimeEntityRole` with member variables. - - parameter type: The relationship of the entity to the range. + - parameter type: The relationship of the entity to the range. - - returns: An initialized `RuntimeEntityRole`. + - returns: An initialized `RuntimeEntityRole`. */ public init( type: String? = nil diff --git a/Source/AssistantV1/Models/RuntimeIntent.swift b/Source/AssistantV1/Models/RuntimeIntent.swift index 02ffa84f0..d3f045d64 100644 --- a/Source/AssistantV1/Models/RuntimeIntent.swift +++ b/Source/AssistantV1/Models/RuntimeIntent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct RuntimeIntent: Codable, Equatable { } /** - Initialize a `RuntimeIntent` with member variables. + Initialize a `RuntimeIntent` with member variables. - - parameter intent: The name of the recognized intent. - - parameter confidence: A decimal percentage that represents Watson's confidence in the intent. + - parameter intent: The name of the recognized intent. + - parameter confidence: A decimal percentage that represents Watson's confidence in the intent. - - returns: An initialized `RuntimeIntent`. + - returns: An initialized `RuntimeIntent`. */ public init( intent: String, diff --git a/Source/AssistantV1/Models/RuntimeResponseGeneric.swift b/Source/AssistantV1/Models/RuntimeResponseGeneric.swift index 069b9b91f..fdba9a1f7 100644 --- a/Source/AssistantV1/Models/RuntimeResponseGeneric.swift +++ b/Source/AssistantV1/Models/RuntimeResponseGeneric.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,6 @@ public struct RuntimeResponseGeneric: Codable, Equatable { /** 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 enum ResponseType: String { case text = "text" @@ -45,8 +43,6 @@ public struct RuntimeResponseGeneric: Codable, Equatable { /** 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 var responseType: String @@ -108,8 +104,6 @@ public struct RuntimeResponseGeneric: Codable, Equatable { /** 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 Plus and - Premium users. */ public var suggestions: [DialogSuggestion]? @@ -131,32 +125,28 @@ public struct RuntimeResponseGeneric: Codable, Equatable { } /** - Initialize a `RuntimeResponseGeneric` with member variables. - - - parameter 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. - - parameter text: The text of the response. - - parameter time: How long to pause, in milliseconds. - - parameter typing: Whether to send a "user is typing" event during the pause. - - parameter source: The URL of the image. - - parameter title: The title or introductory text to show before the response. - - parameter description: The description to show with the the response. - - parameter preference: The preferred type of control to display. - - parameter options: An array of objects describing the options from which the user can choose. - - parameter messageToHumanAgent: A message to be sent to the human agent who will be taking over the - conversation. - - parameter topic: A label identifying the topic of the conversation, derived from the **title** property of the - relevant node. - - parameter 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 **title** property. - - parameter 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 Plus - and Premium users. - - - returns: An initialized `RuntimeResponseGeneric`. + Initialize a `RuntimeResponseGeneric` with member variables. + + - parameter responseType: The type of response returned by the dialog node. The specified response type must be + supported by the client application or channel. + - parameter text: The text of the response. + - parameter time: How long to pause, in milliseconds. + - parameter typing: Whether to send a "user is typing" event during the pause. + - parameter source: The URL of the image. + - parameter title: The title or introductory text to show before the response. + - parameter description: The description to show with the the response. + - parameter preference: The preferred type of control to display. + - parameter options: An array of objects describing the options from which the user can choose. + - parameter messageToHumanAgent: A message to be sent to the human agent who will be taking over the + conversation. + - parameter topic: A label identifying the topic of the conversation, derived from the **title** property of the + relevant node. + - parameter 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 **title** property. + - parameter suggestions: An array of objects describing the possible matching dialog nodes from which the user + can choose. + + - returns: An initialized `RuntimeResponseGeneric`. */ public init( responseType: String, diff --git a/Source/AssistantV1/Models/Synonym.swift b/Source/AssistantV1/Models/Synonym.swift index 3099b967b..8011553bd 100644 --- a/Source/AssistantV1/Models/Synonym.swift +++ b/Source/AssistantV1/Models/Synonym.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,15 +44,15 @@ public struct Synonym: Codable, Equatable { } /** - Initialize a `Synonym` with member variables. + Initialize a `Synonym` with member variables. - - parameter synonym: The text of the synonym. This string must conform to the following restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter synonym: The text of the synonym. This string must conform to the following restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `Synonym`. + - returns: An initialized `Synonym`. */ public init( synonym: String, diff --git a/Source/AssistantV1/Models/SynonymCollection.swift b/Source/AssistantV1/Models/SynonymCollection.swift index 99ed460d1..bdbbb6109 100644 --- a/Source/AssistantV1/Models/SynonymCollection.swift +++ b/Source/AssistantV1/Models/SynonymCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/SystemResponse.swift b/Source/AssistantV1/Models/SystemResponse.swift index cbd80ff56..fce7021a1 100644 --- a/Source/AssistantV1/Models/SystemResponse.swift +++ b/Source/AssistantV1/Models/SystemResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ public struct SystemResponse: Codable, Equatable { public var additionalProperties: [String: JSON] /** - Initialize a `SystemResponse`. + Initialize a `SystemResponse`. - - returns: An initialized `SystemResponse`. + - returns: An initialized `SystemResponse`. */ public init( additionalProperties: [String: JSON] = [:] diff --git a/Source/AssistantV1/Models/UpdateCounterexample.swift b/Source/AssistantV1/Models/UpdateCounterexample.swift index f63f32abc..362975941 100644 --- a/Source/AssistantV1/Models/UpdateCounterexample.swift +++ b/Source/AssistantV1/Models/UpdateCounterexample.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,16 +44,16 @@ internal struct UpdateCounterexample: Codable, Equatable { } /** - Initialize a `UpdateCounterexample` with member variables. + Initialize a `UpdateCounterexample` with member variables. - - parameter text: The text of a user input marked as irrelevant input. This string must conform to the following - restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter text: The text of a user input marked as irrelevant input. This string must conform to the following + restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `UpdateCounterexample`. + - returns: An initialized `UpdateCounterexample`. */ public init( text: String? = nil, diff --git a/Source/AssistantV1/Models/UpdateDialogNode.swift b/Source/AssistantV1/Models/UpdateDialogNode.swift index 642ea241a..94553b0a1 100644 --- a/Source/AssistantV1/Models/UpdateDialogNode.swift +++ b/Source/AssistantV1/Models/UpdateDialogNode.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,41 +216,41 @@ internal struct UpdateDialogNode: Codable, Equatable { } /** - Initialize a `UpdateDialogNode` with member variables. - - - parameter dialogNode: The dialog node ID. This string must conform to the following restrictions: - - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. - - parameter description: The description of the dialog node. This string cannot contain carriage return, - newline, or tab characters. - - parameter conditions: The condition that will trigger the dialog node. This string cannot contain carriage - return, newline, or tab characters. - - parameter parent: The ID of the parent dialog node. This property is omitted if the dialog node has no parent. - - parameter previousSibling: The ID of the previous sibling dialog node. This property is omitted if the dialog - node has no previous sibling. - - parameter 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/assistant?topic=assistant-dialog-overview#dialog-overview-responses). - - parameter context: The context for the dialog node. - - parameter metadata: The metadata for the dialog node. - - parameter nextStep: The next step to execute following this dialog node. - - parameter title: The alias used to identify the dialog node. This string must conform to the following - restrictions: - - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. - - parameter type: How the dialog node is processed. - - parameter eventName: How an `event_handler` node is processed. - - parameter variable: The location in the dialog context where output is stored. - - parameter actions: An array of objects describing any actions to be invoked by the dialog node. - - parameter digressIn: Whether this top-level dialog node can be digressed into. - - parameter digressOut: Whether this dialog node can be returned to after a digression. - - parameter digressOutSlots: Whether the user can digress to top-level nodes while filling out slots. - - parameter userLabel: A label that can be displayed externally to describe the purpose of the node to users. - - parameter disambiguationOptOut: Whether the dialog node should be excluded from disambiguation suggestions. - Valid only when **type**=`standard` or `frame`. - - parameter disabled: For internal use only. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - - returns: An initialized `UpdateDialogNode`. + Initialize a `UpdateDialogNode` with member variables. + + - parameter dialogNode: The dialog node ID. This string must conform to the following restrictions: + - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. + - parameter description: The description of the dialog node. This string cannot contain carriage return, + newline, or tab characters. + - parameter conditions: The condition that will trigger the dialog node. This string cannot contain carriage + return, newline, or tab characters. + - parameter parent: The ID of the parent dialog node. This property is omitted if the dialog node has no parent. + - parameter previousSibling: The ID of the previous sibling dialog node. This property is omitted if the dialog + node has no previous sibling. + - parameter 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/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + - parameter context: The context for the dialog node. + - parameter metadata: The metadata for the dialog node. + - parameter nextStep: The next step to execute following this dialog node. + - parameter title: The alias used to identify the dialog node. This string must conform to the following + restrictions: + - It can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters. + - parameter type: How the dialog node is processed. + - parameter eventName: How an `event_handler` node is processed. + - parameter variable: The location in the dialog context where output is stored. + - parameter actions: An array of objects describing any actions to be invoked by the dialog node. + - parameter digressIn: Whether this top-level dialog node can be digressed into. + - parameter digressOut: Whether this dialog node can be returned to after a digression. + - parameter digressOutSlots: Whether the user can digress to top-level nodes while filling out slots. + - parameter userLabel: A label that can be displayed externally to describe the purpose of the node to users. + - parameter disambiguationOptOut: Whether the dialog node should be excluded from disambiguation suggestions. + Valid only when **type**=`standard` or `frame`. + - parameter disabled: For internal use only. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + + - returns: An initialized `UpdateDialogNode`. */ public init( dialogNode: String? = nil, diff --git a/Source/AssistantV1/Models/UpdateEntity.swift b/Source/AssistantV1/Models/UpdateEntity.swift index 4fc60b21e..666f56237 100644 --- a/Source/AssistantV1/Models/UpdateEntity.swift +++ b/Source/AssistantV1/Models/UpdateEntity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,20 +69,20 @@ internal struct UpdateEntity: Codable, Equatable { } /** - Initialize a `UpdateEntity` with member variables. + Initialize a `UpdateEntity` with member variables. - - parameter entity: The name of the entity. This string must conform to the following restrictions: - - It can contain only Unicode alphanumeric, underscore, and hyphen characters. - - It cannot begin with the reserved prefix `sys-`. - - parameter description: The description of the entity. This string cannot contain carriage return, newline, or - tab characters. - - parameter metadata: Any metadata related to the entity. - - parameter fuzzyMatch: Whether to use fuzzy matching for the entity. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - parameter values: An array of objects describing the entity values. + - parameter entity: The name of the entity. This string must conform to the following restrictions: + - It can contain only Unicode alphanumeric, underscore, and hyphen characters. + - It cannot begin with the reserved prefix `sys-`. + - parameter description: The description of the entity. This string cannot contain carriage return, newline, or + tab characters. + - parameter metadata: Any metadata related to the entity. + - parameter fuzzyMatch: Whether to use fuzzy matching for the entity. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + - parameter values: An array of objects describing the entity values. - - returns: An initialized `UpdateEntity`. + - returns: An initialized `UpdateEntity`. */ public init( entity: String? = nil, diff --git a/Source/AssistantV1/Models/UpdateExample.swift b/Source/AssistantV1/Models/UpdateExample.swift index 1d03ea1b7..744a41e1c 100644 --- a/Source/AssistantV1/Models/UpdateExample.swift +++ b/Source/AssistantV1/Models/UpdateExample.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,16 +50,16 @@ internal struct UpdateExample: Codable, Equatable { } /** - Initialize a `UpdateExample` with member variables. + Initialize a `UpdateExample` with member variables. - - parameter text: The text of the user input example. This string must conform to the following restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter mentions: An array of contextual entity mentions. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter text: The text of the user input example. This string must conform to the following restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter mentions: An array of contextual entity mentions. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `UpdateExample`. + - returns: An initialized `UpdateExample`. */ public init( text: String? = nil, diff --git a/Source/AssistantV1/Models/UpdateIntent.swift b/Source/AssistantV1/Models/UpdateIntent.swift index ee7c60f44..092c2028a 100644 --- a/Source/AssistantV1/Models/UpdateIntent.swift +++ b/Source/AssistantV1/Models/UpdateIntent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,18 +56,18 @@ internal struct UpdateIntent: Codable, Equatable { } /** - Initialize a `UpdateIntent` with member variables. + Initialize a `UpdateIntent` with member variables. - - parameter intent: The name of the intent. This string must conform to the following restrictions: - - It can contain only Unicode alphanumeric, underscore, hyphen, and dot characters. - - It cannot begin with the reserved prefix `sys-`. - - parameter description: The description of the intent. This string cannot contain carriage return, newline, or - tab characters. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - parameter examples: An array of user input examples for the intent. + - parameter intent: The name of the intent. This string must conform to the following restrictions: + - It can contain only Unicode alphanumeric, underscore, hyphen, and dot characters. + - It cannot begin with the reserved prefix `sys-`. + - parameter description: The description of the intent. This string cannot contain carriage return, newline, or + tab characters. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + - parameter examples: An array of user input examples for the intent. - - returns: An initialized `UpdateIntent`. + - returns: An initialized `UpdateIntent`. */ public init( intent: String? = nil, diff --git a/Source/AssistantV1/Models/UpdateSynonym.swift b/Source/AssistantV1/Models/UpdateSynonym.swift index e75248e95..2627acb1e 100644 --- a/Source/AssistantV1/Models/UpdateSynonym.swift +++ b/Source/AssistantV1/Models/UpdateSynonym.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,15 +44,15 @@ internal struct UpdateSynonym: Codable, Equatable { } /** - Initialize a `UpdateSynonym` with member variables. + Initialize a `UpdateSynonym` with member variables. - - parameter synonym: The text of the synonym. This string must conform to the following restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter synonym: The text of the synonym. This string must conform to the following restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `UpdateSynonym`. + - returns: An initialized `UpdateSynonym`. */ public init( synonym: String? = nil, diff --git a/Source/AssistantV1/Models/UpdateValue.swift b/Source/AssistantV1/Models/UpdateValue.swift index ad2f6a916..09048d293 100644 --- a/Source/AssistantV1/Models/UpdateValue.swift +++ b/Source/AssistantV1/Models/UpdateValue.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,25 +83,25 @@ internal struct UpdateValue: Codable, Equatable { } /** - Initialize a `UpdateValue` with member variables. + Initialize a `UpdateValue` with member variables. - - parameter value: The text of the entity value. This string must conform to the following restrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter metadata: Any metadata related to the entity value. - - parameter type: Specifies the type of entity value. - - parameter synonyms: An array of synonyms for the entity value. A value can specify either synonyms or patterns - (depending on the value type), but not both. A synonym must conform to the following resrictions: - - It cannot contain carriage return, newline, or tab characters. - - It cannot consist of only whitespace characters. - - parameter patterns: 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/assistant?topic=assistant-entities#entities-create-dictionary-based). - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. + - parameter value: The text of the entity value. This string must conform to the following restrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter metadata: Any metadata related to the entity value. + - parameter type: Specifies the type of entity value. + - parameter synonyms: An array of synonyms for the entity value. A value can specify either synonyms or patterns + (depending on the value type), but not both. A synonym must conform to the following resrictions: + - It cannot contain carriage return, newline, or tab characters. + - It cannot consist of only whitespace characters. + - parameter patterns: 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/assistant?topic=assistant-entities#entities-create-dictionary-based). + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. - - returns: An initialized `UpdateValue`. + - returns: An initialized `UpdateValue`. */ public init( value: String? = nil, diff --git a/Source/AssistantV1/Models/UpdateWorkspace.swift b/Source/AssistantV1/Models/UpdateWorkspace.swift index d888b363b..d5ce18353 100644 --- a/Source/AssistantV1/Models/UpdateWorkspace.swift +++ b/Source/AssistantV1/Models/UpdateWorkspace.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,30 +124,30 @@ internal struct UpdateWorkspace: Codable, Equatable { } /** - Initialize a `UpdateWorkspace` with member variables. - - - parameter name: The name of the workspace. This string cannot contain carriage return, newline, or tab - characters. - - parameter description: The description of the workspace. This string cannot contain carriage return, newline, - or tab characters. - - parameter language: The language of the workspace. - - parameter metadata: Any metadata related to the workspace. - - parameter learningOptOut: Whether training data from the workspace (including artifacts such as intents and - entities) can be used by IBM for general service improvements. `true` indicates that workspace training data is - not to be used. - - parameter systemSettings: Global settings for the workspace. - - parameter workspaceID: The workspace ID of the workspace. - - parameter status: The current status of the workspace. - - parameter created: The timestamp for creation of the object. - - parameter updated: The timestamp for the most recent update to the object. - - parameter intents: An array of objects defining the intents for the workspace. - - parameter entities: An array of objects describing the entities for the workspace. - - parameter dialogNodes: An array of objects describing the dialog nodes in the workspace. - - parameter counterexamples: An array of objects defining input examples that have been marked as irrelevant - input. - - parameter webhooks: - - - returns: An initialized `UpdateWorkspace`. + Initialize a `UpdateWorkspace` with member variables. + + - parameter name: The name of the workspace. This string cannot contain carriage return, newline, or tab + characters. + - parameter description: The description of the workspace. This string cannot contain carriage return, newline, + or tab characters. + - parameter language: The language of the workspace. + - parameter metadata: Any metadata related to the workspace. + - parameter learningOptOut: Whether training data from the workspace (including artifacts such as intents and + entities) can be used by IBM for general service improvements. `true` indicates that workspace training data is + not to be used. + - parameter systemSettings: Global settings for the workspace. + - parameter workspaceID: The workspace ID of the workspace. + - parameter status: The current status of the workspace. + - parameter created: The timestamp for creation of the object. + - parameter updated: The timestamp for the most recent update to the object. + - parameter intents: An array of objects defining the intents for the workspace. + - parameter entities: An array of objects describing the entities for the workspace. + - parameter dialogNodes: An array of objects describing the dialog nodes in the workspace. + - parameter counterexamples: An array of objects defining input examples that have been marked as irrelevant + input. + - parameter webhooks: + + - returns: An initialized `UpdateWorkspace`. */ public init( name: String? = nil, diff --git a/Source/AssistantV1/Models/Value.swift b/Source/AssistantV1/Models/Value.swift index 7a21a0f7b..ba309f385 100644 --- a/Source/AssistantV1/Models/Value.swift +++ b/Source/AssistantV1/Models/Value.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/ValueCollection.swift b/Source/AssistantV1/Models/ValueCollection.swift index b97ec081f..59acdba59 100644 --- a/Source/AssistantV1/Models/ValueCollection.swift +++ b/Source/AssistantV1/Models/ValueCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/Webhook.swift b/Source/AssistantV1/Models/Webhook.swift index 1b4d27518..805e4574d 100644 --- a/Source/AssistantV1/Models/Webhook.swift +++ b/Source/AssistantV1/Models/Webhook.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,13 +45,13 @@ public struct Webhook: Codable, Equatable { } /** - Initialize a `Webhook` with member variables. + Initialize a `Webhook` with member variables. - - parameter url: The URL for the external service or application to which you want to send HTTP POST requests. - - parameter name: The name of the webhook. Currently, `main_webhook` is the only supported value. - - parameter headers: An optional array of HTTP headers to pass with the HTTP request. + - parameter url: The URL for the external service or application to which you want to send HTTP POST requests. + - parameter name: The name of the webhook. Currently, `main_webhook` is the only supported value. + - parameter headers: An optional array of HTTP headers to pass with the HTTP request. - - returns: An initialized `Webhook`. + - returns: An initialized `Webhook`. */ public init( url: String, diff --git a/Source/AssistantV1/Models/WebhookHeader.swift b/Source/AssistantV1/Models/WebhookHeader.swift index b13d70dfc..2a5546ecb 100644 --- a/Source/AssistantV1/Models/WebhookHeader.swift +++ b/Source/AssistantV1/Models/WebhookHeader.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct WebhookHeader: Codable, Equatable { } /** - Initialize a `WebhookHeader` with member variables. + Initialize a `WebhookHeader` with member variables. - - parameter name: The name of an HTTP header (for example, `Authorization`). - - parameter value: The value of an HTTP header. + - parameter name: The name of an HTTP header (for example, `Authorization`). + - parameter value: The value of an HTTP header. - - returns: An initialized `WebhookHeader`. + - returns: An initialized `WebhookHeader`. */ public init( name: String, diff --git a/Source/AssistantV1/Models/Workspace.swift b/Source/AssistantV1/Models/Workspace.swift index 5c18add1d..639930c8e 100644 --- a/Source/AssistantV1/Models/Workspace.swift +++ b/Source/AssistantV1/Models/Workspace.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/WorkspaceCollection.swift b/Source/AssistantV1/Models/WorkspaceCollection.swift index d6b95b7a3..505863a8c 100644 --- a/Source/AssistantV1/Models/WorkspaceCollection.swift +++ b/Source/AssistantV1/Models/WorkspaceCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV1/Models/WorkspaceSystemSettings.swift b/Source/AssistantV1/Models/WorkspaceSystemSettings.swift index 962b7287f..0e80d0fb9 100644 --- a/Source/AssistantV1/Models/WorkspaceSystemSettings.swift +++ b/Source/AssistantV1/Models/WorkspaceSystemSettings.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ public struct WorkspaceSystemSettings: Codable, Equatable { /** Workspace settings related to the disambiguation feature. - **Note:** This feature is available only to Plus and Premium users. */ public var disambiguation: WorkspaceSystemSettingsDisambiguation? @@ -73,21 +72,20 @@ public struct WorkspaceSystemSettings: Codable, Equatable { } /** - Initialize a `WorkspaceSystemSettings` with member variables. + Initialize a `WorkspaceSystemSettings` with member variables. - - parameter tooling: Workspace settings related to the Watson Assistant user interface. - - parameter disambiguation: Workspace settings related to the disambiguation feature. - **Note:** This feature is available only to Plus and Premium users. - - parameter humanAgentAssist: For internal use only. - - parameter spellingSuggestions: Whether spelling correction is enabled for the workspace. - - parameter spellingAutoCorrect: Whether autocorrection is enabled for the workspace. If spelling correction is - enabled and this property is `false`, any suggested corrections are returned in the **suggested_text** property - of the message response. If this property is `true`, any corrections are automatically applied to the user input, - and the original text is returned in the **original_text** property of the message response. - - parameter systemEntities: Workspace settings related to the behavior of system entities. - - parameter offTopic: Workspace settings related to detection of irrelevant input. + - parameter tooling: Workspace settings related to the Watson Assistant user interface. + - parameter disambiguation: Workspace settings related to the disambiguation feature. + - parameter humanAgentAssist: For internal use only. + - parameter spellingSuggestions: Whether spelling correction is enabled for the workspace. + - parameter spellingAutoCorrect: Whether autocorrection is enabled for the workspace. If spelling correction is + enabled and this property is `false`, any suggested corrections are returned in the **suggested_text** property + of the message response. If this property is `true`, any corrections are automatically applied to the user input, + and the original text is returned in the **original_text** property of the message response. + - parameter systemEntities: Workspace settings related to the behavior of system entities. + - parameter offTopic: Workspace settings related to detection of irrelevant input. - - returns: An initialized `WorkspaceSystemSettings`. + - returns: An initialized `WorkspaceSystemSettings`. */ public init( tooling: WorkspaceSystemSettingsTooling? = nil, diff --git a/Source/AssistantV1/Models/WorkspaceSystemSettingsDisambiguation.swift b/Source/AssistantV1/Models/WorkspaceSystemSettingsDisambiguation.swift index 7cd78c049..a91982760 100644 --- a/Source/AssistantV1/Models/WorkspaceSystemSettingsDisambiguation.swift +++ b/Source/AssistantV1/Models/WorkspaceSystemSettingsDisambiguation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import Foundation /** Workspace settings related to the disambiguation feature. - **Note:** This feature is available only to Plus and Premium users. */ public struct WorkspaceSystemSettingsDisambiguation: Codable, Equatable { @@ -81,23 +80,23 @@ public struct WorkspaceSystemSettingsDisambiguation: Codable, Equatable { } /** - Initialize a `WorkspaceSystemSettingsDisambiguation` with member variables. + Initialize a `WorkspaceSystemSettingsDisambiguation` with member variables. - - parameter prompt: The text of the introductory prompt that accompanies disambiguation options presented to the - user. - - parameter noneOfTheAbovePrompt: The user-facing label for the option users can select if none of the suggested - options is correct. If no value is specified for this property, this option does not appear. - - parameter enabled: Whether the disambiguation feature is enabled for the workspace. - - parameter sensitivity: The sensitivity of the disambiguation feature to intent detection conflicts. Set to - **high** if you want the disambiguation feature to be triggered more often. This can be useful for testing or - demonstration purposes. - - parameter randomize: Whether the order in which disambiguation suggestions are presented should be randomized - (but still influenced by relative confidence). - - parameter maxSuggestions: The maximum number of disambigation suggestions that can be included in a - `suggestion` response. - - parameter suggestionTextPolicy: For internal use only. + - parameter prompt: The text of the introductory prompt that accompanies disambiguation options presented to the + user. + - parameter noneOfTheAbovePrompt: The user-facing label for the option users can select if none of the suggested + options is correct. If no value is specified for this property, this option does not appear. + - parameter enabled: Whether the disambiguation feature is enabled for the workspace. + - parameter sensitivity: The sensitivity of the disambiguation feature to intent detection conflicts. Set to + **high** if you want the disambiguation feature to be triggered more often. This can be useful for testing or + demonstration purposes. + - parameter randomize: Whether the order in which disambiguation suggestions are presented should be randomized + (but still influenced by relative confidence). + - parameter maxSuggestions: The maximum number of disambigation suggestions that can be included in a + `suggestion` response. + - parameter suggestionTextPolicy: For internal use only. - - returns: An initialized `WorkspaceSystemSettingsDisambiguation`. + - returns: An initialized `WorkspaceSystemSettingsDisambiguation`. */ public init( prompt: String? = nil, diff --git a/Source/AssistantV1/Models/WorkspaceSystemSettingsOffTopic.swift b/Source/AssistantV1/Models/WorkspaceSystemSettingsOffTopic.swift index 47ba5ec97..1a0ebdf60 100644 --- a/Source/AssistantV1/Models/WorkspaceSystemSettingsOffTopic.swift +++ b/Source/AssistantV1/Models/WorkspaceSystemSettingsOffTopic.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct WorkspaceSystemSettingsOffTopic: Codable, Equatable { } /** - Initialize a `WorkspaceSystemSettingsOffTopic` with member variables. + Initialize a `WorkspaceSystemSettingsOffTopic` with member variables. - - parameter enabled: Whether enhanced irrelevance detection is enabled for the workspace. + - parameter enabled: Whether enhanced irrelevance detection is enabled for the workspace. - - returns: An initialized `WorkspaceSystemSettingsOffTopic`. + - returns: An initialized `WorkspaceSystemSettingsOffTopic`. */ public init( enabled: Bool? = nil diff --git a/Source/AssistantV1/Models/WorkspaceSystemSettingsSystemEntities.swift b/Source/AssistantV1/Models/WorkspaceSystemSettingsSystemEntities.swift index cc2ae690d..0612c567f 100644 --- a/Source/AssistantV1/Models/WorkspaceSystemSettingsSystemEntities.swift +++ b/Source/AssistantV1/Models/WorkspaceSystemSettingsSystemEntities.swift @@ -32,11 +32,11 @@ public struct WorkspaceSystemSettingsSystemEntities: Codable, Equatable { } /** - Initialize a `WorkspaceSystemSettingsSystemEntities` with member variables. + Initialize a `WorkspaceSystemSettingsSystemEntities` with member variables. - - parameter enabled: Whether the new system entities are enabled for the workspace. + - parameter enabled: Whether the new system entities are enabled for the workspace. - - returns: An initialized `WorkspaceSystemSettingsSystemEntities`. + - returns: An initialized `WorkspaceSystemSettingsSystemEntities`. */ public init( enabled: Bool? = nil diff --git a/Source/AssistantV1/Models/WorkspaceSystemSettingsTooling.swift b/Source/AssistantV1/Models/WorkspaceSystemSettingsTooling.swift index b42ecb128..fe04b90eb 100644 --- a/Source/AssistantV1/Models/WorkspaceSystemSettingsTooling.swift +++ b/Source/AssistantV1/Models/WorkspaceSystemSettingsTooling.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,12 +32,12 @@ public struct WorkspaceSystemSettingsTooling: Codable, Equatable { } /** - Initialize a `WorkspaceSystemSettingsTooling` with member variables. + Initialize a `WorkspaceSystemSettingsTooling` with member variables. - - parameter storeGenericResponses: Whether the dialog JSON editor displays text responses within the - `output.generic` object. + - parameter storeGenericResponses: Whether the dialog JSON editor displays text responses within the + `output.generic` object. - - returns: An initialized `WorkspaceSystemSettingsTooling`. + - returns: An initialized `WorkspaceSystemSettingsTooling`. */ public init( storeGenericResponses: Bool? = nil diff --git a/Source/AssistantV2/Assistant.swift b/Source/AssistantV2/Assistant.swift index 120a1f778..b1aeee362 100644 --- a/Source/AssistantV2/Assistant.swift +++ b/Source/AssistantV2/Assistant.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import IBMSwiftSDKCore public class Assistant { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/assistant/api" + public var serviceURL: String? = "https://api.us-south.assistant.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "Conversation" @@ -55,10 +55,11 @@ public class Assistant { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -84,8 +85,8 @@ public class Assistant { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -155,7 +156,6 @@ public class Assistant { let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "createSession") headerParameters.merge(sdkHeaders) { (_, new) in new } headerParameters["Accept"] = "application/json" - headerParameters["Content-Type"] = "application/json" // construct query parameters var queryParameters = [URLQueryItem]() @@ -253,7 +253,6 @@ public class Assistant { Send user input to an assistant and receive a response, with conversation state (including context data) stored by Watson Assistant for the duration of the session. - There is no rate limit for this operation. - parameter assistantID: Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the assistant settings and click **API Details**. For information about creating assistants, @@ -332,7 +331,6 @@ public class Assistant { Send user input to an assistant and receive a response, with conversation state (including context data) managed by your application. - There is no rate limit for this operation. - parameter assistantID: Unique identifier of the assistant. To find the assistant ID in the Watson Assistant user interface, open the assistant settings and click **API Details**. For information about creating assistants, @@ -404,4 +402,144 @@ public class Assistant { request.responseObject(completionHandler: completionHandler) } + /** + List log events for an assistant. + + List the events from the log of an assistant. + This method is available only with Premium plans. + + - parameter assistantID: Unique identifier of the assistant. To find the assistant ID in the Watson Assistant + user interface, open the assistant settings and click **API Details**. For information about creating assistants, + see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task). + **Note:** Currently, the v2 API does not support creating assistants. + - parameter sort: How to sort the returned log events. You can sort by **request_timestamp**. To reverse the sort + order, prefix the parameter value with a minus sign (`-`). + - parameter filter: A cacheable parameter that limits the results to those matching the specified filter. For + more information, see the + [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-filter-reference#filter-reference). + - parameter pageLimit: The number of records to return in each page of results. + - parameter cursor: A token identifying the page of results to retrieve. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func listLogs( + assistantID: String, + sort: String? = nil, + filter: String? = nil, + pageLimit: Int? = nil, + cursor: String? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "listLogs") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + if let sort = sort { + let queryParameter = URLQueryItem(name: "sort", value: sort) + queryParameters.append(queryParameter) + } + if let filter = filter { + let queryParameter = URLQueryItem(name: "filter", value: filter) + queryParameters.append(queryParameter) + } + if let pageLimit = pageLimit { + let queryParameter = URLQueryItem(name: "page_limit", value: "\(pageLimit)") + queryParameters.append(queryParameter) + } + if let cursor = cursor { + let queryParameter = URLQueryItem(name: "cursor", value: cursor) + queryParameters.append(queryParameter) + } + + // construct REST request + let path = "/v2/assistants/\(assistantID)/logs" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Delete labeled data. + + Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with + the customer ID. + You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes data. + For more information about personal data and customer IDs, see [Information + security](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security). + This operation is limited to 4 requests per minute. For more information, see **Rate limiting**. + + - parameter customerID: The customer ID for which all data is to be deleted. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func deleteUserData( + customerID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "deleteUserData") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + queryParameters.append(URLQueryItem(name: "customer_id", value: customerID)) + + // construct REST request + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "DELETE", + url: serviceEndpoint + "/v2/user_data", + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.response(completionHandler: completionHandler) + } + } diff --git a/Source/AssistantV2/Models/CaptureGroup.swift b/Source/AssistantV2/Models/CaptureGroup.swift index f3fb17746..4c1de62da 100644 --- a/Source/AssistantV2/Models/CaptureGroup.swift +++ b/Source/AssistantV2/Models/CaptureGroup.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,13 +36,13 @@ public struct CaptureGroup: Codable, Equatable { } /** - Initialize a `CaptureGroup` with member variables. + Initialize a `CaptureGroup` with member variables. - - parameter group: A recognized capture group for the entity. - - parameter location: Zero-based character offsets that indicate where the entity value begins and ends in the - input text. + - parameter group: A recognized capture group for the entity. + - parameter location: Zero-based character offsets that indicate where the entity value begins and ends in the + input text. - - returns: An initialized `CaptureGroup`. + - returns: An initialized `CaptureGroup`. */ public init( group: String, diff --git a/Source/AssistantV2/Models/DialogLogMessage.swift b/Source/AssistantV2/Models/DialogLogMessage.swift index 1b9ccb0d1..14a1a8c0a 100644 --- a/Source/AssistantV2/Models/DialogLogMessage.swift +++ b/Source/AssistantV2/Models/DialogLogMessage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/DialogNodeAction.swift b/Source/AssistantV2/Models/DialogNodeAction.swift index 910f1ed25..e48251cd4 100644 --- a/Source/AssistantV2/Models/DialogNodeAction.swift +++ b/Source/AssistantV2/Models/DialogNodeAction.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/DialogNodeOutputOptionsElement.swift b/Source/AssistantV2/Models/DialogNodeOutputOptionsElement.swift index cbf4426ac..3ec6443b6 100644 --- a/Source/AssistantV2/Models/DialogNodeOutputOptionsElement.swift +++ b/Source/AssistantV2/Models/DialogNodeOutputOptionsElement.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/DialogNodeOutputOptionsElementValue.swift b/Source/AssistantV2/Models/DialogNodeOutputOptionsElementValue.swift index bfa46af64..fe4042d4e 100644 --- a/Source/AssistantV2/Models/DialogNodeOutputOptionsElementValue.swift +++ b/Source/AssistantV2/Models/DialogNodeOutputOptionsElementValue.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/DialogNodesVisited.swift b/Source/AssistantV2/Models/DialogNodesVisited.swift index f99312a5e..1a2c3ac8e 100644 --- a/Source/AssistantV2/Models/DialogNodesVisited.swift +++ b/Source/AssistantV2/Models/DialogNodesVisited.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/DialogSuggestion.swift b/Source/AssistantV2/Models/DialogSuggestion.swift index ca858bd8b..e402e5cf5 100644 --- a/Source/AssistantV2/Models/DialogSuggestion.swift +++ b/Source/AssistantV2/Models/DialogSuggestion.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ import IBMSwiftSDKCore public struct DialogSuggestion: Codable, Equatable { /** - The user-facing label for the disambiguation option. This label is taken from the **title** or **user_label** - property of the corresponding dialog node, depending on the disambiguation options. + The user-facing label for the suggestion. This label is taken from the **title** or **user_label** property of the + corresponding dialog node, depending on the disambiguation options. */ public var label: String diff --git a/Source/AssistantV2/Models/DialogSuggestionValue.swift b/Source/AssistantV2/Models/DialogSuggestionValue.swift index fd202103c..f9049a3b8 100644 --- a/Source/AssistantV2/Models/DialogSuggestionValue.swift +++ b/Source/AssistantV2/Models/DialogSuggestionValue.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/Log.swift b/Source/AssistantV2/Models/Log.swift new file mode 100644 index 000000000..3c86ce42b --- /dev/null +++ b/Source/AssistantV2/Models/Log.swift @@ -0,0 +1,92 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** Log. */ +public struct Log: Codable, Equatable { + + /** + A unique identifier for the logged event. + */ + public var logID: String + + /** + A stateful message request formatted for the Watson Assistant service. + */ + public var request: MessageRequest + + /** + A response from the Watson Assistant service. + */ + public var response: MessageResponse + + /** + Unique identifier of the assistant. + */ + public var assistantID: String + + /** + The ID of the session the message was part of. + */ + public var sessionID: String + + /** + The unique identifier of the skill that responded to the message. + */ + public var skillID: String + + /** + The name of the snapshot (dialog skill version) that responded to the message (for example, `draft`). + */ + public var snapshot: String + + /** + The timestamp for receipt of the message. + */ + public var requestTimestamp: String + + /** + The timestamp for the system response to the message. + */ + public var responseTimestamp: String + + /** + The language of the assistant to which the message request was made. + */ + public var language: String + + /** + The customer ID specified for the message, if any. + */ + public var customerID: String? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case logID = "log_id" + case request = "request" + case response = "response" + case assistantID = "assistant_id" + case sessionID = "session_id" + case skillID = "skill_id" + case snapshot = "snapshot" + case requestTimestamp = "request_timestamp" + case responseTimestamp = "response_timestamp" + case language = "language" + case customerID = "customer_id" + } + +} diff --git a/Source/AssistantV2/Models/LogCollection.swift b/Source/AssistantV2/Models/LogCollection.swift new file mode 100644 index 000000000..fc8a46ec4 --- /dev/null +++ b/Source/AssistantV2/Models/LogCollection.swift @@ -0,0 +1,38 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** LogCollection. */ +public struct LogCollection: Codable, Equatable { + + /** + An array of objects describing log events. + */ + public var logs: [Log] + + /** + The pagination data for the returned objects. + */ + public var pagination: LogPagination + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case logs = "logs" + case pagination = "pagination" + } + +} diff --git a/Source/AssistantV2/Models/LogPagination.swift b/Source/AssistantV2/Models/LogPagination.swift new file mode 100644 index 000000000..164302b22 --- /dev/null +++ b/Source/AssistantV2/Models/LogPagination.swift @@ -0,0 +1,46 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + The pagination data for the returned objects. + */ +public struct LogPagination: Codable, Equatable { + + /** + The URL that will return the next page of results, if any. + */ + public var nextURL: String? + + /** + Reserved for future use. + */ + public var matched: Int? + + /** + A token identifying the next page of results. + */ + public var nextCursor: String? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case nextURL = "next_url" + case matched = "matched" + case nextCursor = "next_cursor" + } + +} diff --git a/Source/AssistantV2/Models/MessageContext.swift b/Source/AssistantV2/Models/MessageContext.swift index f592c4fcc..cb251752e 100644 --- a/Source/AssistantV2/Models/MessageContext.swift +++ b/Source/AssistantV2/Models/MessageContext.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,14 @@ public struct MessageContext: Codable, Equatable { } /** - Initialize a `MessageContext` with member variables. + Initialize a `MessageContext` with member variables. - - parameter global: Session context data that is shared by all skills used by the Assistant. - - parameter skills: Information specific to particular skills used by the assistant. - **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog - skill used by the assistant. + - parameter global: Session context data that is shared by all skills used by the Assistant. + - parameter skills: Information specific to particular skills used by the assistant. + **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog + skill used by the assistant. - - returns: An initialized `MessageContext`. + - returns: An initialized `MessageContext`. */ public init( global: MessageContextGlobal? = nil, diff --git a/Source/AssistantV2/Models/MessageContextGlobal.swift b/Source/AssistantV2/Models/MessageContextGlobal.swift index d5fe41c40..8022221c1 100644 --- a/Source/AssistantV2/Models/MessageContextGlobal.swift +++ b/Source/AssistantV2/Models/MessageContextGlobal.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct MessageContextGlobal: Codable, Equatable { } /** - Initialize a `MessageContextGlobal` with member variables. + Initialize a `MessageContextGlobal` with member variables. - - parameter system: Built-in system properties that apply to all skills used by the assistant. - - parameter sessionID: The session ID. + - parameter system: Built-in system properties that apply to all skills used by the assistant. + - parameter sessionID: The session ID. - - returns: An initialized `MessageContextGlobal`. + - returns: An initialized `MessageContextGlobal`. */ public init( system: MessageContextGlobalSystem? = nil, diff --git a/Source/AssistantV2/Models/MessageContextGlobalStateless.swift b/Source/AssistantV2/Models/MessageContextGlobalStateless.swift index 82ca3084d..613bdc9b9 100644 --- a/Source/AssistantV2/Models/MessageContextGlobalStateless.swift +++ b/Source/AssistantV2/Models/MessageContextGlobalStateless.swift @@ -38,12 +38,12 @@ public struct MessageContextGlobalStateless: Codable, Equatable { } /** - Initialize a `MessageContextGlobalStateless` with member variables. + Initialize a `MessageContextGlobalStateless` with member variables. - - parameter system: Built-in system properties that apply to all skills used by the assistant. - - parameter sessionID: The unique identifier of the session. + - parameter system: Built-in system properties that apply to all skills used by the assistant. + - parameter sessionID: The unique identifier of the session. - - returns: An initialized `MessageContextGlobalStateless`. + - returns: An initialized `MessageContextGlobalStateless`. */ public init( system: MessageContextGlobalSystem? = nil, diff --git a/Source/AssistantV2/Models/MessageContextGlobalSystem.swift b/Source/AssistantV2/Models/MessageContextGlobalSystem.swift index 9b5467668..e4249d02b 100644 --- a/Source/AssistantV2/Models/MessageContextGlobalSystem.swift +++ b/Source/AssistantV2/Models/MessageContextGlobalSystem.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,30 +94,30 @@ public struct MessageContextGlobalSystem: Codable, Equatable { } /** - Initialize a `MessageContextGlobalSystem` with member variables. + Initialize a `MessageContextGlobalSystem` with member variables. - - parameter timezone: The user time zone. The assistant uses the time zone to correctly resolve relative time - references. - - parameter userID: A string value that identifies the user who is interacting with the assistant. The client - must provide a unique identifier for each individual end user who accesses the application. For Plus and Premium - plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage - return, newline, or tab characters. - - parameter turnCount: A counter that is automatically incremented with each turn of the conversation. A value - of 1 indicates that this is the the first turn of a new conversation, which can affect the behavior of some - skills (for example, triggering the start node of a dialog). - - parameter locale: The language code for localization in the user input. The specified locale overrides the - default for the assistant, and is used for interpreting entity values in user input such as date values. For - example, `04/03/2018` might be interpreted either as April 3 or March 4, depending on the locale. + - parameter timezone: The user time zone. The assistant uses the time zone to correctly resolve relative time + references. + - parameter userID: A string value that identifies the user who is interacting with the assistant. The client + must provide a unique identifier for each individual end user who accesses the application. For Plus and Premium + plans, this user ID is used to identify unique users for billing purposes. This string cannot contain carriage + return, newline, or tab characters. + - parameter turnCount: A counter that is automatically incremented with each turn of the conversation. A value + of 1 indicates that this is the the first turn of a new conversation, which can affect the behavior of some + skills (for example, triggering the start node of a dialog). + - parameter locale: The language code for localization in the user input. The specified locale overrides the + default for the assistant, and is used for interpreting entity values in user input such as date values. For + example, `04/03/2018` might be interpreted either as April 3 or March 4, depending on the locale. + This property is included only if the new system entities are enabled for the skill. + - parameter referenceTime: The base time for interpreting any relative time mentions in the user input. The + specified time overrides the current server time, and is used to calculate times mentioned in relative terms such + as `now` or `tomorrow`. This can be useful for simulating past or future times for testing purposes, or when + analyzing documents such as news articles. + This value must be a UTC time value formatted according to ISO 8601 (for example, `2019-06-26T12:00:00Z` for noon + on 26 June 2019. This property is included only if the new system entities are enabled for the skill. - - parameter referenceTime: The base time for interpreting any relative time mentions in the user input. The - specified time overrides the current server time, and is used to calculate times mentioned in relative terms such - as `now` or `tomorrow`. This can be useful for simulating past or future times for testing purposes, or when - analyzing documents such as news articles. - This value must be a UTC time value formatted according to ISO 8601 (for example, `2019-06-26T12:00:00Z` for noon - on 26 June 2019. - This property is included only if the new system entities are enabled for the skill. - - returns: An initialized `MessageContextGlobalSystem`. + - returns: An initialized `MessageContextGlobalSystem`. */ public init( timezone: String? = nil, diff --git a/Source/AssistantV2/Models/MessageContextSkill.swift b/Source/AssistantV2/Models/MessageContextSkill.swift index d1fcb75c5..3cd04cdb2 100644 --- a/Source/AssistantV2/Models/MessageContextSkill.swift +++ b/Source/AssistantV2/Models/MessageContextSkill.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ public struct MessageContextSkill: Codable, Equatable { /** System context data used by the skill. */ - public var system: [String: JSON]? + public var system: MessageContextSkillSystem? // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { @@ -40,16 +40,16 @@ public struct MessageContextSkill: Codable, Equatable { } /** - Initialize a `MessageContextSkill` with member variables. + Initialize a `MessageContextSkill` with member variables. - - parameter userDefined: Arbitrary variables that can be read and written by a particular skill. - - parameter system: System context data used by the skill. + - parameter userDefined: Arbitrary variables that can be read and written by a particular skill. + - parameter system: System context data used by the skill. - - returns: An initialized `MessageContextSkill`. + - returns: An initialized `MessageContextSkill`. */ public init( userDefined: [String: JSON]? = nil, - system: [String: JSON]? = nil + system: MessageContextSkillSystem? = nil ) { self.userDefined = userDefined diff --git a/Source/AssistantV2/Models/MessageContextSkillSystem.swift b/Source/AssistantV2/Models/MessageContextSkillSystem.swift index d6fd8201e..ebe0f24d4 100644 --- a/Source/AssistantV2/Models/MessageContextSkillSystem.swift +++ b/Source/AssistantV2/Models/MessageContextSkillSystem.swift @@ -40,14 +40,14 @@ public struct MessageContextSkillSystem: Codable, Equatable { } /** - Initialize a `MessageContextSkillSystem` with member variables. + Initialize a `MessageContextSkillSystem` with member variables. - - parameter state: An encoded string representing the current conversation state. By saving this value and then - sending it in the context of a subsequent message request, you can restore the conversation to the same state. - This can be useful if you need to return to an earlier point in the conversation. If you are using stateful - sessions, you can also use a stored state value to restore a paused conversation whose session has expired. + - parameter state: An encoded string representing the current conversation state. By saving this value and then + sending it in the context of a subsequent message request, you can restore the conversation to the same state. + This can be useful if you need to return to an earlier point in the conversation. If you are using stateful + sessions, you can also use a stored state value to restore a paused conversation whose session has expired. - - returns: An initialized `MessageContextSkillSystem`. + - returns: An initialized `MessageContextSkillSystem`. */ public init( state: String? = nil, diff --git a/Source/AssistantV2/Models/MessageContextSkills.swift b/Source/AssistantV2/Models/MessageContextSkills.swift index fb71fd309..1ddfdd1c6 100644 --- a/Source/AssistantV2/Models/MessageContextSkills.swift +++ b/Source/AssistantV2/Models/MessageContextSkills.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,9 +28,9 @@ public struct MessageContextSkills: Codable, Equatable { public var additionalProperties: [String: MessageContextSkill] /** - Initialize a `MessageContextSkills`. + Initialize a `MessageContextSkills`. - - returns: An initialized `MessageContextSkills`. + - returns: An initialized `MessageContextSkills`. */ public init( additionalProperties: [String: MessageContextSkill] = [:] @@ -50,39 +50,3 @@ public struct MessageContextSkills: Codable, Equatable { } } - -public extension KeyedDecodingContainer where Key == DynamicKeys { - - /// Decode additional properties. - func decode(_ type: [String: MessageContextSkill].Type, excluding keys: [CodingKey]) throws -> [String: MessageContextSkill] { - var retval: [String: MessageContextSkill] = [:] - try self.allKeys.forEach { key in - if !keys.contains{ $0.stringValue == key.stringValue} { - let value = try self.decode(MessageContextSkill.self, forKey: key) - retval[key.stringValue] = value - } - } - return retval - } -} - -public extension KeyedEncodingContainer where Key == DynamicKeys { - - /// Encode additional properties. - mutating func encode(_ additionalProperties: [String: MessageContextSkill]) throws { - try additionalProperties.forEach { key, value in - guard let codingKey = DynamicKeys(stringValue: key) else { - let description = "Cannot construct CodingKey for \(key)" - let context = EncodingError.Context(codingPath: codingPath, debugDescription: description) - throw EncodingError.invalidValue(key, context) - } - try self.encode(value, forKey: codingKey) - } - } - - /// Encode additional properties if they are not nil. - mutating func encodeIfPresent(_ additionalProperties: [String: MessageContextSkill]?) throws { - guard let additionalProperties = additionalProperties else { return } - try encode(additionalProperties) - } -} diff --git a/Source/AssistantV2/Models/MessageContextStateless.swift b/Source/AssistantV2/Models/MessageContextStateless.swift index bf7a458c0..def19cbf2 100644 --- a/Source/AssistantV2/Models/MessageContextStateless.swift +++ b/Source/AssistantV2/Models/MessageContextStateless.swift @@ -38,14 +38,14 @@ public struct MessageContextStateless: Codable, Equatable { } /** - Initialize a `MessageContextStateless` with member variables. + Initialize a `MessageContextStateless` with member variables. - - parameter global: Session context data that is shared by all skills used by the Assistant. - - parameter skills: Information specific to particular skills used by the assistant. - **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog - skill used by the assistant. + - parameter global: Session context data that is shared by all skills used by the Assistant. + - parameter skills: Information specific to particular skills used by the assistant. + **Note:** Currently, only a single child property is supported, containing variables that apply to the dialog + skill used by the assistant. - - returns: An initialized `MessageContextStateless`. + - returns: An initialized `MessageContextStateless`. */ public init( global: MessageContextGlobalStateless? = nil, diff --git a/Source/AssistantV2/Models/MessageInput.swift b/Source/AssistantV2/Models/MessageInput.swift index c76ac506c..d11eecab7 100644 --- a/Source/AssistantV2/Models/MessageInput.swift +++ b/Source/AssistantV2/Models/MessageInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,19 +71,19 @@ public struct MessageInput: Codable, Equatable { } /** - Initialize a `MessageInput` with member variables. + Initialize a `MessageInput` with member variables. - - parameter messageType: The type of user input. Currently, only text input is supported. - - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab - characters. - - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response - to continue using those intents rather than trying to recognize intents in the new input. - - parameter entities: Entities to use when evaluating the message. Include entities from the previous response - to continue using those entities rather than detecting entities in the new input. - - parameter suggestionID: For internal use only. - - parameter options: Optional properties that control how the assistant responds. + - parameter messageType: The type of user input. Currently, only text input is supported. + - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab + characters. + - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response + to continue using those intents rather than trying to recognize intents in the new input. + - parameter entities: Entities to use when evaluating the message. Include entities from the previous response + to continue using those entities rather than detecting entities in the new input. + - parameter suggestionID: For internal use only. + - parameter options: Optional properties that control how the assistant responds. - - returns: An initialized `MessageInput`. + - returns: An initialized `MessageInput`. */ public init( messageType: String? = nil, diff --git a/Source/AssistantV2/Models/MessageInputOptions.swift b/Source/AssistantV2/Models/MessageInputOptions.swift index 5f5c85c15..af77517b2 100644 --- a/Source/AssistantV2/Models/MessageInputOptions.swift +++ b/Source/AssistantV2/Models/MessageInputOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,33 +69,33 @@ public struct MessageInputOptions: Codable, Equatable { } /** - Initialize a `MessageInputOptions` with member variables. + Initialize a `MessageInputOptions` with member variables. - - parameter restart: Whether to restart dialog processing at the root of the dialog, regardless of any - previously visited nodes. **Note:** This does not affect `turn_count` or any other context variables. - - parameter alternateIntents: Whether to return more than one intent. Set to `true` to return all matching - intents. - - parameter spelling: Spelling correction options for the message. Any options specified on an individual - message override the settings configured for the skill. - - parameter debug: Whether to return additional diagnostic information. Set to `true` to return additional - information in the `output.debug` property. If you also specify **return_context**=`true`, the returned skill - context includes the `system.state` property. - - parameter returnContext: Whether to return session context with the response. If you specify `true`, the - response includes the `context` property. If you also specify **debug**=`true`, the returned skill context - includes the `system.state` property. - - parameter export: Whether to return session context, including full conversation state. If you specify `true`, - the response includes the `context` property, and the skill context includes the `system.state` property. - **Note:** If **export**=`true`, the context is returned regardless of the value of **return_context**. + - parameter restart: Whether to restart dialog processing at the root of the dialog, regardless of any + previously visited nodes. **Note:** This does not affect `turn_count` or any other context variables. + - parameter alternateIntents: Whether to return more than one intent. Set to `true` to return all matching + intents. + - parameter spelling: Spelling correction options for the message. Any options specified on an individual + message override the settings configured for the skill. + - parameter debug: Whether to return additional diagnostic information. Set to `true` to return additional + information in the `output.debug` property. If you also specify **return_context**=`true`, the returned skill + context includes the `system.state` property. + - parameter returnContext: Whether to return session context with the response. If you specify `true`, the + response includes the `context` property. If you also specify **debug**=`true`, the returned skill context + includes the `system.state` property. + - parameter export: Whether to return session context, including full conversation state. If you specify `true`, + the response includes the `context` property, and the skill context includes the `system.state` property. + **Note:** If **export**=`true`, the context is returned regardless of the value of **return_context**. - - returns: An initialized `MessageInputOptions`. + - returns: An initialized `MessageInputOptions`. */ public init( - debug: Bool? = nil, restart: Bool? = nil, alternateIntents: Bool? = nil, + spelling: MessageInputOptionsSpelling? = nil, + debug: Bool? = nil, returnContext: Bool? = nil, - export: Bool? = nil, - spelling: MessageInputOptionsSpelling? = nil + export: Bool? = nil ) { self.restart = restart diff --git a/Source/AssistantV2/Models/MessageInputOptionsSpelling.swift b/Source/AssistantV2/Models/MessageInputOptionsSpelling.swift index 4a2d0f5ca..4b84bc4d7 100644 --- a/Source/AssistantV2/Models/MessageInputOptionsSpelling.swift +++ b/Source/AssistantV2/Models/MessageInputOptionsSpelling.swift @@ -45,19 +45,19 @@ public struct MessageInputOptionsSpelling: Codable, Equatable { } /** - Initialize a `MessageInputOptionsSpelling` with member variables. + Initialize a `MessageInputOptionsSpelling` with member variables. - - parameter suggestions: Whether to use spelling correction when processing the input. If spelling correction is - used and **auto_correct** is `true`, any spelling corrections are automatically applied to the user input. If - **auto_correct** is `false`, any suggested corrections are returned in the **output.spelling** property. - This property overrides the value of the **spelling_suggestions** property in the workspace settings for the - skill. - - parameter autoCorrect: Whether to use autocorrection when processing the input. If this property is `true`, - any corrections are automatically applied to the user input, and the original text is returned in the - **output.spelling** property of the message response. This property overrides the value of the - **spelling_auto_correct** property in the workspace settings for the skill. + - parameter suggestions: Whether to use spelling correction when processing the input. If spelling correction is + used and **auto_correct** is `true`, any spelling corrections are automatically applied to the user input. If + **auto_correct** is `false`, any suggested corrections are returned in the **output.spelling** property. + This property overrides the value of the **spelling_suggestions** property in the workspace settings for the + skill. + - parameter autoCorrect: Whether to use autocorrection when processing the input. If this property is `true`, + any corrections are automatically applied to the user input, and the original text is returned in the + **output.spelling** property of the message response. This property overrides the value of the + **spelling_auto_correct** property in the workspace settings for the skill. - - returns: An initialized `MessageInputOptionsSpelling`. + - returns: An initialized `MessageInputOptionsSpelling`. */ public init( suggestions: Bool? = nil, diff --git a/Source/AssistantV2/Models/MessageInputOptionsStateless.swift b/Source/AssistantV2/Models/MessageInputOptionsStateless.swift index 53b15200f..bc5b575b3 100644 --- a/Source/AssistantV2/Models/MessageInputOptionsStateless.swift +++ b/Source/AssistantV2/Models/MessageInputOptionsStateless.swift @@ -53,18 +53,18 @@ public struct MessageInputOptionsStateless: Codable, Equatable { } /** - Initialize a `MessageInputOptionsStateless` with member variables. + Initialize a `MessageInputOptionsStateless` with member variables. - - parameter restart: Whether to restart dialog processing at the root of the dialog, regardless of any - previously visited nodes. **Note:** This does not affect `turn_count` or any other context variables. - - parameter alternateIntents: Whether to return more than one intent. Set to `true` to return all matching - intents. - - parameter spelling: Spelling correction options for the message. Any options specified on an individual - message override the settings configured for the skill. - - parameter debug: Whether to return additional diagnostic information. Set to `true` to return additional - information in the `output.debug` property. + - parameter restart: Whether to restart dialog processing at the root of the dialog, regardless of any + previously visited nodes. **Note:** This does not affect `turn_count` or any other context variables. + - parameter alternateIntents: Whether to return more than one intent. Set to `true` to return all matching + intents. + - parameter spelling: Spelling correction options for the message. Any options specified on an individual + message override the settings configured for the skill. + - parameter debug: Whether to return additional diagnostic information. Set to `true` to return additional + information in the `output.debug` property. - - returns: An initialized `MessageInputOptionsStateless`. + - returns: An initialized `MessageInputOptionsStateless`. */ public init( restart: Bool? = nil, diff --git a/Source/AssistantV2/Models/MessageInputStateless.swift b/Source/AssistantV2/Models/MessageInputStateless.swift index 4fc0e8df4..186956f8e 100644 --- a/Source/AssistantV2/Models/MessageInputStateless.swift +++ b/Source/AssistantV2/Models/MessageInputStateless.swift @@ -71,19 +71,19 @@ public struct MessageInputStateless: Codable, Equatable { } /** - Initialize a `MessageInputStateless` with member variables. + Initialize a `MessageInputStateless` with member variables. - - parameter messageType: The type of user input. Currently, only text input is supported. - - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab - characters. - - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response - to continue using those intents rather than trying to recognize intents in the new input. - - parameter entities: Entities to use when evaluating the message. Include entities from the previous response - to continue using those entities rather than detecting entities in the new input. - - parameter suggestionID: For internal use only. - - parameter options: Optional properties that control how the assistant responds. + - parameter messageType: The type of user input. Currently, only text input is supported. + - parameter text: The text of the user input. This string cannot contain carriage return, newline, or tab + characters. + - parameter intents: Intents to use when evaluating the user input. Include intents from the previous response + to continue using those intents rather than trying to recognize intents in the new input. + - parameter entities: Entities to use when evaluating the message. Include entities from the previous response + to continue using those entities rather than detecting entities in the new input. + - parameter suggestionID: For internal use only. + - parameter options: Optional properties that control how the assistant responds. - - returns: An initialized `MessageInputStateless`. + - returns: An initialized `MessageInputStateless`. */ public init( messageType: String? = nil, diff --git a/Source/AssistantV2/Models/MessageOutput.swift b/Source/AssistantV2/Models/MessageOutput.swift index 41a14bb75..b13b15b3a 100644 --- a/Source/AssistantV2/Models/MessageOutput.swift +++ b/Source/AssistantV2/Models/MessageOutput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/MessageOutputDebug.swift b/Source/AssistantV2/Models/MessageOutputDebug.swift index 28be33541..b68d04460 100644 --- a/Source/AssistantV2/Models/MessageOutputDebug.swift +++ b/Source/AssistantV2/Models/MessageOutputDebug.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/MessageRequest.swift b/Source/AssistantV2/Models/MessageRequest.swift index fd5bb0f44..4c8097c98 100644 --- a/Source/AssistantV2/Models/MessageRequest.swift +++ b/Source/AssistantV2/Models/MessageRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import Foundation /** A stateful message request formatted for the Watson Assistant service. */ -internal struct MessageRequest: Codable, Equatable { +public struct MessageRequest: Codable, Equatable { /** An input object that includes the input text. @@ -40,15 +40,15 @@ internal struct MessageRequest: Codable, Equatable { } /** - Initialize a `MessageRequest` with member variables. + Initialize a `MessageRequest` with member variables. - - parameter input: An input object that includes the input text. - - parameter context: Context data for the conversation. You can use this property to set or modify context - variables, which can also be accessed by dialog nodes. The context is stored by the assistant on a per-session - basis. - **Note:** The total size of the context data stored for a stateful session cannot exceed 100KB. + - parameter input: An input object that includes the input text. + - parameter context: Context data for the conversation. You can use this property to set or modify context + variables, which can also be accessed by dialog nodes. The context is stored by the assistant on a per-session + basis. + **Note:** The total size of the context data stored for a stateful session cannot exceed 100KB. - - returns: An initialized `MessageRequest`. + - returns: An initialized `MessageRequest`. */ public init( input: MessageInput? = nil, diff --git a/Source/AssistantV2/Models/MessageRequestStateless.swift b/Source/AssistantV2/Models/MessageRequestStateless.swift index 6dc075f9c..7f4a54b5c 100644 --- a/Source/AssistantV2/Models/MessageRequestStateless.swift +++ b/Source/AssistantV2/Models/MessageRequestStateless.swift @@ -41,15 +41,15 @@ internal struct MessageRequestStateless: Codable, Equatable { } /** - Initialize a `MessageRequestStateless` with member variables. + Initialize a `MessageRequestStateless` with member variables. - - parameter input: An input object that includes the input text. - - parameter context: Context data for the conversation. You can use this property to set or modify context - variables, which can also be accessed by dialog nodes. The context is not stored by the assistant. To maintain - session state, include the context from the previous response. - **Note:** The total size of the context data for a stateless session cannot exceed 250KB. + - parameter input: An input object that includes the input text. + - parameter context: Context data for the conversation. You can use this property to set or modify context + variables, which can also be accessed by dialog nodes. The context is not stored by the assistant. To maintain + session state, include the context from the previous response. + **Note:** The total size of the context data for a stateless session cannot exceed 250KB. - - returns: An initialized `MessageRequestStateless`. + - returns: An initialized `MessageRequestStateless`. */ public init( input: MessageInputStateless? = nil, diff --git a/Source/AssistantV2/Models/MessageResponse.swift b/Source/AssistantV2/Models/MessageResponse.swift index 1872d6d28..381ab2170 100644 --- a/Source/AssistantV2/Models/MessageResponse.swift +++ b/Source/AssistantV2/Models/MessageResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ public struct MessageResponse: Codable, Equatable { Context data for the conversation. You can use this property to access context variables. The context is stored by the assistant on a per-session basis. **Note:** The context is included in message responses only if **return_context**=`true` in the message request. + Full context is always included in logs. */ public var context: MessageContext? diff --git a/Source/AssistantV2/Models/RuntimeEntity.swift b/Source/AssistantV2/Models/RuntimeEntity.swift index 709e89de6..c31fccd1e 100644 --- a/Source/AssistantV2/Models/RuntimeEntity.swift +++ b/Source/AssistantV2/Models/RuntimeEntity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,28 +89,28 @@ public struct RuntimeEntity: Codable, Equatable { } /** - Initialize a `RuntimeEntity` with member variables. - - - parameter entity: An entity detected in the input. - - parameter location: An array of zero-based character offsets that indicate where the detected entity values - begin and end in the input text. - - parameter value: The term in the input text that was recognized as an entity value. - - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. - - parameter metadata: Any metadata for the entity. - - parameter groups: The recognized capture groups for the entity, as defined by the entity pattern. - - parameter interpretation: An object containing detailed information about the entity recognized in the user - input. This property is included only if the new system entities are enabled for the skill. - For more information about how the new system entities are interpreted, see the - [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities). - - parameter alternatives: An array of possible alternative values that the user might have intended instead of - the value returned in the **value** property. This property is returned only for `@sys-time` and `@sys-date` - entities when the user's input is ambiguous. - This property is included only if the new system entities are enabled for the skill. - - parameter role: An object describing the role played by a system entity that is specifies the beginning or end - of a range recognized in the user input. This property is included only if the new system entities are enabled - for the skill. - - - returns: An initialized `RuntimeEntity`. + Initialize a `RuntimeEntity` with member variables. + + - parameter entity: An entity detected in the input. + - parameter location: An array of zero-based character offsets that indicate where the detected entity values + begin and end in the input text. + - parameter value: The term in the input text that was recognized as an entity value. + - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. + - parameter metadata: Any metadata for the entity. + - parameter groups: The recognized capture groups for the entity, as defined by the entity pattern. + - parameter interpretation: An object containing detailed information about the entity recognized in the user + input. This property is included only if the new system entities are enabled for the skill. + For more information about how the new system entities are interpreted, see the + [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities). + - parameter alternatives: An array of possible alternative values that the user might have intended instead of + the value returned in the **value** property. This property is returned only for `@sys-time` and `@sys-date` + entities when the user's input is ambiguous. + This property is included only if the new system entities are enabled for the skill. + - parameter role: An object describing the role played by a system entity that is specifies the beginning or end + of a range recognized in the user input. This property is included only if the new system entities are enabled + for the skill. + + - returns: An initialized `RuntimeEntity`. */ public init( entity: String, diff --git a/Source/AssistantV2/Models/RuntimeEntityAlternative.swift b/Source/AssistantV2/Models/RuntimeEntityAlternative.swift index 17709e9c1..0311bcaab 100644 --- a/Source/AssistantV2/Models/RuntimeEntityAlternative.swift +++ b/Source/AssistantV2/Models/RuntimeEntityAlternative.swift @@ -38,12 +38,12 @@ public struct RuntimeEntityAlternative: Codable, Equatable { } /** - Initialize a `RuntimeEntityAlternative` with member variables. + Initialize a `RuntimeEntityAlternative` with member variables. - - parameter value: The entity value that was recognized in the user input. - - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. + - parameter value: The entity value that was recognized in the user input. + - parameter confidence: A decimal percentage that represents Watson's confidence in the recognized entity. - - returns: An initialized `RuntimeEntityAlternative`. + - returns: An initialized `RuntimeEntityAlternative`. */ public init( value: String? = nil, diff --git a/Source/AssistantV2/Models/RuntimeEntityInterpretation.swift b/Source/AssistantV2/Models/RuntimeEntityInterpretation.swift index 884d05f3e..b499f3ca5 100644 --- a/Source/AssistantV2/Models/RuntimeEntityInterpretation.swift +++ b/Source/AssistantV2/Models/RuntimeEntityInterpretation.swift @@ -213,60 +213,60 @@ public struct RuntimeEntityInterpretation: Codable, Equatable { } /** - Initialize a `RuntimeEntityInterpretation` with member variables. - - - parameter calendarType: The calendar used to represent a recognized date (for example, `Gregorian`). - - parameter datetimeLink: A unique identifier used to associate a recognized time and date. If the user input - contains a date and time that are mentioned together (for example, `Today at 5`, the same **datetime_link** value - is returned for both the `@sys-date` and `@sys-time` entities). - - parameter festival: A locale-specific holiday name (such as `thanksgiving` or `christmas`). This property is - included when a `@sys-date` entity is recognized based on a holiday name in the user input. - - parameter granularity: The precision or duration of a time range specified by a recognized `@sys-time` or - `@sys-date` entity. - - parameter rangeLink: A unique identifier used to associate multiple recognized `@sys-date`, `@sys-time`, or - `@sys-number` entities that are recognized as a range of values in the user's input (for example, `from July 4 - until July 14` or `from 20 to 25`). - - parameter rangeModifier: The word in the user input that indicates that a `sys-date` or `sys-time` entity is - part of an implied range where only one date or time is specified (for example, `since` or `until`). - - parameter relativeDay: A recognized mention of a relative day, represented numerically as an offset from the - current date (for example, `-1` for `yesterday` or `10` for `in ten days`). - - parameter relativeMonth: A recognized mention of a relative month, represented numerically as an offset from - the current month (for example, `1` for `next month` or `-3` for `three months ago`). - - parameter relativeWeek: A recognized mention of a relative week, represented numerically as an offset from the - current week (for example, `2` for `in two weeks` or `-1` for `last week). - - parameter relativeWeekend: A recognized mention of a relative date range for a weekend, represented - numerically as an offset from the current weekend (for example, `0` for `this weekend` or `-1` for `last - weekend`). - - parameter relativeYear: A recognized mention of a relative year, represented numerically as an offset from the - current year (for example, `1` for `next year` or `-5` for `five years ago`). - - parameter specificDay: A recognized mention of a specific date, represented numerically as the date within the - month (for example, `30` for `June 30`.). - - parameter specificDayOfWeek: A recognized mention of a specific day of the week as a lowercase string (for - example, `monday`). - - parameter specificMonth: A recognized mention of a specific month, represented numerically (for example, `7` - for `July`). - - parameter specificQuarter: A recognized mention of a specific quarter, represented numerically (for example, - `3` for `the third quarter`). - - parameter specificYear: A recognized mention of a specific year (for example, `2016`). - - parameter numericValue: A recognized numeric value, represented as an integer or double. - - parameter subtype: The type of numeric value recognized in the user input (`integer` or `rational`). - - parameter partOfDay: A recognized term for a time that was mentioned as a part of the day in the user's input - (for example, `morning` or `afternoon`). - - parameter relativeHour: A recognized mention of a relative hour, represented numerically as an offset from the - current hour (for example, `3` for `in three hours` or `-1` for `an hour ago`). - - parameter relativeMinute: A recognized mention of a relative time, represented numerically as an offset in - minutes from the current time (for example, `5` for `in five minutes` or `-15` for `fifteen minutes ago`). - - parameter relativeSecond: A recognized mention of a relative time, represented numerically as an offset in - seconds from the current time (for example, `10` for `in ten seconds` or `-30` for `thirty seconds ago`). - - parameter specificHour: A recognized specific hour mentioned as part of a time value (for example, `10` for - `10:15 AM`.). - - parameter specificMinute: A recognized specific minute mentioned as part of a time value (for example, `15` - for `10:15 AM`.). - - parameter specificSecond: A recognized specific second mentioned as part of a time value (for example, `30` - for `10:15:30 AM`.). - - parameter timezone: A recognized time zone mentioned as part of a time value (for example, `EST`). - - - returns: An initialized `RuntimeEntityInterpretation`. + Initialize a `RuntimeEntityInterpretation` with member variables. + + - parameter calendarType: The calendar used to represent a recognized date (for example, `Gregorian`). + - parameter datetimeLink: A unique identifier used to associate a recognized time and date. If the user input + contains a date and time that are mentioned together (for example, `Today at 5`, the same **datetime_link** value + is returned for both the `@sys-date` and `@sys-time` entities). + - parameter festival: A locale-specific holiday name (such as `thanksgiving` or `christmas`). This property is + included when a `@sys-date` entity is recognized based on a holiday name in the user input. + - parameter granularity: The precision or duration of a time range specified by a recognized `@sys-time` or + `@sys-date` entity. + - parameter rangeLink: A unique identifier used to associate multiple recognized `@sys-date`, `@sys-time`, or + `@sys-number` entities that are recognized as a range of values in the user's input (for example, `from July 4 + until July 14` or `from 20 to 25`). + - parameter rangeModifier: The word in the user input that indicates that a `sys-date` or `sys-time` entity is + part of an implied range where only one date or time is specified (for example, `since` or `until`). + - parameter relativeDay: A recognized mention of a relative day, represented numerically as an offset from the + current date (for example, `-1` for `yesterday` or `10` for `in ten days`). + - parameter relativeMonth: A recognized mention of a relative month, represented numerically as an offset from + the current month (for example, `1` for `next month` or `-3` for `three months ago`). + - parameter relativeWeek: A recognized mention of a relative week, represented numerically as an offset from the + current week (for example, `2` for `in two weeks` or `-1` for `last week). + - parameter relativeWeekend: A recognized mention of a relative date range for a weekend, represented + numerically as an offset from the current weekend (for example, `0` for `this weekend` or `-1` for `last + weekend`). + - parameter relativeYear: A recognized mention of a relative year, represented numerically as an offset from the + current year (for example, `1` for `next year` or `-5` for `five years ago`). + - parameter specificDay: A recognized mention of a specific date, represented numerically as the date within the + month (for example, `30` for `June 30`.). + - parameter specificDayOfWeek: A recognized mention of a specific day of the week as a lowercase string (for + example, `monday`). + - parameter specificMonth: A recognized mention of a specific month, represented numerically (for example, `7` + for `July`). + - parameter specificQuarter: A recognized mention of a specific quarter, represented numerically (for example, + `3` for `the third quarter`). + - parameter specificYear: A recognized mention of a specific year (for example, `2016`). + - parameter numericValue: A recognized numeric value, represented as an integer or double. + - parameter subtype: The type of numeric value recognized in the user input (`integer` or `rational`). + - parameter partOfDay: A recognized term for a time that was mentioned as a part of the day in the user's input + (for example, `morning` or `afternoon`). + - parameter relativeHour: A recognized mention of a relative hour, represented numerically as an offset from the + current hour (for example, `3` for `in three hours` or `-1` for `an hour ago`). + - parameter relativeMinute: A recognized mention of a relative time, represented numerically as an offset in + minutes from the current time (for example, `5` for `in five minutes` or `-15` for `fifteen minutes ago`). + - parameter relativeSecond: A recognized mention of a relative time, represented numerically as an offset in + seconds from the current time (for example, `10` for `in ten seconds` or `-30` for `thirty seconds ago`). + - parameter specificHour: A recognized specific hour mentioned as part of a time value (for example, `10` for + `10:15 AM`.). + - parameter specificMinute: A recognized specific minute mentioned as part of a time value (for example, `15` + for `10:15 AM`.). + - parameter specificSecond: A recognized specific second mentioned as part of a time value (for example, `30` + for `10:15:30 AM`.). + - parameter timezone: A recognized time zone mentioned as part of a time value (for example, `EST`). + + - returns: An initialized `RuntimeEntityInterpretation`. */ public init( calendarType: String? = nil, diff --git a/Source/AssistantV2/Models/RuntimeEntityRole.swift b/Source/AssistantV2/Models/RuntimeEntityRole.swift index d0db6c606..7a7ddda0b 100644 --- a/Source/AssistantV2/Models/RuntimeEntityRole.swift +++ b/Source/AssistantV2/Models/RuntimeEntityRole.swift @@ -45,11 +45,11 @@ public struct RuntimeEntityRole: Codable, Equatable { } /** - Initialize a `RuntimeEntityRole` with member variables. + Initialize a `RuntimeEntityRole` with member variables. - - parameter type: The relationship of the entity to the range. + - parameter type: The relationship of the entity to the range. - - returns: An initialized `RuntimeEntityRole`. + - returns: An initialized `RuntimeEntityRole`. */ public init( type: String? = nil diff --git a/Source/AssistantV2/Models/RuntimeIntent.swift b/Source/AssistantV2/Models/RuntimeIntent.swift index fad90b89b..d3f045d64 100644 --- a/Source/AssistantV2/Models/RuntimeIntent.swift +++ b/Source/AssistantV2/Models/RuntimeIntent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct RuntimeIntent: Codable, Equatable { } /** - Initialize a `RuntimeIntent` with member variables. + Initialize a `RuntimeIntent` with member variables. - - parameter intent: The name of the recognized intent. - - parameter confidence: A decimal percentage that represents Watson's confidence in the intent. + - parameter intent: The name of the recognized intent. + - parameter confidence: A decimal percentage that represents Watson's confidence in the intent. - - returns: An initialized `RuntimeIntent`. + - returns: An initialized `RuntimeIntent`. */ public init( intent: String, diff --git a/Source/AssistantV2/Models/RuntimeResponseGeneric.swift b/Source/AssistantV2/Models/RuntimeResponseGeneric.swift index e23950639..08ba699f2 100644 --- a/Source/AssistantV2/Models/RuntimeResponseGeneric.swift +++ b/Source/AssistantV2/Models/RuntimeResponseGeneric.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,6 @@ public struct RuntimeResponseGeneric: Codable, Equatable { /** 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 enum ResponseType: String { case text = "text" @@ -46,8 +44,6 @@ public struct RuntimeResponseGeneric: Codable, Equatable { /** 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 var responseType: String @@ -103,8 +99,6 @@ public struct RuntimeResponseGeneric: Codable, Equatable { /** 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. */ public var suggestions: [DialogSuggestion]? diff --git a/Source/AssistantV2/Models/SearchResult.swift b/Source/AssistantV2/Models/SearchResult.swift index f48631678..bfbf5f810 100644 --- a/Source/AssistantV2/Models/SearchResult.swift +++ b/Source/AssistantV2/Models/SearchResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,7 @@ public struct SearchResult: Codable, Equatable { /** The unique identifier of the document in the Discovery service collection. - This property is included in responses from search skills, which are a beta feature available only to Plus or - Premium plan users. + This property is included in responses from search skills, which are available only to Plus or Premium plan users. */ public var id: String diff --git a/Source/AssistantV2/Models/SearchResultHighlight.swift b/Source/AssistantV2/Models/SearchResultHighlight.swift index 6ee372be8..1e32f39d3 100644 --- a/Source/AssistantV2/Models/SearchResultHighlight.swift +++ b/Source/AssistantV2/Models/SearchResultHighlight.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,40 +68,5 @@ public struct SearchResultHighlight: Codable, Equatable { var dynamicContainer = encoder.container(keyedBy: DynamicKeys.self) try dynamicContainer.encodeIfPresent(additionalProperties) } -} - -public extension KeyedDecodingContainer where Key == DynamicKeys { - - /// Decode additional properties. - func decode(_ type: [String: [String]].Type, excluding keys: [CodingKey]) throws -> [String: [String]] { - var retval: [String: [String]] = [:] - try self.allKeys.forEach { key in - if !keys.contains{ $0.stringValue == key.stringValue} { - let value = try self.decode([String].self, forKey: key) - retval[key.stringValue] = value - } - } - return retval - } -} -public extension KeyedEncodingContainer where Key == DynamicKeys { - - /// Encode additional properties. - mutating func encode(_ additionalProperties: [String: [String]]) throws { - try additionalProperties.forEach { key, value in - guard let codingKey = DynamicKeys(stringValue: key) else { - let description = "Cannot construct CodingKey for \(key)" - let context = EncodingError.Context(codingPath: codingPath, debugDescription: description) - throw EncodingError.invalidValue(key, context) - } - try self.encode(value, forKey: codingKey) - } - } - - /// Encode additional properties if they are not nil. - mutating func encodeIfPresent(_ additionalProperties: [String: [String]]?) throws { - guard let additionalProperties = additionalProperties else { return } - try encode(additionalProperties) - } } diff --git a/Source/AssistantV2/Models/SearchResultMetadata.swift b/Source/AssistantV2/Models/SearchResultMetadata.swift index d2d77b209..3e270c4d4 100644 --- a/Source/AssistantV2/Models/SearchResultMetadata.swift +++ b/Source/AssistantV2/Models/SearchResultMetadata.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/AssistantV2/Models/SessionResponse.swift b/Source/AssistantV2/Models/SessionResponse.swift index e3df9043a..01dc69e3a 100644 --- a/Source/AssistantV2/Models/SessionResponse.swift +++ b/Source/AssistantV2/Models/SessionResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/CompareComply.swift b/Source/CompareComplyV1/CompareComply.swift index 70222dded..154742ed2 100644 --- a/Source/CompareComplyV1/CompareComply.swift +++ b/Source/CompareComplyV1/CompareComply.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import IBMSwiftSDKCore public class CompareComply { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/compare-comply/api" + public var serviceURL: String? = "https://api.us-south.compare-comply.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "CompareComply" @@ -53,10 +53,11 @@ public class CompareComply { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -82,8 +83,8 @@ public class CompareComply { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() diff --git a/Source/CompareComplyV1/Models/Address.swift b/Source/CompareComplyV1/Models/Address.swift index c1e02282c..2e63dfee9 100644 --- a/Source/CompareComplyV1/Models/Address.swift +++ b/Source/CompareComplyV1/Models/Address.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/AlignedElement.swift b/Source/CompareComplyV1/Models/AlignedElement.swift index 6b7986879..9c993c813 100644 --- a/Source/CompareComplyV1/Models/AlignedElement.swift +++ b/Source/CompareComplyV1/Models/AlignedElement.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Attribute.swift b/Source/CompareComplyV1/Models/Attribute.swift index 0e1190e30..619e49ccd 100644 --- a/Source/CompareComplyV1/Models/Attribute.swift +++ b/Source/CompareComplyV1/Models/Attribute.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/BatchStatus.swift b/Source/CompareComplyV1/Models/BatchStatus.swift index 0af75ea8c..8d3316af3 100644 --- a/Source/CompareComplyV1/Models/BatchStatus.swift +++ b/Source/CompareComplyV1/Models/BatchStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Batches.swift b/Source/CompareComplyV1/Models/Batches.swift index 955f6fb0c..12a02749b 100644 --- a/Source/CompareComplyV1/Models/Batches.swift +++ b/Source/CompareComplyV1/Models/Batches.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/BodyCells.swift b/Source/CompareComplyV1/Models/BodyCells.swift index 6a94c3bfa..53b09526e 100644 --- a/Source/CompareComplyV1/Models/BodyCells.swift +++ b/Source/CompareComplyV1/Models/BodyCells.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Category.swift b/Source/CompareComplyV1/Models/Category.swift index ecf96fa8f..7505f7e3e 100644 --- a/Source/CompareComplyV1/Models/Category.swift +++ b/Source/CompareComplyV1/Models/Category.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,12 +69,12 @@ public struct Category: Codable, Equatable { } /** - Initialize a `Category` with member variables. + Initialize a `Category` with member variables. - - parameter label: The category of the associated element. - - parameter provenanceIDs: Hashed values that you can send to IBM to provide feedback or receive support. + - parameter label: The category of the associated element. + - parameter provenanceIDs: Hashed values that you can send to IBM to provide feedback or receive support. - - returns: An initialized `Category`. + - returns: An initialized `Category`. */ public init( label: String? = nil, diff --git a/Source/CompareComplyV1/Models/CategoryComparison.swift b/Source/CompareComplyV1/Models/CategoryComparison.swift index 505effba1..4b6f52b2c 100644 --- a/Source/CompareComplyV1/Models/CategoryComparison.swift +++ b/Source/CompareComplyV1/Models/CategoryComparison.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ClassifyReturn.swift b/Source/CompareComplyV1/Models/ClassifyReturn.swift index 8d87b25bc..d477ae575 100644 --- a/Source/CompareComplyV1/Models/ClassifyReturn.swift +++ b/Source/CompareComplyV1/Models/ClassifyReturn.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ColumnHeaders.swift b/Source/CompareComplyV1/Models/ColumnHeaders.swift index e47bcf6e0..d635cc159 100644 --- a/Source/CompareComplyV1/Models/ColumnHeaders.swift +++ b/Source/CompareComplyV1/Models/ColumnHeaders.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/CompareReturn.swift b/Source/CompareComplyV1/Models/CompareReturn.swift index cad42ca6f..96609b1a9 100644 --- a/Source/CompareComplyV1/Models/CompareReturn.swift +++ b/Source/CompareComplyV1/Models/CompareReturn.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Contact.swift b/Source/CompareComplyV1/Models/Contact.swift index 7880aedaa..3ca22d21d 100644 --- a/Source/CompareComplyV1/Models/Contact.swift +++ b/Source/CompareComplyV1/Models/Contact.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Contexts.swift b/Source/CompareComplyV1/Models/Contexts.swift index 089abf1ea..3bb8245b3 100644 --- a/Source/CompareComplyV1/Models/Contexts.swift +++ b/Source/CompareComplyV1/Models/Contexts.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ContractAmts.swift b/Source/CompareComplyV1/Models/ContractAmts.swift index 73c116e24..e009b63d7 100644 --- a/Source/CompareComplyV1/Models/ContractAmts.swift +++ b/Source/CompareComplyV1/Models/ContractAmts.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ContractCurrencies.swift b/Source/CompareComplyV1/Models/ContractCurrencies.swift index fb9bcbe18..f1742a610 100644 --- a/Source/CompareComplyV1/Models/ContractCurrencies.swift +++ b/Source/CompareComplyV1/Models/ContractCurrencies.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ContractTerms.swift b/Source/CompareComplyV1/Models/ContractTerms.swift index a7ed839cd..17aad4c8e 100644 --- a/Source/CompareComplyV1/Models/ContractTerms.swift +++ b/Source/CompareComplyV1/Models/ContractTerms.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ContractTypes.swift b/Source/CompareComplyV1/Models/ContractTypes.swift index b097a33f8..2e7f1bb95 100644 --- a/Source/CompareComplyV1/Models/ContractTypes.swift +++ b/Source/CompareComplyV1/Models/ContractTypes.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/DocCounts.swift b/Source/CompareComplyV1/Models/DocCounts.swift index e826efcc9..9089ce24a 100644 --- a/Source/CompareComplyV1/Models/DocCounts.swift +++ b/Source/CompareComplyV1/Models/DocCounts.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/DocInfo.swift b/Source/CompareComplyV1/Models/DocInfo.swift index e659b0499..b7a389ee8 100644 --- a/Source/CompareComplyV1/Models/DocInfo.swift +++ b/Source/CompareComplyV1/Models/DocInfo.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/DocStructure.swift b/Source/CompareComplyV1/Models/DocStructure.swift index c30e01c7d..580aecbb3 100644 --- a/Source/CompareComplyV1/Models/DocStructure.swift +++ b/Source/CompareComplyV1/Models/DocStructure.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Document.swift b/Source/CompareComplyV1/Models/Document.swift index 08d1ee6aa..d735016c1 100644 --- a/Source/CompareComplyV1/Models/Document.swift +++ b/Source/CompareComplyV1/Models/Document.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/EffectiveDates.swift b/Source/CompareComplyV1/Models/EffectiveDates.swift index 51564da59..62ca13c14 100644 --- a/Source/CompareComplyV1/Models/EffectiveDates.swift +++ b/Source/CompareComplyV1/Models/EffectiveDates.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Element.swift b/Source/CompareComplyV1/Models/Element.swift index d1bbe3677..d6b50dd9e 100644 --- a/Source/CompareComplyV1/Models/Element.swift +++ b/Source/CompareComplyV1/Models/Element.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ElementLocations.swift b/Source/CompareComplyV1/Models/ElementLocations.swift index 96217cea3..005ad472e 100644 --- a/Source/CompareComplyV1/Models/ElementLocations.swift +++ b/Source/CompareComplyV1/Models/ElementLocations.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ElementPair.swift b/Source/CompareComplyV1/Models/ElementPair.swift index 3fa262bf7..43b780618 100644 --- a/Source/CompareComplyV1/Models/ElementPair.swift +++ b/Source/CompareComplyV1/Models/ElementPair.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/FeedbackDataInput.swift b/Source/CompareComplyV1/Models/FeedbackDataInput.swift index 07383918e..d286203fd 100644 --- a/Source/CompareComplyV1/Models/FeedbackDataInput.swift +++ b/Source/CompareComplyV1/Models/FeedbackDataInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,19 +75,19 @@ public struct FeedbackDataInput: Codable, Equatable { } /** - Initialize a `FeedbackDataInput` with member variables. + Initialize a `FeedbackDataInput` with member variables. - - parameter feedbackType: The type of feedback. The only permitted value is `element_classification`. - - parameter location: The numeric location of the identified element in the document, represented with two - integers labeled `begin` and `end`. - - parameter text: The text on which to submit feedback. - - parameter originalLabels: The original labeling from the input document, without the submitted feedback. - - parameter updatedLabels: The updated labeling from the input document, accounting for the submitted feedback. - - parameter document: Brief information about the input document. - - parameter modelID: An optional string identifying the model ID. The only permitted value is `contracts`. - - parameter modelVersion: An optional string identifying the version of the model used. + - parameter feedbackType: The type of feedback. The only permitted value is `element_classification`. + - parameter location: The numeric location of the identified element in the document, represented with two + integers labeled `begin` and `end`. + - parameter text: The text on which to submit feedback. + - parameter originalLabels: The original labeling from the input document, without the submitted feedback. + - parameter updatedLabels: The updated labeling from the input document, accounting for the submitted feedback. + - parameter document: Brief information about the input document. + - parameter modelID: An optional string identifying the model ID. The only permitted value is `contracts`. + - parameter modelVersion: An optional string identifying the version of the model used. - - returns: An initialized `FeedbackDataInput`. + - returns: An initialized `FeedbackDataInput`. */ public init( feedbackType: String, diff --git a/Source/CompareComplyV1/Models/FeedbackDataOutput.swift b/Source/CompareComplyV1/Models/FeedbackDataOutput.swift index 8cd9c0898..534772d5a 100644 --- a/Source/CompareComplyV1/Models/FeedbackDataOutput.swift +++ b/Source/CompareComplyV1/Models/FeedbackDataOutput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/FeedbackDeleted.swift b/Source/CompareComplyV1/Models/FeedbackDeleted.swift index f2ab6ebc3..c928d8f55 100644 --- a/Source/CompareComplyV1/Models/FeedbackDeleted.swift +++ b/Source/CompareComplyV1/Models/FeedbackDeleted.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/FeedbackInput.swift b/Source/CompareComplyV1/Models/FeedbackInput.swift index 3a23154c2..4ee91a1b8 100644 --- a/Source/CompareComplyV1/Models/FeedbackInput.swift +++ b/Source/CompareComplyV1/Models/FeedbackInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,13 +44,13 @@ internal struct FeedbackInput: Codable, Equatable { } /** - Initialize a `FeedbackInput` with member variables. + Initialize a `FeedbackInput` with member variables. - - parameter feedbackData: Feedback data for submission. - - parameter userID: An optional string identifying the user. - - parameter comment: An optional comment on or description of the feedback. + - parameter feedbackData: Feedback data for submission. + - parameter userID: An optional string identifying the user. + - parameter comment: An optional comment on or description of the feedback. - - returns: An initialized `FeedbackInput`. + - returns: An initialized `FeedbackInput`. */ public init( feedbackData: FeedbackDataInput, diff --git a/Source/CompareComplyV1/Models/FeedbackList.swift b/Source/CompareComplyV1/Models/FeedbackList.swift index 6522b5740..cc13f4c93 100644 --- a/Source/CompareComplyV1/Models/FeedbackList.swift +++ b/Source/CompareComplyV1/Models/FeedbackList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/FeedbackReturn.swift b/Source/CompareComplyV1/Models/FeedbackReturn.swift index 6d57fa18f..d8e3ce310 100644 --- a/Source/CompareComplyV1/Models/FeedbackReturn.swift +++ b/Source/CompareComplyV1/Models/FeedbackReturn.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/GetFeedback.swift b/Source/CompareComplyV1/Models/GetFeedback.swift index 6f03b5a22..7b2cf8cfd 100644 --- a/Source/CompareComplyV1/Models/GetFeedback.swift +++ b/Source/CompareComplyV1/Models/GetFeedback.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/HTMLReturn.swift b/Source/CompareComplyV1/Models/HTMLReturn.swift index 46881ba5f..5f7e9725d 100644 --- a/Source/CompareComplyV1/Models/HTMLReturn.swift +++ b/Source/CompareComplyV1/Models/HTMLReturn.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Interpretation.swift b/Source/CompareComplyV1/Models/Interpretation.swift index c1d2b925a..ed3e5d665 100644 --- a/Source/CompareComplyV1/Models/Interpretation.swift +++ b/Source/CompareComplyV1/Models/Interpretation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Key.swift b/Source/CompareComplyV1/Models/Key.swift index b616b0d8b..fa4e4a59f 100644 --- a/Source/CompareComplyV1/Models/Key.swift +++ b/Source/CompareComplyV1/Models/Key.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/KeyValuePair.swift b/Source/CompareComplyV1/Models/KeyValuePair.swift index 2e0f32685..a36e791ce 100644 --- a/Source/CompareComplyV1/Models/KeyValuePair.swift +++ b/Source/CompareComplyV1/Models/KeyValuePair.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Label.swift b/Source/CompareComplyV1/Models/Label.swift index 5e6fc453b..620545835 100644 --- a/Source/CompareComplyV1/Models/Label.swift +++ b/Source/CompareComplyV1/Models/Label.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,12 +39,12 @@ public struct Label: Codable, Equatable { } /** - Initialize a `Label` with member variables. + Initialize a `Label` with member variables. - - parameter nature: The identified `nature` of the element. - - parameter party: The identified `party` of the element. + - parameter nature: The identified `nature` of the element. + - parameter party: The identified `party` of the element. - - returns: An initialized `Label`. + - returns: An initialized `Label`. */ public init( nature: String, diff --git a/Source/CompareComplyV1/Models/LeadingSentence.swift b/Source/CompareComplyV1/Models/LeadingSentence.swift index c4e3c6fef..c2e130279 100644 --- a/Source/CompareComplyV1/Models/LeadingSentence.swift +++ b/Source/CompareComplyV1/Models/LeadingSentence.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Location.swift b/Source/CompareComplyV1/Models/Location.swift index 9da4c6948..6ff808b14 100644 --- a/Source/CompareComplyV1/Models/Location.swift +++ b/Source/CompareComplyV1/Models/Location.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,12 +39,12 @@ public struct Location: Codable, Equatable { } /** - Initialize a `Location` with member variables. + Initialize a `Location` with member variables. - - parameter begin: The element's `begin` index. - - parameter end: The element's `end` index. + - parameter begin: The element's `begin` index. + - parameter end: The element's `end` index. - - returns: An initialized `Location`. + - returns: An initialized `Location`. */ public init( begin: Int, diff --git a/Source/CompareComplyV1/Models/Mention.swift b/Source/CompareComplyV1/Models/Mention.swift index 9d1d4a8d6..0e4029622 100644 --- a/Source/CompareComplyV1/Models/Mention.swift +++ b/Source/CompareComplyV1/Models/Mention.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/OriginalLabelsIn.swift b/Source/CompareComplyV1/Models/OriginalLabelsIn.swift index a1e0916ae..205d2ce26 100644 --- a/Source/CompareComplyV1/Models/OriginalLabelsIn.swift +++ b/Source/CompareComplyV1/Models/OriginalLabelsIn.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,13 @@ public struct OriginalLabelsIn: Codable, Equatable { } /** - Initialize a `OriginalLabelsIn` with member variables. + Initialize a `OriginalLabelsIn` with member variables. - - parameter types: Description of the action specified by the element and whom it affects. - - parameter categories: List of functional categories into which the element falls; in other words, the subject - matter of the element. + - parameter types: Description of the action specified by the element and whom it affects. + - parameter categories: List of functional categories into which the element falls; in other words, the subject + matter of the element. - - returns: An initialized `OriginalLabelsIn`. + - returns: An initialized `OriginalLabelsIn`. */ public init( types: [TypeLabel], diff --git a/Source/CompareComplyV1/Models/OriginalLabelsOut.swift b/Source/CompareComplyV1/Models/OriginalLabelsOut.swift index 050fbb489..8f100c9e8 100644 --- a/Source/CompareComplyV1/Models/OriginalLabelsOut.swift +++ b/Source/CompareComplyV1/Models/OriginalLabelsOut.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Pagination.swift b/Source/CompareComplyV1/Models/Pagination.swift index b891b5cfc..2b3c7e653 100644 --- a/Source/CompareComplyV1/Models/Pagination.swift +++ b/Source/CompareComplyV1/Models/Pagination.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Paragraphs.swift b/Source/CompareComplyV1/Models/Paragraphs.swift index 87a488f87..83f62bd49 100644 --- a/Source/CompareComplyV1/Models/Paragraphs.swift +++ b/Source/CompareComplyV1/Models/Paragraphs.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Parties.swift b/Source/CompareComplyV1/Models/Parties.swift index 57dd5d30f..89efbbba0 100644 --- a/Source/CompareComplyV1/Models/Parties.swift +++ b/Source/CompareComplyV1/Models/Parties.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/PaymentTerms.swift b/Source/CompareComplyV1/Models/PaymentTerms.swift index c3fc15997..2f1993302 100644 --- a/Source/CompareComplyV1/Models/PaymentTerms.swift +++ b/Source/CompareComplyV1/Models/PaymentTerms.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/RowHeaders.swift b/Source/CompareComplyV1/Models/RowHeaders.swift index 601f46884..655b07877 100644 --- a/Source/CompareComplyV1/Models/RowHeaders.swift +++ b/Source/CompareComplyV1/Models/RowHeaders.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/SectionTitle.swift b/Source/CompareComplyV1/Models/SectionTitle.swift index 755fe21ca..429022b08 100644 --- a/Source/CompareComplyV1/Models/SectionTitle.swift +++ b/Source/CompareComplyV1/Models/SectionTitle.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/SectionTitles.swift b/Source/CompareComplyV1/Models/SectionTitles.swift index 8ac1b7e17..a5ddf0d42 100644 --- a/Source/CompareComplyV1/Models/SectionTitles.swift +++ b/Source/CompareComplyV1/Models/SectionTitles.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/ShortDoc.swift b/Source/CompareComplyV1/Models/ShortDoc.swift index 8a5b42dee..c0f3092f4 100644 --- a/Source/CompareComplyV1/Models/ShortDoc.swift +++ b/Source/CompareComplyV1/Models/ShortDoc.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct ShortDoc: Codable, Equatable { } /** - Initialize a `ShortDoc` with member variables. + Initialize a `ShortDoc` with member variables. - - parameter title: The title of the input document, if identified. - - parameter hash: The MD5 hash of the input document. + - parameter title: The title of the input document, if identified. + - parameter hash: The MD5 hash of the input document. - - returns: An initialized `ShortDoc`. + - returns: An initialized `ShortDoc`. */ public init( title: String? = nil, diff --git a/Source/CompareComplyV1/Models/TableHeaders.swift b/Source/CompareComplyV1/Models/TableHeaders.swift index 2c94f795e..d9c0c303f 100644 --- a/Source/CompareComplyV1/Models/TableHeaders.swift +++ b/Source/CompareComplyV1/Models/TableHeaders.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/TableReturn.swift b/Source/CompareComplyV1/Models/TableReturn.swift index 800fba121..97382f6b0 100644 --- a/Source/CompareComplyV1/Models/TableReturn.swift +++ b/Source/CompareComplyV1/Models/TableReturn.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/TableTitle.swift b/Source/CompareComplyV1/Models/TableTitle.swift index c9723ea1f..b8b36c001 100644 --- a/Source/CompareComplyV1/Models/TableTitle.swift +++ b/Source/CompareComplyV1/Models/TableTitle.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Tables.swift b/Source/CompareComplyV1/Models/Tables.swift index edd5ea2e4..844a6e195 100644 --- a/Source/CompareComplyV1/Models/Tables.swift +++ b/Source/CompareComplyV1/Models/Tables.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/TerminationDates.swift b/Source/CompareComplyV1/Models/TerminationDates.swift index cbc8232bf..1ba0dd5b4 100644 --- a/Source/CompareComplyV1/Models/TerminationDates.swift +++ b/Source/CompareComplyV1/Models/TerminationDates.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/TypeLabel.swift b/Source/CompareComplyV1/Models/TypeLabel.swift index dd489db19..9096f404b 100644 --- a/Source/CompareComplyV1/Models/TypeLabel.swift +++ b/Source/CompareComplyV1/Models/TypeLabel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,13 +39,13 @@ public struct TypeLabel: Codable, Equatable { } /** - Initialize a `TypeLabel` with member variables. + Initialize a `TypeLabel` with member variables. - - parameter label: A pair of `nature` and `party` objects. The `nature` object identifies the effect of the - element on the identified `party`, and the `party` object identifies the affected party. - - parameter provenanceIDs: Hashed values that you can send to IBM to provide feedback or receive support. + - parameter label: A pair of `nature` and `party` objects. The `nature` object identifies the effect of the + element on the identified `party`, and the `party` object identifies the affected party. + - parameter provenanceIDs: Hashed values that you can send to IBM to provide feedback or receive support. - - returns: An initialized `TypeLabel`. + - returns: An initialized `TypeLabel`. */ public init( label: Label? = nil, diff --git a/Source/CompareComplyV1/Models/TypeLabelComparison.swift b/Source/CompareComplyV1/Models/TypeLabelComparison.swift index 6d8678d06..6d8cd15ee 100644 --- a/Source/CompareComplyV1/Models/TypeLabelComparison.swift +++ b/Source/CompareComplyV1/Models/TypeLabelComparison.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/UnalignedElement.swift b/Source/CompareComplyV1/Models/UnalignedElement.swift index b16f9e2fe..9027b71a4 100644 --- a/Source/CompareComplyV1/Models/UnalignedElement.swift +++ b/Source/CompareComplyV1/Models/UnalignedElement.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/UpdatedLabelsIn.swift b/Source/CompareComplyV1/Models/UpdatedLabelsIn.swift index 920339fa2..e962f379e 100644 --- a/Source/CompareComplyV1/Models/UpdatedLabelsIn.swift +++ b/Source/CompareComplyV1/Models/UpdatedLabelsIn.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,13 @@ public struct UpdatedLabelsIn: Codable, Equatable { } /** - Initialize a `UpdatedLabelsIn` with member variables. + Initialize a `UpdatedLabelsIn` with member variables. - - parameter types: Description of the action specified by the element and whom it affects. - - parameter categories: List of functional categories into which the element falls; in other words, the subject - matter of the element. + - parameter types: Description of the action specified by the element and whom it affects. + - parameter categories: List of functional categories into which the element falls; in other words, the subject + matter of the element. - - returns: An initialized `UpdatedLabelsIn`. + - returns: An initialized `UpdatedLabelsIn`. */ public init( types: [TypeLabel], diff --git a/Source/CompareComplyV1/Models/UpdatedLabelsOut.swift b/Source/CompareComplyV1/Models/UpdatedLabelsOut.swift index dc3b00bcc..ab85a9a0a 100644 --- a/Source/CompareComplyV1/Models/UpdatedLabelsOut.swift +++ b/Source/CompareComplyV1/Models/UpdatedLabelsOut.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/CompareComplyV1/Models/Value.swift b/Source/CompareComplyV1/Models/Value.swift index fc923a7bc..563a69a89 100644 --- a/Source/CompareComplyV1/Models/Value.swift +++ b/Source/CompareComplyV1/Models/Value.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Discovery.swift b/Source/DiscoveryV1/Discovery.swift index 2dce3d4c2..d9d409943 100644 --- a/Source/DiscoveryV1/Discovery.swift +++ b/Source/DiscoveryV1/Discovery.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import IBMSwiftSDKCore public class Discovery { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/discovery/api" + public var serviceURL: String? = "https://api.us-south.discovery.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "Discovery" @@ -55,9 +55,11 @@ public class Discovery { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -83,8 +85,8 @@ public class Discovery { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() diff --git a/Source/DiscoveryV1/Models/AggregationResult.swift b/Source/DiscoveryV1/Models/AggregationResult.swift index 98da230f2..e60b5d8c6 100644 --- a/Source/DiscoveryV1/Models/AggregationResult.swift +++ b/Source/DiscoveryV1/Models/AggregationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,12 +43,4 @@ public struct AggregationResult: Codable, Equatable { case aggregations = "aggregations" } - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - if let keyAsString = try? container.decode(String.self, forKey: .key) { key = keyAsString } - if let keyAsInt = try? container.decode(Int.self, forKey: .key) { key = "\(keyAsInt)" } - matchingResults = try container.decodeIfPresent(Int.self, forKey: .matchingResults) - aggregations = try container.decodeIfPresent([QueryAggregation].self, forKey: .aggregations) - } - } diff --git a/Source/DiscoveryV1/Models/Calculation.swift b/Source/DiscoveryV1/Models/Calculation.swift index 181c26e0d..c5375bead 100644 --- a/Source/DiscoveryV1/Models/Calculation.swift +++ b/Source/DiscoveryV1/Models/Calculation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/CollQueryLarge.swift b/Source/DiscoveryV1/Models/CollQueryLarge.swift index 751755f1a..263c8512f 100644 --- a/Source/DiscoveryV1/Models/CollQueryLarge.swift +++ b/Source/DiscoveryV1/Models/CollQueryLarge.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -170,57 +170,57 @@ internal struct CollQueryLarge: Codable, Equatable { } /** - Initialize a `CollQueryLarge` with member variables. + Initialize a `CollQueryLarge` with member variables. - - parameter filter: A cacheable query that excludes documents that don't mention the query content. Filter - searches are better for metadata-type searches and for assessing the concepts in the data set. - - parameter query: A query search returns all documents in your data set with full enrichments and full text, - but with the most relevant documents listed first. Use a query search when you want to find the most relevant - search results. - - parameter naturalLanguageQuery: A natural language query that returns relevant documents by utilizing training - data and natural language understanding. - - parameter passages: A passages query that returns the most relevant passages from the results. - - parameter aggregation: An aggregation search that returns an exact answer by combining query search with - filters. Useful for applications to build lists, tables, and time series. For a full list of possible - aggregations, see the Query reference. - - parameter count: Number of results to return. - - parameter `return`: A comma-separated list of the portion of the document hierarchy to return. - - parameter offset: The number of query results to skip at the beginning. For example, if the total number of - results that are returned is 10 and the offset is 8, it returns the last two results. - - parameter sort: A comma-separated list of fields in the document to sort on. You can optionally specify a sort - direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the default sort - direction if no prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. - - parameter highlight: When true, a highlight field is returned for each result which contains the fields which - match the query with `` tags around the matching query terms. - - parameter passagesFields: A comma-separated list of fields that passages are drawn from. If this parameter not - specified, then all top-level fields are included. - - parameter passagesCount: The maximum number of passages to return. The search returns fewer passages if the - requested total is not found. The default is `10`. The maximum is `100`. - - parameter passagesCharacters: The approximate number of characters that any one passage will have. - - parameter deduplicate: When `true`, and used with a Watson Discovery News collection, duplicate results (based - on the contents of the **title** field) are removed. Duplicate comparison is limited to the current query only; - **offset** is not considered. This parameter is currently Beta functionality. - - parameter deduplicateField: When specified, duplicate results based on the field specified are removed from - the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. - This parameter is currently Beta functionality. - - parameter similar: When `true`, results are returned based on their similarity to the document IDs specified - in the **similar.document_ids** parameter. - - parameter similarDocumentIDs: A comma-separated list of document IDs to find similar documents. - **Tip:** Include the **natural_language_query** parameter to expand the scope of the document similarity search - with the natural language query. Other query parameters, such as **filter** and **query**, are subsequently - applied and reduce the scope. - - parameter similarFields: A comma-separated list of field names that are used as a basis for comparison to - identify similar documents. If not specified, the entire document is used for comparison. - - parameter bias: Field which the returned results will be biased against. The specified field must be either a - **date** or **number** format. When a **date** type field is specified returned results are biased towards field - values closer to the current date. When a **number** type field is specified, returned results are biased towards - higher field values. This parameter cannot be used in the same query as the **sort** parameter. - - parameter spellingSuggestions: When `true` and the **natural_language_query** parameter is used, the - **natural_languge_query** parameter is spell checked. The most likely correction is retunred in the - **suggested_query** field of the response (if one exists). - **Important:** this parameter is only valid when using the Cloud Pak version of Discovery. + - parameter filter: A cacheable query that excludes documents that don't mention the query content. Filter + searches are better for metadata-type searches and for assessing the concepts in the data set. + - parameter query: A query search returns all documents in your data set with full enrichments and full text, + but with the most relevant documents listed first. Use a query search when you want to find the most relevant + search results. + - parameter naturalLanguageQuery: A natural language query that returns relevant documents by utilizing training + data and natural language understanding. + - parameter passages: A passages query that returns the most relevant passages from the results. + - parameter aggregation: An aggregation search that returns an exact answer by combining query search with + filters. Useful for applications to build lists, tables, and time series. For a full list of possible + aggregations, see the Query reference. + - parameter count: Number of results to return. + - parameter `return`: A comma-separated list of the portion of the document hierarchy to return. + - parameter offset: The number of query results to skip at the beginning. For example, if the total number of + results that are returned is 10 and the offset is 8, it returns the last two results. + - parameter sort: A comma-separated list of fields in the document to sort on. You can optionally specify a sort + direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the default sort + direction if no prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. + - parameter highlight: When true, a highlight field is returned for each result which contains the fields which + match the query with `` tags around the matching query terms. + - parameter passagesFields: A comma-separated list of fields that passages are drawn from. If this parameter not + specified, then all top-level fields are included. + - parameter passagesCount: The maximum number of passages to return. The search returns fewer passages if the + requested total is not found. The default is `10`. The maximum is `100`. + - parameter passagesCharacters: The approximate number of characters that any one passage will have. + - parameter deduplicate: When `true`, and used with a Watson Discovery News collection, duplicate results (based + on the contents of the **title** field) are removed. Duplicate comparison is limited to the current query only; + **offset** is not considered. This parameter is currently Beta functionality. + - parameter deduplicateField: When specified, duplicate results based on the field specified are removed from + the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. + This parameter is currently Beta functionality. + - parameter similar: When `true`, results are returned based on their similarity to the document IDs specified + in the **similar.document_ids** parameter. + - parameter similarDocumentIDs: A comma-separated list of document IDs to find similar documents. + **Tip:** Include the **natural_language_query** parameter to expand the scope of the document similarity search + with the natural language query. Other query parameters, such as **filter** and **query**, are subsequently + applied and reduce the scope. + - parameter similarFields: A comma-separated list of field names that are used as a basis for comparison to + identify similar documents. If not specified, the entire document is used for comparison. + - parameter bias: Field which the returned results will be biased against. The specified field must be either a + **date** or **number** format. When a **date** type field is specified returned results are biased towards field + values closer to the current date. When a **number** type field is specified, returned results are biased towards + higher field values. This parameter cannot be used in the same query as the **sort** parameter. + - parameter spellingSuggestions: When `true` and the **natural_language_query** parameter is used, the + **natural_languge_query** parameter is spell checked. The most likely correction is retunred in the + **suggested_query** field of the response (if one exists). + **Important:** this parameter is only valid when using the Cloud Pak version of Discovery. - - returns: An initialized `CollQueryLarge`. + - returns: An initialized `CollQueryLarge`. */ public init( filter: String? = nil, diff --git a/Source/DiscoveryV1/Models/Collection.swift b/Source/DiscoveryV1/Models/Collection.swift index e961baa41..ace512a26 100644 --- a/Source/DiscoveryV1/Models/Collection.swift +++ b/Source/DiscoveryV1/Models/Collection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/CollectionCrawlStatus.swift b/Source/DiscoveryV1/Models/CollectionCrawlStatus.swift index 589dd0388..78bb04b99 100644 --- a/Source/DiscoveryV1/Models/CollectionCrawlStatus.swift +++ b/Source/DiscoveryV1/Models/CollectionCrawlStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/CollectionDiskUsage.swift b/Source/DiscoveryV1/Models/CollectionDiskUsage.swift index 0cfe30618..57f11288e 100644 --- a/Source/DiscoveryV1/Models/CollectionDiskUsage.swift +++ b/Source/DiscoveryV1/Models/CollectionDiskUsage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/CollectionUsage.swift b/Source/DiscoveryV1/Models/CollectionUsage.swift index c40b13689..aae60461a 100644 --- a/Source/DiscoveryV1/Models/CollectionUsage.swift +++ b/Source/DiscoveryV1/Models/CollectionUsage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/Completions.swift b/Source/DiscoveryV1/Models/Completions.swift index dd35db739..80c755b6d 100644 --- a/Source/DiscoveryV1/Models/Completions.swift +++ b/Source/DiscoveryV1/Models/Completions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/Configuration.swift b/Source/DiscoveryV1/Models/Configuration.swift index be05a2016..e89f3b71c 100644 --- a/Source/DiscoveryV1/Models/Configuration.swift +++ b/Source/DiscoveryV1/Models/Configuration.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,21 +81,21 @@ public struct Configuration: Codable, Equatable { } /** - Initialize a `Configuration` with member variables. - - - parameter name: The name of the configuration. - - parameter configurationID: The unique identifier of the configuration. - - parameter created: The creation date of the configuration in the format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. - - parameter updated: The timestamp of when the configuration was last updated in the format - yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. - - parameter description: The description of the configuration, if available. - - parameter conversions: Document conversion settings. - - parameter enrichments: An array of document enrichment settings for the configuration. - - parameter normalizations: Defines operations that can be used to transform the final output JSON into a - normalized form. Operations are executed in the order that they appear in the array. - - parameter source: Object containing source parameters for the configuration. - - - returns: An initialized `Configuration`. + Initialize a `Configuration` with member variables. + + - parameter name: The name of the configuration. + - parameter configurationID: The unique identifier of the configuration. + - parameter created: The creation date of the configuration in the format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. + - parameter updated: The timestamp of when the configuration was last updated in the format + yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. + - parameter description: The description of the configuration, if available. + - parameter conversions: Document conversion settings. + - parameter enrichments: An array of document enrichment settings for the configuration. + - parameter normalizations: Defines operations that can be used to transform the final output JSON into a + normalized form. Operations are executed in the order that they appear in the array. + - parameter source: Object containing source parameters for the configuration. + + - returns: An initialized `Configuration`. */ public init( name: String, diff --git a/Source/DiscoveryV1/Models/Conversions.swift b/Source/DiscoveryV1/Models/Conversions.swift index 3d5d8879d..cf940e9fb 100644 --- a/Source/DiscoveryV1/Models/Conversions.swift +++ b/Source/DiscoveryV1/Models/Conversions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,20 +66,20 @@ public struct Conversions: Codable, Equatable { } /** - Initialize a `Conversions` with member variables. + Initialize a `Conversions` with member variables. - - parameter pdf: A list of PDF conversion settings. - - parameter word: A list of Word conversion settings. - - parameter html: A list of HTML conversion settings. - - parameter segment: A list of Document Segmentation settings. - - parameter jsonNormalizations: Defines operations that can be used to transform the final output JSON into a - normalized form. Operations are executed in the order that they appear in the array. - - parameter imageTextRecognition: When `true`, automatic text extraction from images (this includes images - embedded in supported document formats, for example PDF, and suppported image formats, for example TIFF) is - performed on documents uploaded to the collection. This field is supported on **Advanced** and higher plans only. - **Lite** plans do not support image text recognition. + - parameter pdf: A list of PDF conversion settings. + - parameter word: A list of Word conversion settings. + - parameter html: A list of HTML conversion settings. + - parameter segment: A list of Document Segmentation settings. + - parameter jsonNormalizations: Defines operations that can be used to transform the final output JSON into a + normalized form. Operations are executed in the order that they appear in the array. + - parameter imageTextRecognition: When `true`, automatic text extraction from images (this includes images + embedded in supported document formats, for example PDF, and suppported image formats, for example TIFF) is + performed on documents uploaded to the collection. This field is supported on **Advanced** and higher plans only. + **Lite** plans do not support image text recognition. - - returns: An initialized `Conversions`. + - returns: An initialized `Conversions`. */ public init( pdf: PDFSettings? = nil, diff --git a/Source/DiscoveryV1/Models/CreateCollectionRequest.swift b/Source/DiscoveryV1/Models/CreateCollectionRequest.swift index 20153af8d..a7bc1b52e 100644 --- a/Source/DiscoveryV1/Models/CreateCollectionRequest.swift +++ b/Source/DiscoveryV1/Models/CreateCollectionRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,15 +67,15 @@ internal struct CreateCollectionRequest: Codable, Equatable { } /** - Initialize a `CreateCollectionRequest` with member variables. + Initialize a `CreateCollectionRequest` with member variables. - - parameter name: The name of the collection to be created. - - parameter description: A description of the collection. - - parameter configurationID: The ID of the configuration in which the collection is to be created. - - parameter language: The language of the documents stored in the collection, in the form of an ISO 639-1 - language code. + - parameter name: The name of the collection to be created. + - parameter description: A description of the collection. + - parameter configurationID: The ID of the configuration in which the collection is to be created. + - parameter language: The language of the documents stored in the collection, in the form of an ISO 639-1 + language code. - - returns: An initialized `CreateCollectionRequest`. + - returns: An initialized `CreateCollectionRequest`. */ public init( name: String, diff --git a/Source/DiscoveryV1/Models/CreateEnvironmentRequest.swift b/Source/DiscoveryV1/Models/CreateEnvironmentRequest.swift index 0329abeb3..45fa6cd8d 100644 --- a/Source/DiscoveryV1/Models/CreateEnvironmentRequest.swift +++ b/Source/DiscoveryV1/Models/CreateEnvironmentRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,14 +62,14 @@ internal struct CreateEnvironmentRequest: Codable, Equatable { } /** - Initialize a `CreateEnvironmentRequest` with member variables. + Initialize a `CreateEnvironmentRequest` with member variables. - - parameter name: Name that identifies the environment. - - parameter description: Description of the environment. - - parameter size: Size of the environment. In the Lite plan the default and only accepted value is `LT`, in all - other plans the default is `S`. + - parameter name: Name that identifies the environment. + - parameter description: Description of the environment. + - parameter size: Size of the environment. In the Lite plan the default and only accepted value is `LT`, in all + other plans the default is `S`. - - returns: An initialized `CreateEnvironmentRequest`. + - returns: An initialized `CreateEnvironmentRequest`. */ public init( name: String, diff --git a/Source/DiscoveryV1/Models/CreateEventObject.swift b/Source/DiscoveryV1/Models/CreateEventObject.swift index 228afd2db..09d14590a 100644 --- a/Source/DiscoveryV1/Models/CreateEventObject.swift +++ b/Source/DiscoveryV1/Models/CreateEventObject.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,12 +45,12 @@ internal struct CreateEventObject: Codable, Equatable { } /** - Initialize a `CreateEventObject` with member variables. + Initialize a `CreateEventObject` with member variables. - - parameter type: The event type to be created. - - parameter data: Query event data object. + - parameter type: The event type to be created. + - parameter data: Query event data object. - - returns: An initialized `CreateEventObject`. + - returns: An initialized `CreateEventObject`. */ public init( type: String, diff --git a/Source/DiscoveryV1/Models/CreateEventResponse.swift b/Source/DiscoveryV1/Models/CreateEventResponse.swift index a2ea7b618..a0c6b6472 100644 --- a/Source/DiscoveryV1/Models/CreateEventResponse.swift +++ b/Source/DiscoveryV1/Models/CreateEventResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/CredentialDetails.swift b/Source/DiscoveryV1/Models/CredentialDetails.swift index 7e2d8300f..c5970d5bf 100644 --- a/Source/DiscoveryV1/Models/CredentialDetails.swift +++ b/Source/DiscoveryV1/Models/CredentialDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -204,67 +204,67 @@ public struct CredentialDetails: Codable, Equatable { } /** - Initialize a `CredentialDetails` with member variables. + Initialize a `CredentialDetails` with member variables. - - parameter credentialType: The authentication method for this credentials definition. The **credential_type** - specified must be supported by the **source_type**. The following combinations are possible: - - `"source_type": "box"` - valid `credential_type`s: `oauth2` - - `"source_type": "salesforce"` - valid `credential_type`s: `username_password` - - `"source_type": "sharepoint"` - valid `credential_type`s: `saml` with **source_version** of `online`, or - `ntlm_v1` with **source_version** of `2016` - - `"source_type": "web_crawl"` - valid `credential_type`s: `noauth` or `basic` - - "source_type": "cloud_object_storage"` - valid `credential_type`s: `aws4_hmac`. - - parameter clientID: The **client_id** of the source that these credentials connect to. Only valid, and - required, with a **credential_type** of `oauth2`. - - parameter enterpriseID: The **enterprise_id** of the Box site that these credentials connect to. Only valid, - and required, with a **source_type** of `box`. - - parameter url: The **url** of the source that these credentials connect to. Only valid, and required, with a - **credential_type** of `username_password`, `noauth`, and `basic`. - - parameter username: The **username** of the source that these credentials connect to. Only valid, and - required, with a **credential_type** of `saml`, `username_password`, `basic`, or `ntlm_v1`. - - parameter organizationURL: The **organization_url** of the source that these credentials connect to. Only - valid, and required, with a **credential_type** of `saml`. - - parameter siteCollectionPath: The **site_collection.path** of the source that these credentials connect to. - Only valid, and required, with a **source_type** of `sharepoint`. - - parameter clientSecret: The **client_secret** of the source that these credentials connect to. Only valid, and - required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or - modifying **credentials**. - - parameter publicKeyID: The **public_key_id** of the source that these credentials connect to. Only valid, and - required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or - modifying **credentials**. - - parameter privateKey: The **private_key** of the source that these credentials connect to. Only valid, and - required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or - modifying **credentials**. - - parameter passphrase: The **passphrase** of the source that these credentials connect to. Only valid, and - required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or - modifying **credentials**. - - parameter password: The **password** of the source that these credentials connect to. Only valid, and - required, with **credential_type**s of `saml`, `username_password`, `basic`, or `ntlm_v1`. - **Note:** When used with a **source_type** of `salesforce`, the password consists of the Salesforce password and - a valid Salesforce security token concatenated. This value is never returned and is only used when creating or - modifying **credentials**. - - parameter gatewayID: The ID of the **gateway** to be connected through (when connecting to intranet sites). - Only valid with a **credential_type** of `noauth`, `basic`, or `ntlm_v1`. Gateways are created using the - `/v1/environments/{environment_id}/gateways` methods. - - parameter sourceVersion: The type of Sharepoint repository to connect to. Only valid, and required, with a - **source_type** of `sharepoint`. - - parameter webApplicationURL: SharePoint OnPrem WebApplication URL. Only valid, and required, with a - **source_version** of `2016`. If a port is not supplied, the default to port `80` for http and port `443` for - https connections are used. - - parameter domain: The domain used to log in to your OnPrem SharePoint account. Only valid, and required, with - a **source_version** of `2016`. - - parameter endpoint: The endpoint associated with the cloud object store that your are connecting to. Only - valid, and required, with a **credential_type** of `aws4_hmac`. - - parameter accessKeyID: 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/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). - - parameter secretAccessKey: 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/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). + - parameter credentialType: The authentication method for this credentials definition. The **credential_type** + specified must be supported by the **source_type**. The following combinations are possible: + - `"source_type": "box"` - valid `credential_type`s: `oauth2` + - `"source_type": "salesforce"` - valid `credential_type`s: `username_password` + - `"source_type": "sharepoint"` - valid `credential_type`s: `saml` with **source_version** of `online`, or + `ntlm_v1` with **source_version** of `2016` + - `"source_type": "web_crawl"` - valid `credential_type`s: `noauth` or `basic` + - "source_type": "cloud_object_storage"` - valid `credential_type`s: `aws4_hmac`. + - parameter clientID: The **client_id** of the source that these credentials connect to. Only valid, and + required, with a **credential_type** of `oauth2`. + - parameter enterpriseID: The **enterprise_id** of the Box site that these credentials connect to. Only valid, + and required, with a **source_type** of `box`. + - parameter url: The **url** of the source that these credentials connect to. Only valid, and required, with a + **credential_type** of `username_password`, `noauth`, and `basic`. + - parameter username: The **username** of the source that these credentials connect to. Only valid, and + required, with a **credential_type** of `saml`, `username_password`, `basic`, or `ntlm_v1`. + - parameter organizationURL: The **organization_url** of the source that these credentials connect to. Only + valid, and required, with a **credential_type** of `saml`. + - parameter siteCollectionPath: The **site_collection.path** of the source that these credentials connect to. + Only valid, and required, with a **source_type** of `sharepoint`. + - parameter clientSecret: The **client_secret** of the source that these credentials connect to. Only valid, and + required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or + modifying **credentials**. + - parameter publicKeyID: The **public_key_id** of the source that these credentials connect to. Only valid, and + required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or + modifying **credentials**. + - parameter privateKey: The **private_key** of the source that these credentials connect to. Only valid, and + required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or + modifying **credentials**. + - parameter passphrase: The **passphrase** of the source that these credentials connect to. Only valid, and + required, with a **credential_type** of `oauth2`. This value is never returned and is only used when creating or + modifying **credentials**. + - parameter password: The **password** of the source that these credentials connect to. Only valid, and + required, with **credential_type**s of `saml`, `username_password`, `basic`, or `ntlm_v1`. + **Note:** When used with a **source_type** of `salesforce`, the password consists of the Salesforce password and + a valid Salesforce security token concatenated. This value is never returned and is only used when creating or + modifying **credentials**. + - parameter gatewayID: The ID of the **gateway** to be connected through (when connecting to intranet sites). + Only valid with a **credential_type** of `noauth`, `basic`, or `ntlm_v1`. Gateways are created using the + `/v1/environments/{environment_id}/gateways` methods. + - parameter sourceVersion: The type of Sharepoint repository to connect to. Only valid, and required, with a + **source_type** of `sharepoint`. + - parameter webApplicationURL: SharePoint OnPrem WebApplication URL. Only valid, and required, with a + **source_version** of `2016`. If a port is not supplied, the default to port `80` for http and port `443` for + https connections are used. + - parameter domain: The domain used to log in to your OnPrem SharePoint account. Only valid, and required, with + a **source_version** of `2016`. + - parameter endpoint: The endpoint associated with the cloud object store that your are connecting to. Only + valid, and required, with a **credential_type** of `aws4_hmac`. + - parameter accessKeyID: 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/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). + - parameter secretAccessKey: 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/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). - - returns: An initialized `CredentialDetails`. + - returns: An initialized `CredentialDetails`. */ public init( credentialType: String? = nil, diff --git a/Source/DiscoveryV1/Models/Credentials.swift b/Source/DiscoveryV1/Models/Credentials.swift index 5ad8c7155..86ea29361 100644 --- a/Source/DiscoveryV1/Models/Credentials.swift +++ b/Source/DiscoveryV1/Models/Credentials.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,22 +84,22 @@ public struct Credentials: Codable, Equatable { } /** - Initialize a `Credentials` with member variables. + Initialize a `Credentials` with member variables. - - parameter credentialID: Unique identifier for this set of credentials. - - parameter sourceType: The source that this credentials object connects to. - - `box` indicates the credentials are used to connect an instance of Enterprise Box. - - `salesforce` indicates the credentials are used to connect to Salesforce. - - `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online. - - `web_crawl` indicates the credentials are used to perform a web crawl. - = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud Object Store. - - parameter credentialDetails: Object containing details of the stored credentials. - Obtain credentials for your source from the administrator of the source. - - parameter status: The current status of this set of credentials. `connected` indicates that the credentials - are available to use with the source configuration of a collection. `invalid` refers to the credentials (for - example, the password provided has expired) and must be corrected before they can be used with a collection. + - parameter credentialID: Unique identifier for this set of credentials. + - parameter sourceType: The source that this credentials object connects to. + - `box` indicates the credentials are used to connect an instance of Enterprise Box. + - `salesforce` indicates the credentials are used to connect to Salesforce. + - `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online. + - `web_crawl` indicates the credentials are used to perform a web crawl. + = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud Object Store. + - parameter credentialDetails: Object containing details of the stored credentials. + Obtain credentials for your source from the administrator of the source. + - parameter status: The current status of this set of credentials. `connected` indicates that the credentials + are available to use with the source configuration of a collection. `invalid` refers to the credentials (for + example, the password provided has expired) and must be corrected before they can be used with a collection. - - returns: An initialized `Credentials`. + - returns: An initialized `Credentials`. */ public init( credentialID: String? = nil, diff --git a/Source/DiscoveryV1/Models/CredentialsList.swift b/Source/DiscoveryV1/Models/CredentialsList.swift index 294a15ac1..3be1fe71a 100644 --- a/Source/DiscoveryV1/Models/CredentialsList.swift +++ b/Source/DiscoveryV1/Models/CredentialsList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DeleteCollectionResponse.swift b/Source/DiscoveryV1/Models/DeleteCollectionResponse.swift index 21bf7eae4..ec0626102 100644 --- a/Source/DiscoveryV1/Models/DeleteCollectionResponse.swift +++ b/Source/DiscoveryV1/Models/DeleteCollectionResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DeleteConfigurationResponse.swift b/Source/DiscoveryV1/Models/DeleteConfigurationResponse.swift index db31cc063..b399d263f 100644 --- a/Source/DiscoveryV1/Models/DeleteConfigurationResponse.swift +++ b/Source/DiscoveryV1/Models/DeleteConfigurationResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DeleteCredentials.swift b/Source/DiscoveryV1/Models/DeleteCredentials.swift index 46ebf2354..e0128ac32 100644 --- a/Source/DiscoveryV1/Models/DeleteCredentials.swift +++ b/Source/DiscoveryV1/Models/DeleteCredentials.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DeleteDocumentResponse.swift b/Source/DiscoveryV1/Models/DeleteDocumentResponse.swift index 167b7abcf..4ba59cec3 100644 --- a/Source/DiscoveryV1/Models/DeleteDocumentResponse.swift +++ b/Source/DiscoveryV1/Models/DeleteDocumentResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DeleteEnvironmentResponse.swift b/Source/DiscoveryV1/Models/DeleteEnvironmentResponse.swift index 033f6e845..eca6eca4c 100644 --- a/Source/DiscoveryV1/Models/DeleteEnvironmentResponse.swift +++ b/Source/DiscoveryV1/Models/DeleteEnvironmentResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DiskUsage.swift b/Source/DiscoveryV1/Models/DiskUsage.swift index 9be24a14f..f50e0137a 100644 --- a/Source/DiscoveryV1/Models/DiskUsage.swift +++ b/Source/DiscoveryV1/Models/DiskUsage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DocumentAccepted.swift b/Source/DiscoveryV1/Models/DocumentAccepted.swift index 596fa746a..a42b7e1e6 100644 --- a/Source/DiscoveryV1/Models/DocumentAccepted.swift +++ b/Source/DiscoveryV1/Models/DocumentAccepted.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DocumentCounts.swift b/Source/DiscoveryV1/Models/DocumentCounts.swift index 17b00ae23..7829483d6 100644 --- a/Source/DiscoveryV1/Models/DocumentCounts.swift +++ b/Source/DiscoveryV1/Models/DocumentCounts.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/DocumentStatus.swift b/Source/DiscoveryV1/Models/DocumentStatus.swift index 6afb4214d..2c35cba47 100644 --- a/Source/DiscoveryV1/Models/DocumentStatus.swift +++ b/Source/DiscoveryV1/Models/DocumentStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/Enrichment.swift b/Source/DiscoveryV1/Models/Enrichment.swift index 06047c448..9924b3434 100644 --- a/Source/DiscoveryV1/Models/Enrichment.swift +++ b/Source/DiscoveryV1/Models/Enrichment.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,30 +80,30 @@ public struct Enrichment: Codable, Equatable { } /** - Initialize a `Enrichment` with member variables. + Initialize a `Enrichment` with member variables. - - parameter destinationField: Field where enrichments will be stored. This field must already exist or be at - most 1 level deeper than an existing field. For example, if `text` is a top-level field with no sub-fields, - `text.foo` is a valid destination but `text.foo.bar` is not. - - parameter sourceField: Field to be enriched. - Arrays can be specified as the **source_field** if the **enrichment** service for this enrichment is set to - `natural_language_undstanding`. - - parameter enrichment: Name of the enrichment service to call. Current options are - `natural_language_understanding` and `elements`. - When using `natual_language_understanding`, the **options** object must contain Natural Language Understanding - options. - 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/discovery?topic=discovery-element-classification#element-classification). - - parameter description: Describes what the enrichment step does. - - parameter overwrite: Indicates that the enrichments will overwrite the destination_field field if it already - exists. - - parameter ignoreDownstreamErrors: If true, then most errors generated during the enrichment process will be - treated as warnings and will not cause the document to fail processing. - - parameter options: Options which are specific to a particular enrichment. + - parameter destinationField: Field where enrichments will be stored. This field must already exist or be at + most 1 level deeper than an existing field. For example, if `text` is a top-level field with no sub-fields, + `text.foo` is a valid destination but `text.foo.bar` is not. + - parameter sourceField: Field to be enriched. + Arrays can be specified as the **source_field** if the **enrichment** service for this enrichment is set to + `natural_language_undstanding`. + - parameter enrichment: Name of the enrichment service to call. Current options are + `natural_language_understanding` and `elements`. + When using `natual_language_understanding`, the **options** object must contain Natural Language Understanding + options. + 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/discovery?topic=discovery-element-classification#element-classification). + - parameter description: Describes what the enrichment step does. + - parameter overwrite: Indicates that the enrichments will overwrite the destination_field field if it already + exists. + - parameter ignoreDownstreamErrors: If true, then most errors generated during the enrichment process will be + treated as warnings and will not cause the document to fail processing. + - parameter options: Options which are specific to a particular enrichment. - - returns: An initialized `Enrichment`. + - returns: An initialized `Enrichment`. */ public init( destinationField: String, diff --git a/Source/DiscoveryV1/Models/EnrichmentOptions.swift b/Source/DiscoveryV1/Models/EnrichmentOptions.swift index 241489a09..699ccceb7 100644 --- a/Source/DiscoveryV1/Models/EnrichmentOptions.swift +++ b/Source/DiscoveryV1/Models/EnrichmentOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,17 +65,17 @@ public struct EnrichmentOptions: Codable, Equatable { } /** - Initialize a `EnrichmentOptions` with member variables. + Initialize a `EnrichmentOptions` with member variables. - - parameter features: Object containing Natural Language Understanding features to be used. - - parameter language: ISO 639-1 code indicating the language to use for the analysis. This code overrides the - automatic language detection performed by the service. Valid codes are `ar` (Arabic), `en` (English), `fr` - (French), `de` (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), `es` (Spanish), and `sv` (Swedish). - **Note:** Not all features support all languages, automatic detection is recommended. - - parameter model: *For use with `elements` enrichments only.* The element extraction model to use. Models - available are: `contract`. + - parameter features: Object containing Natural Language Understanding features to be used. + - parameter language: ISO 639-1 code indicating the language to use for the analysis. This code overrides the + automatic language detection performed by the service. Valid codes are `ar` (Arabic), `en` (English), `fr` + (French), `de` (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), `es` (Spanish), and `sv` (Swedish). + **Note:** Not all features support all languages, automatic detection is recommended. + - parameter model: *For use with `elements` enrichments only.* The element extraction model to use. Models + available are: `contract`. - - returns: An initialized `EnrichmentOptions`. + - returns: An initialized `EnrichmentOptions`. */ public init( features: NluEnrichmentFeatures? = nil, diff --git a/Source/DiscoveryV1/Models/Environment.swift b/Source/DiscoveryV1/Models/Environment.swift index 4fa378c19..a9d85e136 100644 --- a/Source/DiscoveryV1/Models/Environment.swift +++ b/Source/DiscoveryV1/Models/Environment.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/EnvironmentDocuments.swift b/Source/DiscoveryV1/Models/EnvironmentDocuments.swift index 0114cf9ba..19df2856a 100644 --- a/Source/DiscoveryV1/Models/EnvironmentDocuments.swift +++ b/Source/DiscoveryV1/Models/EnvironmentDocuments.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/EventData.swift b/Source/DiscoveryV1/Models/EventData.swift index 8e9c4df83..85a922054 100644 --- a/Source/DiscoveryV1/Models/EventData.swift +++ b/Source/DiscoveryV1/Models/EventData.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,20 +70,20 @@ public struct EventData: Codable, Equatable { } /** - Initialize a `EventData` with member variables. + Initialize a `EventData` with member variables. - - parameter environmentID: The **environment_id** associated with the query that the event is associated with. - - parameter sessionToken: The session token that was returned as part of the query results that this event is - associated with. - - parameter collectionID: The **collection_id** of the document that this event is associated with. - - parameter documentID: The **document_id** of the document that this event is associated with. - - parameter clientTimestamp: The optional timestamp for the event that was created. If not provided, the time - that the event was created in the log was used. - - parameter displayRank: The rank of the result item which the event is associated with. - - parameter queryID: The query identifier stored in the log. The query and any events associated with that query - are stored with the same **query_id**. + - parameter environmentID: The **environment_id** associated with the query that the event is associated with. + - parameter sessionToken: The session token that was returned as part of the query results that this event is + associated with. + - parameter collectionID: The **collection_id** of the document that this event is associated with. + - parameter documentID: The **document_id** of the document that this event is associated with. + - parameter clientTimestamp: The optional timestamp for the event that was created. If not provided, the time + that the event was created in the log was used. + - parameter displayRank: The rank of the result item which the event is associated with. + - parameter queryID: The query identifier stored in the log. The query and any events associated with that query + are stored with the same **query_id**. - - returns: An initialized `EventData`. + - returns: An initialized `EventData`. */ public init( environmentID: String, diff --git a/Source/DiscoveryV1/Models/Expansion.swift b/Source/DiscoveryV1/Models/Expansion.swift index 4f934f8bb..cf117e2bb 100644 --- a/Source/DiscoveryV1/Models/Expansion.swift +++ b/Source/DiscoveryV1/Models/Expansion.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,14 +40,14 @@ public struct Expansion: Codable, Equatable { } /** - Initialize a `Expansion` with member variables. + Initialize a `Expansion` with member variables. - - parameter expandedTerms: A list of terms that this expansion will be expanded to. If specified without - **input_terms**, it also functions as the input term list. - - parameter inputTerms: A list of terms that will be expanded for this expansion. If specified, only the items - in this list are expanded. + - parameter expandedTerms: A list of terms that this expansion will be expanded to. If specified without + **input_terms**, it also functions as the input term list. + - parameter inputTerms: A list of terms that will be expanded for this expansion. If specified, only the items + in this list are expanded. - - returns: An initialized `Expansion`. + - returns: An initialized `Expansion`. */ public init( expandedTerms: [String], diff --git a/Source/DiscoveryV1/Models/Expansions.swift b/Source/DiscoveryV1/Models/Expansions.swift index 1dfdaa89b..c4eeb96f2 100644 --- a/Source/DiscoveryV1/Models/Expansions.swift +++ b/Source/DiscoveryV1/Models/Expansions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,20 +41,20 @@ public struct Expansions: Codable, Equatable { } /** - Initialize a `Expansions` with member variables. + Initialize a `Expansions` with member variables. - - parameter expansions: An array of query expansion definitions. - Each object in the **expansions** array represents a term or set of terms that will be expanded into other - terms. Each expansion object can be configured as bidirectional or unidirectional. Bidirectional means that all - terms are expanded to all other terms in the object. Unidirectional means that a set list of terms can be - expanded into a second list of terms. - To create a bi-directional expansion specify an **expanded_terms** array. When found in a query, all items in - the **expanded_terms** array are then expanded to the other items in the same array. - To create a uni-directional expansion, specify both an array of **input_terms** and an array of - **expanded_terms**. When items in the **input_terms** array are present in a query, they are expanded using the - items listed in the **expanded_terms** array. + - parameter expansions: An array of query expansion definitions. + Each object in the **expansions** array represents a term or set of terms that will be expanded into other + terms. Each expansion object can be configured as bidirectional or unidirectional. Bidirectional means that all + terms are expanded to all other terms in the object. Unidirectional means that a set list of terms can be + expanded into a second list of terms. + To create a bi-directional expansion specify an **expanded_terms** array. When found in a query, all items in + the **expanded_terms** array are then expanded to the other items in the same array. + To create a uni-directional expansion, specify both an array of **input_terms** and an array of + **expanded_terms**. When items in the **input_terms** array are present in a query, they are expanded using the + items listed in the **expanded_terms** array. - - returns: An initialized `Expansions`. + - returns: An initialized `Expansions`. */ public init( expansions: [Expansion] diff --git a/Source/DiscoveryV1/Models/FedQueryLarge.swift b/Source/DiscoveryV1/Models/FedQueryLarge.swift index 8dfbddda0..e8741ad09 100644 --- a/Source/DiscoveryV1/Models/FedQueryLarge.swift +++ b/Source/DiscoveryV1/Models/FedQueryLarge.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -168,54 +168,54 @@ internal struct FedQueryLarge: Codable, Equatable { } /** - Initialize a `FedQueryLarge` with member variables. + Initialize a `FedQueryLarge` with member variables. - - parameter collectionIDs: A comma-separated list of collection IDs to be queried against. - - parameter filter: A cacheable query that excludes documents that don't mention the query content. Filter - searches are better for metadata-type searches and for assessing the concepts in the data set. - - parameter query: A query search returns all documents in your data set with full enrichments and full text, - but with the most relevant documents listed first. Use a query search when you want to find the most relevant - search results. - - parameter naturalLanguageQuery: A natural language query that returns relevant documents by utilizing training - data and natural language understanding. - - parameter passages: A passages query that returns the most relevant passages from the results. - - parameter aggregation: An aggregation search that returns an exact answer by combining query search with - filters. Useful for applications to build lists, tables, and time series. For a full list of possible - aggregations, see the Query reference. - - parameter count: Number of results to return. - - parameter `return`: A comma-separated list of the portion of the document hierarchy to return. - - parameter offset: The number of query results to skip at the beginning. For example, if the total number of - results that are returned is 10 and the offset is 8, it returns the last two results. - - parameter sort: A comma-separated list of fields in the document to sort on. You can optionally specify a sort - direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the default sort - direction if no prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. - - parameter highlight: When true, a highlight field is returned for each result which contains the fields which - match the query with `` tags around the matching query terms. - - parameter passagesFields: A comma-separated list of fields that passages are drawn from. If this parameter not - specified, then all top-level fields are included. - - parameter passagesCount: The maximum number of passages to return. The search returns fewer passages if the - requested total is not found. The default is `10`. The maximum is `100`. - - parameter passagesCharacters: The approximate number of characters that any one passage will have. - - parameter deduplicate: When `true`, and used with a Watson Discovery News collection, duplicate results (based - on the contents of the **title** field) are removed. Duplicate comparison is limited to the current query only; - **offset** is not considered. This parameter is currently Beta functionality. - - parameter deduplicateField: When specified, duplicate results based on the field specified are removed from - the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. - This parameter is currently Beta functionality. - - parameter similar: When `true`, results are returned based on their similarity to the document IDs specified - in the **similar.document_ids** parameter. - - parameter similarDocumentIDs: A comma-separated list of document IDs to find similar documents. - **Tip:** Include the **natural_language_query** parameter to expand the scope of the document similarity search - with the natural language query. Other query parameters, such as **filter** and **query**, are subsequently - applied and reduce the scope. - - parameter similarFields: A comma-separated list of field names that are used as a basis for comparison to - identify similar documents. If not specified, the entire document is used for comparison. - - parameter bias: Field which the returned results will be biased against. The specified field must be either a - **date** or **number** format. When a **date** type field is specified returned results are biased towards field - values closer to the current date. When a **number** type field is specified, returned results are biased towards - higher field values. This parameter cannot be used in the same query as the **sort** parameter. + - parameter collectionIDs: A comma-separated list of collection IDs to be queried against. + - parameter filter: A cacheable query that excludes documents that don't mention the query content. Filter + searches are better for metadata-type searches and for assessing the concepts in the data set. + - parameter query: A query search returns all documents in your data set with full enrichments and full text, + but with the most relevant documents listed first. Use a query search when you want to find the most relevant + search results. + - parameter naturalLanguageQuery: A natural language query that returns relevant documents by utilizing training + data and natural language understanding. + - parameter passages: A passages query that returns the most relevant passages from the results. + - parameter aggregation: An aggregation search that returns an exact answer by combining query search with + filters. Useful for applications to build lists, tables, and time series. For a full list of possible + aggregations, see the Query reference. + - parameter count: Number of results to return. + - parameter `return`: A comma-separated list of the portion of the document hierarchy to return. + - parameter offset: The number of query results to skip at the beginning. For example, if the total number of + results that are returned is 10 and the offset is 8, it returns the last two results. + - parameter sort: A comma-separated list of fields in the document to sort on. You can optionally specify a sort + direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the default sort + direction if no prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. + - parameter highlight: When true, a highlight field is returned for each result which contains the fields which + match the query with `` tags around the matching query terms. + - parameter passagesFields: A comma-separated list of fields that passages are drawn from. If this parameter not + specified, then all top-level fields are included. + - parameter passagesCount: The maximum number of passages to return. The search returns fewer passages if the + requested total is not found. The default is `10`. The maximum is `100`. + - parameter passagesCharacters: The approximate number of characters that any one passage will have. + - parameter deduplicate: When `true`, and used with a Watson Discovery News collection, duplicate results (based + on the contents of the **title** field) are removed. Duplicate comparison is limited to the current query only; + **offset** is not considered. This parameter is currently Beta functionality. + - parameter deduplicateField: When specified, duplicate results based on the field specified are removed from + the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. + This parameter is currently Beta functionality. + - parameter similar: When `true`, results are returned based on their similarity to the document IDs specified + in the **similar.document_ids** parameter. + - parameter similarDocumentIDs: A comma-separated list of document IDs to find similar documents. + **Tip:** Include the **natural_language_query** parameter to expand the scope of the document similarity search + with the natural language query. Other query parameters, such as **filter** and **query**, are subsequently + applied and reduce the scope. + - parameter similarFields: A comma-separated list of field names that are used as a basis for comparison to + identify similar documents. If not specified, the entire document is used for comparison. + - parameter bias: Field which the returned results will be biased against. The specified field must be either a + **date** or **number** format. When a **date** type field is specified returned results are biased towards field + values closer to the current date. When a **number** type field is specified, returned results are biased towards + higher field values. This parameter cannot be used in the same query as the **sort** parameter. - - returns: An initialized `FedQueryLarge`. + - returns: An initialized `FedQueryLarge`. */ public init( collectionIDs: String, diff --git a/Source/DiscoveryV1/Models/Field.swift b/Source/DiscoveryV1/Models/Field.swift index 204311454..f0e5df51b 100644 --- a/Source/DiscoveryV1/Models/Field.swift +++ b/Source/DiscoveryV1/Models/Field.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/Filter.swift b/Source/DiscoveryV1/Models/Filter.swift index 4424cb53f..c62828f26 100644 --- a/Source/DiscoveryV1/Models/Filter.swift +++ b/Source/DiscoveryV1/Models/Filter.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/FontSetting.swift b/Source/DiscoveryV1/Models/FontSetting.swift index 240a8740c..6289e9970 100644 --- a/Source/DiscoveryV1/Models/FontSetting.swift +++ b/Source/DiscoveryV1/Models/FontSetting.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,16 +62,16 @@ public struct FontSetting: Codable, Equatable { } /** - Initialize a `FontSetting` with member variables. + Initialize a `FontSetting` with member variables. - - parameter level: The HTML heading level that any content with the matching font is converted to. - - parameter minSize: The minimum size of the font to match. - - parameter maxSize: The maximum size of the font to match. - - parameter bold: When `true`, the font is matched if it is bold. - - parameter italic: When `true`, the font is matched if it is italic. - - parameter name: The name of the font. + - parameter level: The HTML heading level that any content with the matching font is converted to. + - parameter minSize: The minimum size of the font to match. + - parameter maxSize: The maximum size of the font to match. + - parameter bold: When `true`, the font is matched if it is bold. + - parameter italic: When `true`, the font is matched if it is italic. + - parameter name: The name of the font. - - returns: An initialized `FontSetting`. + - returns: An initialized `FontSetting`. */ public init( level: Int? = nil, diff --git a/Source/DiscoveryV1/Models/Gateway.swift b/Source/DiscoveryV1/Models/Gateway.swift index 9ecd61727..6059b7ca1 100644 --- a/Source/DiscoveryV1/Models/Gateway.swift +++ b/Source/DiscoveryV1/Models/Gateway.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/GatewayDelete.swift b/Source/DiscoveryV1/Models/GatewayDelete.swift index 2e4cc33b7..c05f2f9c4 100644 --- a/Source/DiscoveryV1/Models/GatewayDelete.swift +++ b/Source/DiscoveryV1/Models/GatewayDelete.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/GatewayList.swift b/Source/DiscoveryV1/Models/GatewayList.swift index 6ccc10e4c..dc08efc84 100644 --- a/Source/DiscoveryV1/Models/GatewayList.swift +++ b/Source/DiscoveryV1/Models/GatewayList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/GatewayName.swift b/Source/DiscoveryV1/Models/GatewayName.swift index 8293a0668..1d51062d6 100644 --- a/Source/DiscoveryV1/Models/GatewayName.swift +++ b/Source/DiscoveryV1/Models/GatewayName.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ internal struct GatewayName: Codable, Equatable { } /** - Initialize a `GatewayName` with member variables. + Initialize a `GatewayName` with member variables. - - parameter name: User-defined name. + - parameter name: User-defined name. - - returns: An initialized `GatewayName`. + - returns: An initialized `GatewayName`. */ public init( name: String? = nil diff --git a/Source/DiscoveryV1/Models/HTMLSettings.swift b/Source/DiscoveryV1/Models/HTMLSettings.swift index bc4cf8e90..a8f71112e 100644 --- a/Source/DiscoveryV1/Models/HTMLSettings.swift +++ b/Source/DiscoveryV1/Models/HTMLSettings.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,16 +62,16 @@ public struct HTMLSettings: Codable, Equatable { } /** - Initialize a `HTMLSettings` with member variables. + Initialize a `HTMLSettings` with member variables. - - parameter excludeTagsCompletely: Array of HTML tags that are excluded completely. - - parameter excludeTagsKeepContent: Array of HTML tags which are excluded but still retain content. - - parameter keepContent: Object containing an array of XPaths. - - parameter excludeContent: Object containing an array of XPaths. - - parameter keepTagAttributes: An array of HTML tag attributes to keep in the converted document. - - parameter excludeTagAttributes: Array of HTML tag attributes to exclude. + - parameter excludeTagsCompletely: Array of HTML tags that are excluded completely. + - parameter excludeTagsKeepContent: Array of HTML tags which are excluded but still retain content. + - parameter keepContent: Object containing an array of XPaths. + - parameter excludeContent: Object containing an array of XPaths. + - parameter keepTagAttributes: An array of HTML tag attributes to keep in the converted document. + - parameter excludeTagAttributes: Array of HTML tag attributes to exclude. - - returns: An initialized `HTMLSettings`. + - returns: An initialized `HTMLSettings`. */ public init( excludeTagsCompletely: [String]? = nil, diff --git a/Source/DiscoveryV1/Models/Histogram.swift b/Source/DiscoveryV1/Models/Histogram.swift index ce0f58de4..ce28e7d9b 100644 --- a/Source/DiscoveryV1/Models/Histogram.swift +++ b/Source/DiscoveryV1/Models/Histogram.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/IndexCapacity.swift b/Source/DiscoveryV1/Models/IndexCapacity.swift index a6897b1d9..33bb0ac5e 100644 --- a/Source/DiscoveryV1/Models/IndexCapacity.swift +++ b/Source/DiscoveryV1/Models/IndexCapacity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/ListCollectionFieldsResponse.swift b/Source/DiscoveryV1/Models/ListCollectionFieldsResponse.swift index 1f8a71d6b..9f33f7dfd 100644 --- a/Source/DiscoveryV1/Models/ListCollectionFieldsResponse.swift +++ b/Source/DiscoveryV1/Models/ListCollectionFieldsResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/ListCollectionsResponse.swift b/Source/DiscoveryV1/Models/ListCollectionsResponse.swift index c15cd61b4..d00bf3b36 100644 --- a/Source/DiscoveryV1/Models/ListCollectionsResponse.swift +++ b/Source/DiscoveryV1/Models/ListCollectionsResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/ListConfigurationsResponse.swift b/Source/DiscoveryV1/Models/ListConfigurationsResponse.swift index 3e4639f5b..7b31d1514 100644 --- a/Source/DiscoveryV1/Models/ListConfigurationsResponse.swift +++ b/Source/DiscoveryV1/Models/ListConfigurationsResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/ListEnvironmentsResponse.swift b/Source/DiscoveryV1/Models/ListEnvironmentsResponse.swift index f8d8d1f40..1283e78f2 100644 --- a/Source/DiscoveryV1/Models/ListEnvironmentsResponse.swift +++ b/Source/DiscoveryV1/Models/ListEnvironmentsResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/LogQueryResponse.swift b/Source/DiscoveryV1/Models/LogQueryResponse.swift index f7947a866..7bbb8b9b9 100644 --- a/Source/DiscoveryV1/Models/LogQueryResponse.swift +++ b/Source/DiscoveryV1/Models/LogQueryResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/LogQueryResponseResult.swift b/Source/DiscoveryV1/Models/LogQueryResponseResult.swift index 696428d1c..6b2ff1ca9 100644 --- a/Source/DiscoveryV1/Models/LogQueryResponseResult.swift +++ b/Source/DiscoveryV1/Models/LogQueryResponseResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/LogQueryResponseResultDocuments.swift b/Source/DiscoveryV1/Models/LogQueryResponseResultDocuments.swift index e5d3e2b92..72d39f934 100644 --- a/Source/DiscoveryV1/Models/LogQueryResponseResultDocuments.swift +++ b/Source/DiscoveryV1/Models/LogQueryResponseResultDocuments.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/LogQueryResponseResultDocumentsResult.swift b/Source/DiscoveryV1/Models/LogQueryResponseResultDocumentsResult.swift index 5e8e9d679..ac6745507 100644 --- a/Source/DiscoveryV1/Models/LogQueryResponseResultDocumentsResult.swift +++ b/Source/DiscoveryV1/Models/LogQueryResponseResultDocumentsResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/MetricAggregation.swift b/Source/DiscoveryV1/Models/MetricAggregation.swift index ac9a51121..a414375c4 100644 --- a/Source/DiscoveryV1/Models/MetricAggregation.swift +++ b/Source/DiscoveryV1/Models/MetricAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/MetricAggregationResult.swift b/Source/DiscoveryV1/Models/MetricAggregationResult.swift index 719e0765a..7a0962a7b 100644 --- a/Source/DiscoveryV1/Models/MetricAggregationResult.swift +++ b/Source/DiscoveryV1/Models/MetricAggregationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/MetricResponse.swift b/Source/DiscoveryV1/Models/MetricResponse.swift index cdc5c4849..0367079d1 100644 --- a/Source/DiscoveryV1/Models/MetricResponse.swift +++ b/Source/DiscoveryV1/Models/MetricResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/MetricTokenAggregation.swift b/Source/DiscoveryV1/Models/MetricTokenAggregation.swift index e33e13e1c..886049baf 100644 --- a/Source/DiscoveryV1/Models/MetricTokenAggregation.swift +++ b/Source/DiscoveryV1/Models/MetricTokenAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/MetricTokenAggregationResult.swift b/Source/DiscoveryV1/Models/MetricTokenAggregationResult.swift index 2f6b83b38..04fe50b81 100644 --- a/Source/DiscoveryV1/Models/MetricTokenAggregationResult.swift +++ b/Source/DiscoveryV1/Models/MetricTokenAggregationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/MetricTokenResponse.swift b/Source/DiscoveryV1/Models/MetricTokenResponse.swift index cf8e449ca..5d2918106 100644 --- a/Source/DiscoveryV1/Models/MetricTokenResponse.swift +++ b/Source/DiscoveryV1/Models/MetricTokenResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/Nested.swift b/Source/DiscoveryV1/Models/Nested.swift index e30c554fc..957f9a29c 100644 --- a/Source/DiscoveryV1/Models/Nested.swift +++ b/Source/DiscoveryV1/Models/Nested.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/NewTrainingQuery.swift b/Source/DiscoveryV1/Models/NewTrainingQuery.swift index bc0caee8e..031340f59 100644 --- a/Source/DiscoveryV1/Models/NewTrainingQuery.swift +++ b/Source/DiscoveryV1/Models/NewTrainingQuery.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,13 +44,13 @@ internal struct NewTrainingQuery: Codable, Equatable { } /** - Initialize a `NewTrainingQuery` with member variables. + Initialize a `NewTrainingQuery` with member variables. - - parameter naturalLanguageQuery: The natural text query for the new training query. - - parameter filter: The filter used on the collection before the **natural_language_query** is applied. - - parameter examples: Array of training examples. + - parameter naturalLanguageQuery: The natural text query for the new training query. + - parameter filter: The filter used on the collection before the **natural_language_query** is applied. + - parameter examples: Array of training examples. - - returns: An initialized `NewTrainingQuery`. + - returns: An initialized `NewTrainingQuery`. */ public init( naturalLanguageQuery: String? = nil, diff --git a/Source/DiscoveryV1/Models/NluEnrichmentCategories.swift b/Source/DiscoveryV1/Models/NluEnrichmentCategories.swift index 714adc811..0ab5569f6 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentCategories.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentCategories.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ public struct NluEnrichmentCategories: Codable, Equatable { public var additionalProperties: [String: JSON] /** - Initialize a `NluEnrichmentCategories`. + Initialize a `NluEnrichmentCategories`. - - returns: An initialized `NluEnrichmentCategories`. + - returns: An initialized `NluEnrichmentCategories`. */ public init( additionalProperties: [String: JSON] = [:] diff --git a/Source/DiscoveryV1/Models/NluEnrichmentConcepts.swift b/Source/DiscoveryV1/Models/NluEnrichmentConcepts.swift index f33517668..90dfb3ab8 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentConcepts.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentConcepts.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,12 +32,12 @@ public struct NluEnrichmentConcepts: Codable, Equatable { } /** - Initialize a `NluEnrichmentConcepts` with member variables. + Initialize a `NluEnrichmentConcepts` with member variables. - - parameter limit: The maximum number of concepts enrichments to extact from each instance of the specified - field. + - parameter limit: The maximum number of concepts enrichments to extact from each instance of the specified + field. - - returns: An initialized `NluEnrichmentConcepts`. + - returns: An initialized `NluEnrichmentConcepts`. */ public init( limit: Int? = nil diff --git a/Source/DiscoveryV1/Models/NluEnrichmentEmotion.swift b/Source/DiscoveryV1/Models/NluEnrichmentEmotion.swift index a3e75567a..83fcb964d 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentEmotion.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentEmotion.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct NluEnrichmentEmotion: Codable, Equatable { } /** - Initialize a `NluEnrichmentEmotion` with member variables. + Initialize a `NluEnrichmentEmotion` with member variables. - - parameter document: When `true`, emotion detection is performed on the entire field. - - parameter targets: A comma-separated list of target strings that will have any associated emotions detected. + - parameter document: When `true`, emotion detection is performed on the entire field. + - parameter targets: A comma-separated list of target strings that will have any associated emotions detected. - - returns: An initialized `NluEnrichmentEmotion`. + - returns: An initialized `NluEnrichmentEmotion`. */ public init( document: Bool? = nil, diff --git a/Source/DiscoveryV1/Models/NluEnrichmentEntities.swift b/Source/DiscoveryV1/Models/NluEnrichmentEntities.swift index 5688a0500..49b821534 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentEntities.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentEntities.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,21 +70,21 @@ public struct NluEnrichmentEntities: Codable, Equatable { } /** - Initialize a `NluEnrichmentEntities` with member variables. + Initialize a `NluEnrichmentEntities` with member variables. - - parameter sentiment: When `true`, sentiment analysis of entities will be performed on the specified field. - - parameter emotion: When `true`, emotion detection of entities will be performed on the specified field. - - parameter limit: The maximum number of entities to extract for each instance of the specified field. - - parameter mentions: When `true`, the number of mentions of each identified entity is recorded. The default is - `false`. - - parameter mentionTypes: When `true`, the types of mentions for each idetifieid entity is recorded. The default - is `false`. - - parameter sentenceLocations: When `true`, a list of sentence locations for each instance of each identified - entity is recorded. The default is `false`. - - parameter model: The enrichement model to use with entity extraction. May be a custom model provided by Watson - Knowledge Studio, or the default public model `alchemy`. + - parameter sentiment: When `true`, sentiment analysis of entities will be performed on the specified field. + - parameter emotion: When `true`, emotion detection of entities will be performed on the specified field. + - parameter limit: The maximum number of entities to extract for each instance of the specified field. + - parameter mentions: When `true`, the number of mentions of each identified entity is recorded. The default is + `false`. + - parameter mentionTypes: When `true`, the types of mentions for each idetifieid entity is recorded. The default + is `false`. + - parameter sentenceLocations: When `true`, a list of sentence locations for each instance of each identified + entity is recorded. The default is `false`. + - parameter model: The enrichement model to use with entity extraction. May be a custom model provided by Watson + Knowledge Studio, or the default public model `alchemy`. - - returns: An initialized `NluEnrichmentEntities`. + - returns: An initialized `NluEnrichmentEntities`. */ public init( sentiment: Bool? = nil, diff --git a/Source/DiscoveryV1/Models/NluEnrichmentFeatures.swift b/Source/DiscoveryV1/Models/NluEnrichmentFeatures.swift index 0d7034990..86951388d 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentFeatures.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentFeatures.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,19 +74,19 @@ public struct NluEnrichmentFeatures: Codable, Equatable { } /** - Initialize a `NluEnrichmentFeatures` with member variables. + Initialize a `NluEnrichmentFeatures` with member variables. - - parameter keywords: An object specifying the Keyword enrichment and related parameters. - - parameter entities: An object speficying the Entities enrichment and related parameters. - - parameter sentiment: An object specifying the sentiment extraction enrichment and related parameters. - - parameter emotion: An object specifying the emotion detection enrichment and related parameters. - - parameter categories: An object that indicates the Categories enrichment will be applied to the specified - field. - - parameter semanticRoles: An object specifiying the semantic roles enrichment and related parameters. - - parameter relations: An object specifying the relations enrichment and related parameters. - - parameter concepts: An object specifiying the concepts enrichment and related parameters. + - parameter keywords: An object specifying the Keyword enrichment and related parameters. + - parameter entities: An object speficying the Entities enrichment and related parameters. + - parameter sentiment: An object specifying the sentiment extraction enrichment and related parameters. + - parameter emotion: An object specifying the emotion detection enrichment and related parameters. + - parameter categories: An object that indicates the Categories enrichment will be applied to the specified + field. + - parameter semanticRoles: An object specifiying the semantic roles enrichment and related parameters. + - parameter relations: An object specifying the relations enrichment and related parameters. + - parameter concepts: An object specifiying the concepts enrichment and related parameters. - - returns: An initialized `NluEnrichmentFeatures`. + - returns: An initialized `NluEnrichmentFeatures`. */ public init( keywords: NluEnrichmentKeywords? = nil, diff --git a/Source/DiscoveryV1/Models/NluEnrichmentKeywords.swift b/Source/DiscoveryV1/Models/NluEnrichmentKeywords.swift index 18fe57c8b..2385c8922 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentKeywords.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentKeywords.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,13 +44,13 @@ public struct NluEnrichmentKeywords: Codable, Equatable { } /** - Initialize a `NluEnrichmentKeywords` with member variables. + Initialize a `NluEnrichmentKeywords` with member variables. - - parameter sentiment: When `true`, sentiment analysis of keywords will be performed on the specified field. - - parameter emotion: When `true`, emotion detection of keywords will be performed on the specified field. - - parameter limit: The maximum number of keywords to extract for each instance of the specified field. + - parameter sentiment: When `true`, sentiment analysis of keywords will be performed on the specified field. + - parameter emotion: When `true`, emotion detection of keywords will be performed on the specified field. + - parameter limit: The maximum number of keywords to extract for each instance of the specified field. - - returns: An initialized `NluEnrichmentKeywords`. + - returns: An initialized `NluEnrichmentKeywords`. */ public init( sentiment: Bool? = nil, diff --git a/Source/DiscoveryV1/Models/NluEnrichmentRelations.swift b/Source/DiscoveryV1/Models/NluEnrichmentRelations.swift index 5a02e83e1..daadaf1b4 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentRelations.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentRelations.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,13 +33,13 @@ public struct NluEnrichmentRelations: Codable, Equatable { } /** - Initialize a `NluEnrichmentRelations` with member variables. + Initialize a `NluEnrichmentRelations` with member variables. - - parameter model: *For use with `natural_language_understanding` enrichments only.* The enrichement model to - use with relationship extraction. May be a custom model provided by Watson Knowledge Studio, the default public - model is`en-news`. + - parameter model: *For use with `natural_language_understanding` enrichments only.* The enrichement model to + use with relationship extraction. May be a custom model provided by Watson Knowledge Studio, the default public + model is`en-news`. - - returns: An initialized `NluEnrichmentRelations`. + - returns: An initialized `NluEnrichmentRelations`. */ public init( model: String? = nil diff --git a/Source/DiscoveryV1/Models/NluEnrichmentSemanticRoles.swift b/Source/DiscoveryV1/Models/NluEnrichmentSemanticRoles.swift index 5b901d005..39c071bdf 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentSemanticRoles.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentSemanticRoles.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,14 +44,14 @@ public struct NluEnrichmentSemanticRoles: Codable, Equatable { } /** - Initialize a `NluEnrichmentSemanticRoles` with member variables. + Initialize a `NluEnrichmentSemanticRoles` with member variables. - - parameter entities: When `true`, entities are extracted from the identified sentence parts. - - parameter keywords: When `true`, keywords are extracted from the identified sentence parts. - - parameter limit: The maximum number of semantic roles enrichments to extact from each instance of the - specified field. + - parameter entities: When `true`, entities are extracted from the identified sentence parts. + - parameter keywords: When `true`, keywords are extracted from the identified sentence parts. + - parameter limit: The maximum number of semantic roles enrichments to extact from each instance of the + specified field. - - returns: An initialized `NluEnrichmentSemanticRoles`. + - returns: An initialized `NluEnrichmentSemanticRoles`. */ public init( entities: Bool? = nil, diff --git a/Source/DiscoveryV1/Models/NluEnrichmentSentiment.swift b/Source/DiscoveryV1/Models/NluEnrichmentSentiment.swift index 79902faa6..46786a14a 100644 --- a/Source/DiscoveryV1/Models/NluEnrichmentSentiment.swift +++ b/Source/DiscoveryV1/Models/NluEnrichmentSentiment.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct NluEnrichmentSentiment: Codable, Equatable { } /** - Initialize a `NluEnrichmentSentiment` with member variables. + Initialize a `NluEnrichmentSentiment` with member variables. - - parameter document: When `true`, sentiment analysis is performed on the entire field. - - parameter targets: A comma-separated list of target strings that will have any associated sentiment analyzed. + - parameter document: When `true`, sentiment analysis is performed on the entire field. + - parameter targets: A comma-separated list of target strings that will have any associated sentiment analyzed. - - returns: An initialized `NluEnrichmentSentiment`. + - returns: An initialized `NluEnrichmentSentiment`. */ public init( document: Bool? = nil, diff --git a/Source/DiscoveryV1/Models/NormalizationOperation.swift b/Source/DiscoveryV1/Models/NormalizationOperation.swift index a4884b6bb..b6e778d72 100644 --- a/Source/DiscoveryV1/Models/NormalizationOperation.swift +++ b/Source/DiscoveryV1/Models/NormalizationOperation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -91,31 +91,31 @@ public struct NormalizationOperation: Codable, Equatable { } /** - Initialize a `NormalizationOperation` with member variables. + Initialize a `NormalizationOperation` with member variables. - - parameter operation: Identifies what type of operation to perform. - **copy** - Copies the value of the **source_field** to the **destination_field** field. If the - **destination_field** already exists, then the value of the **source_field** overwrites the original value of the - **destination_field**. - **move** - Renames (moves) the **source_field** to the **destination_field**. If the **destination_field** - already exists, then the value of the **source_field** overwrites the original value of the - **destination_field**. Rename is identical to copy, except that the **source_field** is removed after the value - has been copied to the **destination_field** (it is the same as a _copy_ followed by a _remove_). - **merge** - Merges the value of the **source_field** with the value of the **destination_field**. The - **destination_field** is converted into an array if it is not already an array, and the value of the - **source_field** is appended to the array. This operation removes the **source_field** after the merge. If the - **source_field** does not exist in the current document, then the **destination_field** is still converted into - an array (if it is not an array already). This conversion ensures the type for **destination_field** is - consistent across all documents. - **remove** - Deletes the **source_field** field. The **destination_field** is ignored for this operation. - **remove_nulls** - Removes all nested null (blank) field values from the ingested document. **source_field** and - **destination_field** are ignored by this operation because _remove_nulls_ operates on the entire ingested - document. Typically, **remove_nulls** is invoked as the last normalization operation (if it is invoked at all, it - can be time-expensive). - - parameter sourceField: The source field for the operation. - - parameter destinationField: The destination field for the operation. + - parameter operation: Identifies what type of operation to perform. + **copy** - Copies the value of the **source_field** to the **destination_field** field. If the + **destination_field** already exists, then the value of the **source_field** overwrites the original value of the + **destination_field**. + **move** - Renames (moves) the **source_field** to the **destination_field**. If the **destination_field** + already exists, then the value of the **source_field** overwrites the original value of the + **destination_field**. Rename is identical to copy, except that the **source_field** is removed after the value + has been copied to the **destination_field** (it is the same as a _copy_ followed by a _remove_). + **merge** - Merges the value of the **source_field** with the value of the **destination_field**. The + **destination_field** is converted into an array if it is not already an array, and the value of the + **source_field** is appended to the array. This operation removes the **source_field** after the merge. If the + **source_field** does not exist in the current document, then the **destination_field** is still converted into + an array (if it is not an array already). This conversion ensures the type for **destination_field** is + consistent across all documents. + **remove** - Deletes the **source_field** field. The **destination_field** is ignored for this operation. + **remove_nulls** - Removes all nested null (blank) field values from the ingested document. **source_field** and + **destination_field** are ignored by this operation because _remove_nulls_ operates on the entire ingested + document. Typically, **remove_nulls** is invoked as the last normalization operation (if it is invoked at all, it + can be time-expensive). + - parameter sourceField: The source field for the operation. + - parameter destinationField: The destination field for the operation. - - returns: An initialized `NormalizationOperation`. + - returns: An initialized `NormalizationOperation`. */ public init( operation: String? = nil, diff --git a/Source/DiscoveryV1/Models/Notice.swift b/Source/DiscoveryV1/Models/Notice.swift index 528758a49..d321c1b73 100644 --- a/Source/DiscoveryV1/Models/Notice.swift +++ b/Source/DiscoveryV1/Models/Notice.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/PDFHeadingDetection.swift b/Source/DiscoveryV1/Models/PDFHeadingDetection.swift index da75dcb86..fdb035406 100644 --- a/Source/DiscoveryV1/Models/PDFHeadingDetection.swift +++ b/Source/DiscoveryV1/Models/PDFHeadingDetection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct PDFHeadingDetection: Codable, Equatable { } /** - Initialize a `PDFHeadingDetection` with member variables. + Initialize a `PDFHeadingDetection` with member variables. - - parameter fonts: Array of font matching configurations. + - parameter fonts: Array of font matching configurations. - - returns: An initialized `PDFHeadingDetection`. + - returns: An initialized `PDFHeadingDetection`. */ public init( fonts: [FontSetting]? = nil diff --git a/Source/DiscoveryV1/Models/PDFSettings.swift b/Source/DiscoveryV1/Models/PDFSettings.swift index 894e0fe46..df499037b 100644 --- a/Source/DiscoveryV1/Models/PDFSettings.swift +++ b/Source/DiscoveryV1/Models/PDFSettings.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct PDFSettings: Codable, Equatable { } /** - Initialize a `PDFSettings` with member variables. + Initialize a `PDFSettings` with member variables. - - parameter heading: Object containing heading detection conversion settings for PDF documents. + - parameter heading: Object containing heading detection conversion settings for PDF documents. - - returns: An initialized `PDFSettings`. + - returns: An initialized `PDFSettings`. */ public init( heading: PDFHeadingDetection? = nil diff --git a/Source/DiscoveryV1/Models/QueryAggregation.swift b/Source/DiscoveryV1/Models/QueryAggregation.swift index 2794f53a8..5f88c5081 100644 --- a/Source/DiscoveryV1/Models/QueryAggregation.swift +++ b/Source/DiscoveryV1/Models/QueryAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,91 +16,37 @@ import Foundation -/** An aggregation produced by the Discovery service to analyze the input provided. */ -public enum QueryAggregation: Codable, Equatable { - - // reference: https://cloud.ibm.com/docs/services/discovery/query-reference.html#aggregations - - case term(Term) - case filter(Filter) - case nested(Nested) - case histogram(Histogram) - case timeslice(Timeslice) - case topHits(TopHits) - case uniqueCount(Calculation) - case max(Calculation) - case min(Calculation) - case average(Calculation) - case sum(Calculation) - case generic(GenericQueryAggregation) - +/** + An aggregation produced by Discovery to analyze the input provided. + */ +public struct QueryAggregation: Codable, Equatable { + + /** + The type of aggregation command used. For example: term, filter, max, min, etc. + */ + public var type: String? + + /** + Array of aggregation results. + */ + public var results: [AggregationResult]? + + /** + Number of matching results. + */ + public var matchingResults: Int? + + /** + Aggregations returned by Discovery. + */ + public var aggregations: [QueryAggregation]? + + // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { case type = "type" - } - - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - guard let type = try container.decodeIfPresent(String.self, forKey: .type) else { - // the specification does not identify `type` as a required field, - // so we need a generic catch-all in case it is not present - self = .generic(try GenericQueryAggregation(from: decoder)) - return - } - switch type { - case "term": self = .term(try Term(from: decoder)) - case "filter": self = .filter(try Filter(from: decoder)) - case "nested": self = .nested(try Nested(from: decoder)) - case "histogram": self = .histogram(try Histogram(from: decoder)) - case "timeslice": self = .timeslice(try Timeslice(from: decoder)) - case "top_hits": self = .topHits(try TopHits(from: decoder)) - case "unique_count": self = .uniqueCount(try Calculation(from: decoder)) - case "max": self = .max(try Calculation(from: decoder)) - case "min": self = .min(try Calculation(from: decoder)) - case "average": self = .average(try Calculation(from: decoder)) - case "sum": self = .sum(try Calculation(from: decoder)) - default: self = .generic(try GenericQueryAggregation(from: decoder)) - } - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - switch self { - case .term(let term): - try container.encode("term", forKey: .type) - try term.encode(to: encoder) - case .filter(let filter): - try container.encode("filter", forKey: .type) - try filter.encode(to: encoder) - case .nested(let nested): - try container.encode("nested", forKey: .type) - try nested.encode(to: encoder) - case .histogram(let histogram): - try container.encode("histogram", forKey: .type) - try histogram.encode(to: encoder) - case .timeslice(let timeslice): - try container.encode("timeslice", forKey: .type) - try timeslice.encode(to: encoder) - case .topHits(let topHits): - try container.encode("top_hits", forKey: .type) - try topHits.encode(to: encoder) - case .uniqueCount(let uniqueCount): - try container.encode("unique_count", forKey: .type) - try uniqueCount.encode(to: encoder) - case .max(let max): - try container.encode("max", forKey: .type) - try max.encode(to: encoder) - case .min(let min): - try container.encode("min", forKey: .type) - try min.encode(to: encoder) - case .average(let average): - try container.encode("average", forKey: .type) - try average.encode(to: encoder) - case .sum(let sum): - try container.encode("sum", forKey: .type) - try sum.encode(to: encoder) - case .generic(let generic): - try generic.encode(to: encoder) - } + case results = "results" + case matchingResults = "matching_results" + case aggregations = "aggregations" } } diff --git a/Source/DiscoveryV1/Models/QueryNoticesResponse.swift b/Source/DiscoveryV1/Models/QueryNoticesResponse.swift index 27874b7cf..90b53894f 100644 --- a/Source/DiscoveryV1/Models/QueryNoticesResponse.swift +++ b/Source/DiscoveryV1/Models/QueryNoticesResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/QueryNoticesResult.swift b/Source/DiscoveryV1/Models/QueryNoticesResult.swift index c5e53073d..39391bef7 100644 --- a/Source/DiscoveryV1/Models/QueryNoticesResult.swift +++ b/Source/DiscoveryV1/Models/QueryNoticesResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/QueryPassages.swift b/Source/DiscoveryV1/Models/QueryPassages.swift index e8d433db4..3b2e2de6c 100644 --- a/Source/DiscoveryV1/Models/QueryPassages.swift +++ b/Source/DiscoveryV1/Models/QueryPassages.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/QueryResponse.swift b/Source/DiscoveryV1/Models/QueryResponse.swift index 366df70e1..827c0942c 100644 --- a/Source/DiscoveryV1/Models/QueryResponse.swift +++ b/Source/DiscoveryV1/Models/QueryResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/QueryResult.swift b/Source/DiscoveryV1/Models/QueryResult.swift index 6805cc97f..fc9a6dd59 100644 --- a/Source/DiscoveryV1/Models/QueryResult.swift +++ b/Source/DiscoveryV1/Models/QueryResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/QueryResultMetadata.swift b/Source/DiscoveryV1/Models/QueryResultMetadata.swift index 40f1d222f..414d391c0 100644 --- a/Source/DiscoveryV1/Models/QueryResultMetadata.swift +++ b/Source/DiscoveryV1/Models/QueryResultMetadata.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/RetrievalDetails.swift b/Source/DiscoveryV1/Models/RetrievalDetails.swift index c50d06e37..833c51267 100644 --- a/Source/DiscoveryV1/Models/RetrievalDetails.swift +++ b/Source/DiscoveryV1/Models/RetrievalDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/SduStatus.swift b/Source/DiscoveryV1/Models/SduStatus.swift index 967c27154..298d51710 100644 --- a/Source/DiscoveryV1/Models/SduStatus.swift +++ b/Source/DiscoveryV1/Models/SduStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/SduStatusCustomFields.swift b/Source/DiscoveryV1/Models/SduStatusCustomFields.swift index 8ce6f8c26..2a5864877 100644 --- a/Source/DiscoveryV1/Models/SduStatusCustomFields.swift +++ b/Source/DiscoveryV1/Models/SduStatusCustomFields.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/SearchStatus.swift b/Source/DiscoveryV1/Models/SearchStatus.swift index e4c709908..91a849cc4 100644 --- a/Source/DiscoveryV1/Models/SearchStatus.swift +++ b/Source/DiscoveryV1/Models/SearchStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/SegmentSettings.swift b/Source/DiscoveryV1/Models/SegmentSettings.swift index 10b07eaa1..e66e4441c 100644 --- a/Source/DiscoveryV1/Models/SegmentSettings.swift +++ b/Source/DiscoveryV1/Models/SegmentSettings.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,22 +52,22 @@ public struct SegmentSettings: Codable, Equatable { } /** - Initialize a `SegmentSettings` with member variables. + Initialize a `SegmentSettings` with member variables. - - parameter enabled: Enables/disables the Document Segmentation feature. - - parameter selectorTags: Defines the heading level that splits into document segments. Valid values are h1, h2, - h3, h4, h5, h6. The content of the header field that the segmentation splits at is used as the **title** field - for that segmented result. Only valid if used with a collection that has **enabled** set to `false` in the - **smart_document_understanding** object. - - parameter annotatedFields: Defines the annotated smart document understanding fields that the document is - split on. The content of the annotated field that the segmentation splits at is used as the **title** field for - that segmented result. For example, if the field `sub-title` is specified, when a document is uploaded each time - the smart documement understanding conversion encounters a field of type `sub-title` the document is split at - that point and the content of the field used as the title of the remaining content. Thnis split is performed for - all instances of the listed fields in the uploaded document. Only valid if used with a collection that has - **enabled** set to `true` in the **smart_document_understanding** object. + - parameter enabled: Enables/disables the Document Segmentation feature. + - parameter selectorTags: Defines the heading level that splits into document segments. Valid values are h1, h2, + h3, h4, h5, h6. The content of the header field that the segmentation splits at is used as the **title** field + for that segmented result. Only valid if used with a collection that has **enabled** set to `false` in the + **smart_document_understanding** object. + - parameter annotatedFields: Defines the annotated smart document understanding fields that the document is + split on. The content of the annotated field that the segmentation splits at is used as the **title** field for + that segmented result. For example, if the field `sub-title` is specified, when a document is uploaded each time + the smart documement understanding conversion encounters a field of type `sub-title` the document is split at + that point and the content of the field used as the title of the remaining content. Thnis split is performed for + all instances of the listed fields in the uploaded document. Only valid if used with a collection that has + **enabled** set to `true` in the **smart_document_understanding** object. - - returns: An initialized `SegmentSettings`. + - returns: An initialized `SegmentSettings`. */ public init( enabled: Bool? = nil, diff --git a/Source/DiscoveryV1/Models/Source.swift b/Source/DiscoveryV1/Models/Source.swift index db8801217..a1d9a047f 100644 --- a/Source/DiscoveryV1/Models/Source.swift +++ b/Source/DiscoveryV1/Models/Source.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,21 +73,21 @@ public struct Source: Codable, Equatable { } /** - Initialize a `Source` with member variables. + Initialize a `Source` with member variables. - - parameter type: The type of source to connect to. - - `box` indicates the configuration is to connect an instance of Enterprise Box. - - `salesforce` indicates the configuration is to connect to Salesforce. - - `sharepoint` indicates the configuration is to connect to Microsoft SharePoint Online. - - `web_crawl` indicates the configuration is to perform a web page crawl. - - `cloud_object_storage` indicates the configuration is to connect to a cloud object store. - - parameter credentialID: The **credential_id** of the credentials to use to connect to the source. Credentials - are defined using the **credentials** method. The **source_type** of the credentials used must match the **type** - field specified in this object. - - parameter schedule: Object containing the schedule information for the source. - - parameter options: The **options** object defines which items to crawl from the source system. + - parameter type: The type of source to connect to. + - `box` indicates the configuration is to connect an instance of Enterprise Box. + - `salesforce` indicates the configuration is to connect to Salesforce. + - `sharepoint` indicates the configuration is to connect to Microsoft SharePoint Online. + - `web_crawl` indicates the configuration is to perform a web page crawl. + - `cloud_object_storage` indicates the configuration is to connect to a cloud object store. + - parameter credentialID: The **credential_id** of the credentials to use to connect to the source. Credentials + are defined using the **credentials** method. The **source_type** of the credentials used must match the **type** + field specified in this object. + - parameter schedule: Object containing the schedule information for the source. + - parameter options: The **options** object defines which items to crawl from the source system. - - returns: An initialized `Source`. + - returns: An initialized `Source`. */ public init( type: String? = nil, diff --git a/Source/DiscoveryV1/Models/SourceOptions.swift b/Source/DiscoveryV1/Models/SourceOptions.swift index 80d22edb3..74782febd 100644 --- a/Source/DiscoveryV1/Models/SourceOptions.swift +++ b/Source/DiscoveryV1/Models/SourceOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,24 +68,24 @@ public struct SourceOptions: Codable, Equatable { } /** - Initialize a `SourceOptions` with member variables. + Initialize a `SourceOptions` with member variables. - - parameter folders: Array of folders to crawl from the Box source. Only valid, and required, when the **type** - field of the **source** object is set to `box`. - - parameter objects: Array of Salesforce document object types to crawl from the Salesforce source. Only valid, - and required, when the **type** field of the **source** object is set to `salesforce`. - - parameter siteCollections: Array of Microsoft SharePointoint Online site collections to crawl from the - SharePoint source. Only valid and required when the **type** field of the **source** object is set to - `sharepoint`. - - parameter urls: Array of Web page URLs to begin crawling the web from. Only valid and required when the - **type** field of the **source** object is set to `web_crawl`. - - parameter buckets: Array of cloud object store buckets to begin crawling. Only valid and required when the - **type** field of the **source** object is set to `cloud_object_store`, and the **crawl_all_buckets** field is - `false` or not specified. - - parameter crawlAllBuckets: When `true`, all buckets in the specified cloud object store are crawled. If set to - `true`, the **buckets** array must not be specified. + - parameter folders: Array of folders to crawl from the Box source. Only valid, and required, when the **type** + field of the **source** object is set to `box`. + - parameter objects: Array of Salesforce document object types to crawl from the Salesforce source. Only valid, + and required, when the **type** field of the **source** object is set to `salesforce`. + - parameter siteCollections: Array of Microsoft SharePointoint Online site collections to crawl from the + SharePoint source. Only valid and required when the **type** field of the **source** object is set to + `sharepoint`. + - parameter urls: Array of Web page URLs to begin crawling the web from. Only valid and required when the + **type** field of the **source** object is set to `web_crawl`. + - parameter buckets: Array of cloud object store buckets to begin crawling. Only valid and required when the + **type** field of the **source** object is set to `cloud_object_store`, and the **crawl_all_buckets** field is + `false` or not specified. + - parameter crawlAllBuckets: When `true`, all buckets in the specified cloud object store are crawled. If set to + `true`, the **buckets** array must not be specified. - - returns: An initialized `SourceOptions`. + - returns: An initialized `SourceOptions`. */ public init( folders: [SourceOptionsFolder]? = nil, diff --git a/Source/DiscoveryV1/Models/SourceOptionsBuckets.swift b/Source/DiscoveryV1/Models/SourceOptionsBuckets.swift index 884435883..d28109a0d 100644 --- a/Source/DiscoveryV1/Models/SourceOptionsBuckets.swift +++ b/Source/DiscoveryV1/Models/SourceOptionsBuckets.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,13 +39,13 @@ public struct SourceOptionsBuckets: Codable, Equatable { } /** - Initialize a `SourceOptionsBuckets` with member variables. + Initialize a `SourceOptionsBuckets` with member variables. - - parameter name: The name of the cloud object store bucket to crawl. - - parameter limit: The number of documents to crawl from this cloud object store bucket. If not specified, all - documents in the bucket are crawled. + - parameter name: The name of the cloud object store bucket to crawl. + - parameter limit: The number of documents to crawl from this cloud object store bucket. If not specified, all + documents in the bucket are crawled. - - returns: An initialized `SourceOptionsBuckets`. + - returns: An initialized `SourceOptionsBuckets`. */ public init( name: String, diff --git a/Source/DiscoveryV1/Models/SourceOptionsFolder.swift b/Source/DiscoveryV1/Models/SourceOptionsFolder.swift index e52800f5e..d602b5e33 100644 --- a/Source/DiscoveryV1/Models/SourceOptionsFolder.swift +++ b/Source/DiscoveryV1/Models/SourceOptionsFolder.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,14 +44,14 @@ public struct SourceOptionsFolder: Codable, Equatable { } /** - Initialize a `SourceOptionsFolder` with member variables. + Initialize a `SourceOptionsFolder` with member variables. - - parameter ownerUserID: The Box user ID of the user who owns the folder to crawl. - - parameter folderID: The Box folder ID of the folder to crawl. - - parameter limit: The maximum number of documents to crawl for this folder. By default, all documents in the - folder are crawled. + - parameter ownerUserID: The Box user ID of the user who owns the folder to crawl. + - parameter folderID: The Box folder ID of the folder to crawl. + - parameter limit: The maximum number of documents to crawl for this folder. By default, all documents in the + folder are crawled. - - returns: An initialized `SourceOptionsFolder`. + - returns: An initialized `SourceOptionsFolder`. */ public init( ownerUserID: String, diff --git a/Source/DiscoveryV1/Models/SourceOptionsObject.swift b/Source/DiscoveryV1/Models/SourceOptionsObject.swift index 50fd6a8bc..689e5d02b 100644 --- a/Source/DiscoveryV1/Models/SourceOptionsObject.swift +++ b/Source/DiscoveryV1/Models/SourceOptionsObject.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,13 +39,13 @@ public struct SourceOptionsObject: Codable, Equatable { } /** - Initialize a `SourceOptionsObject` with member variables. + Initialize a `SourceOptionsObject` with member variables. - - parameter name: The name of the Salesforce document object to crawl. For example, `case`. - - parameter limit: The maximum number of documents to crawl for this document object. By default, all documents - in the document object are crawled. + - parameter name: The name of the Salesforce document object to crawl. For example, `case`. + - parameter limit: The maximum number of documents to crawl for this document object. By default, all documents + in the document object are crawled. - - returns: An initialized `SourceOptionsObject`. + - returns: An initialized `SourceOptionsObject`. */ public init( name: String, diff --git a/Source/DiscoveryV1/Models/SourceOptionsSiteColl.swift b/Source/DiscoveryV1/Models/SourceOptionsSiteColl.swift index bdbd09c3a..a65bc9a21 100644 --- a/Source/DiscoveryV1/Models/SourceOptionsSiteColl.swift +++ b/Source/DiscoveryV1/Models/SourceOptionsSiteColl.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,15 +40,15 @@ public struct SourceOptionsSiteColl: Codable, Equatable { } /** - Initialize a `SourceOptionsSiteColl` with member variables. + Initialize a `SourceOptionsSiteColl` with member variables. - - parameter siteCollectionPath: The Microsoft SharePoint Online site collection path to crawl. The path must be - be relative to the **organization_url** that was specified in the credentials associated with this source - configuration. - - parameter limit: The maximum number of documents to crawl for this site collection. By default, all documents - in the site collection are crawled. + - parameter siteCollectionPath: The Microsoft SharePoint Online site collection path to crawl. The path must be + be relative to the **organization_url** that was specified in the credentials associated with this source + configuration. + - parameter limit: The maximum number of documents to crawl for this site collection. By default, all documents + in the site collection are crawled. - - returns: An initialized `SourceOptionsSiteColl`. + - returns: An initialized `SourceOptionsSiteColl`. */ public init( siteCollectionPath: String, diff --git a/Source/DiscoveryV1/Models/SourceOptionsWebCrawl.swift b/Source/DiscoveryV1/Models/SourceOptionsWebCrawl.swift index 3eac7b0ab..8c53a89fb 100644 --- a/Source/DiscoveryV1/Models/SourceOptionsWebCrawl.swift +++ b/Source/DiscoveryV1/Models/SourceOptionsWebCrawl.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,30 +92,30 @@ public struct SourceOptionsWebCrawl: Codable, Equatable { } /** - Initialize a `SourceOptionsWebCrawl` with member variables. - - - parameter url: The starting URL to crawl. - - parameter limitToStartingHosts: When `true`, crawls of the specified URL are limited to the host part of the - **url** field. - - parameter crawlSpeed: The number of concurrent URLs to fetch. `gentle` means one URL is fetched at a time with - a delay between each call. `normal` means as many as two URLs are fectched concurrently with a short delay - between fetch calls. `aggressive` means that up to ten URLs are fetched concurrently with a short delay between - fetch calls. - - parameter allowUntrustedCertificate: When `true`, allows the crawl to interact with HTTPS sites with SSL - certificates with untrusted signers. - - parameter maximumHops: The maximum number of hops to make from the initial URL. When a page is crawled each - link on that page will also be crawled if it is within the **maximum_hops** from the initial URL. The first page - crawled is 0 hops, each link crawled from the first page is 1 hop, each link crawled from those pages is 2 hops, - and so on. - - parameter requestTimeout: The maximum milliseconds to wait for a response from the web server. - - parameter overrideRobotsTxt: When `true`, the crawler will ignore any `robots.txt` encountered by the crawler. - This should only ever be done when crawling a web site the user owns. This must be be set to `true` when a - **gateway_id** is specied in the **credentials**. - - parameter blacklist: Array of URL's to be excluded while crawling. The crawler will not follow links which - contains this string. For example, listing `https://ibm.com/watson` also excludes - `https://ibm.com/watson/discovery`. - - - returns: An initialized `SourceOptionsWebCrawl`. + Initialize a `SourceOptionsWebCrawl` with member variables. + + - parameter url: The starting URL to crawl. + - parameter limitToStartingHosts: When `true`, crawls of the specified URL are limited to the host part of the + **url** field. + - parameter crawlSpeed: The number of concurrent URLs to fetch. `gentle` means one URL is fetched at a time with + a delay between each call. `normal` means as many as two URLs are fectched concurrently with a short delay + between fetch calls. `aggressive` means that up to ten URLs are fetched concurrently with a short delay between + fetch calls. + - parameter allowUntrustedCertificate: When `true`, allows the crawl to interact with HTTPS sites with SSL + certificates with untrusted signers. + - parameter maximumHops: The maximum number of hops to make from the initial URL. When a page is crawled each + link on that page will also be crawled if it is within the **maximum_hops** from the initial URL. The first page + crawled is 0 hops, each link crawled from the first page is 1 hop, each link crawled from those pages is 2 hops, + and so on. + - parameter requestTimeout: The maximum milliseconds to wait for a response from the web server. + - parameter overrideRobotsTxt: When `true`, the crawler will ignore any `robots.txt` encountered by the crawler. + This should only ever be done when crawling a web site the user owns. This must be be set to `true` when a + **gateway_id** is specied in the **credentials**. + - parameter blacklist: Array of URL's to be excluded while crawling. The crawler will not follow links which + contains this string. For example, listing `https://ibm.com/watson` also excludes + `https://ibm.com/watson/discovery`. + + - returns: An initialized `SourceOptionsWebCrawl`. */ public init( url: String, diff --git a/Source/DiscoveryV1/Models/SourceSchedule.swift b/Source/DiscoveryV1/Models/SourceSchedule.swift index 9206c5eaf..d30818456 100644 --- a/Source/DiscoveryV1/Models/SourceSchedule.swift +++ b/Source/DiscoveryV1/Models/SourceSchedule.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,20 +67,20 @@ public struct SourceSchedule: Codable, Equatable { } /** - Initialize a `SourceSchedule` with member variables. + Initialize a `SourceSchedule` with member variables. - - parameter enabled: When `true`, the source is re-crawled based on the **frequency** field in this object. When - `false` the source is not re-crawled; When `false` and connecting to Salesforce the source is crawled annually. - - parameter timeZone: The time zone to base source crawl times on. Possible values correspond to the IANA - (Internet Assigned Numbers Authority) time zones list. - - parameter frequency: The crawl schedule in the specified **time_zone**. - - `five_minutes`: Runs every five minutes. - - `hourly`: Runs every hour. - - `daily`: Runs every day between 00:00 and 06:00. - - `weekly`: Runs every week on Sunday between 00:00 and 06:00. - - `monthly`: Runs the on the first Sunday of every month between 00:00 and 06:00. + - parameter enabled: When `true`, the source is re-crawled based on the **frequency** field in this object. When + `false` the source is not re-crawled; When `false` and connecting to Salesforce the source is crawled annually. + - parameter timeZone: The time zone to base source crawl times on. Possible values correspond to the IANA + (Internet Assigned Numbers Authority) time zones list. + - parameter frequency: The crawl schedule in the specified **time_zone**. + - `five_minutes`: Runs every five minutes. + - `hourly`: Runs every hour. + - `daily`: Runs every day between 00:00 and 06:00. + - `weekly`: Runs every week on Sunday between 00:00 and 06:00. + - `monthly`: Runs the on the first Sunday of every month between 00:00 and 06:00. - - returns: An initialized `SourceSchedule`. + - returns: An initialized `SourceSchedule`. */ public init( enabled: Bool? = nil, diff --git a/Source/DiscoveryV1/Models/SourceStatus.swift b/Source/DiscoveryV1/Models/SourceStatus.swift index b456ee380..60412b4d2 100644 --- a/Source/DiscoveryV1/Models/SourceStatus.swift +++ b/Source/DiscoveryV1/Models/SourceStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/Term.swift b/Source/DiscoveryV1/Models/Term.swift index 52bef6d4c..20a63de4e 100644 --- a/Source/DiscoveryV1/Models/Term.swift +++ b/Source/DiscoveryV1/Models/Term.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/Timeslice.swift b/Source/DiscoveryV1/Models/Timeslice.swift index 768978e1a..d83964378 100644 --- a/Source/DiscoveryV1/Models/Timeslice.swift +++ b/Source/DiscoveryV1/Models/Timeslice.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/TokenDict.swift b/Source/DiscoveryV1/Models/TokenDict.swift index 2412598b3..13e2fdc38 100644 --- a/Source/DiscoveryV1/Models/TokenDict.swift +++ b/Source/DiscoveryV1/Models/TokenDict.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,12 +33,12 @@ internal struct TokenDict: Codable, Equatable { } /** - Initialize a `TokenDict` with member variables. + Initialize a `TokenDict` with member variables. - - parameter tokenizationRules: An array of tokenization rules. Each rule contains, the original `text` string, - component `tokens`, any alternate character set `readings`, and which `part_of_speech` the text is from. + - parameter tokenizationRules: An array of tokenization rules. Each rule contains, the original `text` string, + component `tokens`, any alternate character set `readings`, and which `part_of_speech` the text is from. - - returns: An initialized `TokenDict`. + - returns: An initialized `TokenDict`. */ public init( tokenizationRules: [TokenDictRule]? = nil diff --git a/Source/DiscoveryV1/Models/TokenDictRule.swift b/Source/DiscoveryV1/Models/TokenDictRule.swift index 6e518cc48..d4abd2298 100644 --- a/Source/DiscoveryV1/Models/TokenDictRule.swift +++ b/Source/DiscoveryV1/Models/TokenDictRule.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,16 +50,16 @@ public struct TokenDictRule: Codable, Equatable { } /** - Initialize a `TokenDictRule` with member variables. + Initialize a `TokenDictRule` with member variables. - - parameter text: The string to tokenize. - - parameter tokens: Array of tokens that the `text` field is split into when found. - - parameter partOfSpeech: The part of speech that the `text` string belongs to. For example `noun`. Custom parts - of speech can be specified. - - parameter readings: Array of tokens that represent the content of the `text` field in an alternate character - set. + - parameter text: The string to tokenize. + - parameter tokens: Array of tokens that the `text` field is split into when found. + - parameter partOfSpeech: The part of speech that the `text` string belongs to. For example `noun`. Custom parts + of speech can be specified. + - parameter readings: Array of tokens that represent the content of the `text` field in an alternate character + set. - - returns: An initialized `TokenDictRule`. + - returns: An initialized `TokenDictRule`. */ public init( text: String, diff --git a/Source/DiscoveryV1/Models/TokenDictStatusResponse.swift b/Source/DiscoveryV1/Models/TokenDictStatusResponse.swift index bac6d7226..a16b63651 100644 --- a/Source/DiscoveryV1/Models/TokenDictStatusResponse.swift +++ b/Source/DiscoveryV1/Models/TokenDictStatusResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/TopHits.swift b/Source/DiscoveryV1/Models/TopHits.swift index e29ac8d89..3aed743d7 100644 --- a/Source/DiscoveryV1/Models/TopHits.swift +++ b/Source/DiscoveryV1/Models/TopHits.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/TopHitsResults.swift b/Source/DiscoveryV1/Models/TopHitsResults.swift index 9d86fbbfd..38f748c25 100644 --- a/Source/DiscoveryV1/Models/TopHitsResults.swift +++ b/Source/DiscoveryV1/Models/TopHitsResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/TrainingDataSet.swift b/Source/DiscoveryV1/Models/TrainingDataSet.swift index 5555dc513..63d1a0ee6 100644 --- a/Source/DiscoveryV1/Models/TrainingDataSet.swift +++ b/Source/DiscoveryV1/Models/TrainingDataSet.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/TrainingExample.swift b/Source/DiscoveryV1/Models/TrainingExample.swift index def07afb6..6f1fd756d 100644 --- a/Source/DiscoveryV1/Models/TrainingExample.swift +++ b/Source/DiscoveryV1/Models/TrainingExample.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,13 +44,13 @@ public struct TrainingExample: Codable, Equatable { } /** - Initialize a `TrainingExample` with member variables. + Initialize a `TrainingExample` with member variables. - - parameter documentID: The document ID associated with this training example. - - parameter crossReference: The cross reference associated with this training example. - - parameter relevance: The relevance of the training example. + - parameter documentID: The document ID associated with this training example. + - parameter crossReference: The cross reference associated with this training example. + - parameter relevance: The relevance of the training example. - - returns: An initialized `TrainingExample`. + - returns: An initialized `TrainingExample`. */ public init( documentID: String? = nil, diff --git a/Source/DiscoveryV1/Models/TrainingExampleList.swift b/Source/DiscoveryV1/Models/TrainingExampleList.swift index a8dcde623..1c4c19a09 100644 --- a/Source/DiscoveryV1/Models/TrainingExampleList.swift +++ b/Source/DiscoveryV1/Models/TrainingExampleList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/TrainingExamplePatch.swift b/Source/DiscoveryV1/Models/TrainingExamplePatch.swift index 9462d8263..17494046e 100644 --- a/Source/DiscoveryV1/Models/TrainingExamplePatch.swift +++ b/Source/DiscoveryV1/Models/TrainingExamplePatch.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ internal struct TrainingExamplePatch: Codable, Equatable { } /** - Initialize a `TrainingExamplePatch` with member variables. + Initialize a `TrainingExamplePatch` with member variables. - - parameter crossReference: The example to add. - - parameter relevance: The relevance value for this example. + - parameter crossReference: The example to add. + - parameter relevance: The relevance value for this example. - - returns: An initialized `TrainingExamplePatch`. + - returns: An initialized `TrainingExamplePatch`. */ public init( crossReference: String? = nil, diff --git a/Source/DiscoveryV1/Models/TrainingQuery.swift b/Source/DiscoveryV1/Models/TrainingQuery.swift index 31add8ada..d12b3c244 100644 --- a/Source/DiscoveryV1/Models/TrainingQuery.swift +++ b/Source/DiscoveryV1/Models/TrainingQuery.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/TrainingStatus.swift b/Source/DiscoveryV1/Models/TrainingStatus.swift index 4c2c4c60a..ee5f7f423 100644 --- a/Source/DiscoveryV1/Models/TrainingStatus.swift +++ b/Source/DiscoveryV1/Models/TrainingStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV1/Models/UpdateCollectionRequest.swift b/Source/DiscoveryV1/Models/UpdateCollectionRequest.swift index 9d31b6130..9cfff334a 100644 --- a/Source/DiscoveryV1/Models/UpdateCollectionRequest.swift +++ b/Source/DiscoveryV1/Models/UpdateCollectionRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,13 +44,13 @@ internal struct UpdateCollectionRequest: Codable, Equatable { } /** - Initialize a `UpdateCollectionRequest` with member variables. + Initialize a `UpdateCollectionRequest` with member variables. - - parameter name: The name of the collection. - - parameter description: A description of the collection. - - parameter configurationID: The ID of the configuration in which the collection is to be updated. + - parameter name: The name of the collection. + - parameter description: A description of the collection. + - parameter configurationID: The ID of the configuration in which the collection is to be updated. - - returns: An initialized `UpdateCollectionRequest`. + - returns: An initialized `UpdateCollectionRequest`. */ public init( name: String, diff --git a/Source/DiscoveryV1/Models/UpdateEnvironmentRequest.swift b/Source/DiscoveryV1/Models/UpdateEnvironmentRequest.swift index acd7ccd1f..9a538624f 100644 --- a/Source/DiscoveryV1/Models/UpdateEnvironmentRequest.swift +++ b/Source/DiscoveryV1/Models/UpdateEnvironmentRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,14 +60,14 @@ internal struct UpdateEnvironmentRequest: Codable, Equatable { } /** - Initialize a `UpdateEnvironmentRequest` with member variables. + Initialize a `UpdateEnvironmentRequest` with member variables. - - parameter name: Name that identifies the environment. - - parameter description: Description of the environment. - - parameter size: Size that the environment should be increased to. Environment size cannot be modified when - using a Lite plan. Environment size can only increased and not decreased. + - parameter name: Name that identifies the environment. + - parameter description: Description of the environment. + - parameter size: Size that the environment should be increased to. Environment size cannot be modified when + using a Lite plan. Environment size can only increased and not decreased. - - returns: An initialized `UpdateEnvironmentRequest`. + - returns: An initialized `UpdateEnvironmentRequest`. */ public init( name: String? = nil, diff --git a/Source/DiscoveryV1/Models/WordHeadingDetection.swift b/Source/DiscoveryV1/Models/WordHeadingDetection.swift index 7f212c92b..edfd3a554 100644 --- a/Source/DiscoveryV1/Models/WordHeadingDetection.swift +++ b/Source/DiscoveryV1/Models/WordHeadingDetection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct WordHeadingDetection: Codable, Equatable { } /** - Initialize a `WordHeadingDetection` with member variables. + Initialize a `WordHeadingDetection` with member variables. - - parameter fonts: Array of font matching configurations. - - parameter styles: Array of Microsoft Word styles to convert. + - parameter fonts: Array of font matching configurations. + - parameter styles: Array of Microsoft Word styles to convert. - - returns: An initialized `WordHeadingDetection`. + - returns: An initialized `WordHeadingDetection`. */ public init( fonts: [FontSetting]? = nil, diff --git a/Source/DiscoveryV1/Models/WordSettings.swift b/Source/DiscoveryV1/Models/WordSettings.swift index 55c431434..7b4b7d5de 100644 --- a/Source/DiscoveryV1/Models/WordSettings.swift +++ b/Source/DiscoveryV1/Models/WordSettings.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct WordSettings: Codable, Equatable { } /** - Initialize a `WordSettings` with member variables. + Initialize a `WordSettings` with member variables. - - parameter heading: Object containing heading detection conversion settings for Microsoft Word documents. + - parameter heading: Object containing heading detection conversion settings for Microsoft Word documents. - - returns: An initialized `WordSettings`. + - returns: An initialized `WordSettings`. */ public init( heading: WordHeadingDetection? = nil diff --git a/Source/DiscoveryV1/Models/WordStyle.swift b/Source/DiscoveryV1/Models/WordStyle.swift index a717ecfb2..5b9505c25 100644 --- a/Source/DiscoveryV1/Models/WordStyle.swift +++ b/Source/DiscoveryV1/Models/WordStyle.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct WordStyle: Codable, Equatable { } /** - Initialize a `WordStyle` with member variables. + Initialize a `WordStyle` with member variables. - - parameter level: HTML head level that content matching this style is tagged with. - - parameter names: Array of word style names to convert. + - parameter level: HTML head level that content matching this style is tagged with. + - parameter names: Array of word style names to convert. - - returns: An initialized `WordStyle`. + - returns: An initialized `WordStyle`. */ public init( level: Int? = nil, diff --git a/Source/DiscoveryV1/Models/XPathPatterns.swift b/Source/DiscoveryV1/Models/XPathPatterns.swift index 30688cb25..5e5d6105e 100644 --- a/Source/DiscoveryV1/Models/XPathPatterns.swift +++ b/Source/DiscoveryV1/Models/XPathPatterns.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct XPathPatterns: Codable, Equatable { } /** - Initialize a `XPathPatterns` with member variables. + Initialize a `XPathPatterns` with member variables. - - parameter xpaths: An array to XPaths. + - parameter xpaths: An array to XPaths. - - returns: An initialized `XPathPatterns`. + - returns: An initialized `XPathPatterns`. */ public init( xpaths: [String]? = nil diff --git a/Source/DiscoveryV2/Discovery.swift b/Source/DiscoveryV2/Discovery.swift index 8a79096b7..ad0c4885e 100644 --- a/Source/DiscoveryV2/Discovery.swift +++ b/Source/DiscoveryV2/Discovery.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,15 @@ import Foundation import IBMSwiftSDKCore /** - IBM Watson™ Discovery for IBM Cloud Pak for Data is a cognitive search and content analytics engine that you can - add to applications to identify patterns, trends and actionable insights to drive better decision-making. Securely - unify structured and unstructured data with pre-enriched content, and use a simplified query language to eliminate the - need for manual filtering of results. + IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to + identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and + unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual + filtering of results. */ public class Discovery { /// The base URL to use when contacting the service. - public var serviceURL: String? = nil + public var serviceURL: String? = "https://api.us-south.discovery.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "Discovery" @@ -55,10 +55,11 @@ public class Discovery { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -84,8 +85,8 @@ public class Discovery { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -93,7 +94,7 @@ public class Discovery { #endif /** - Use the HTTP response and data received by the IBM Watson Discovery for IBM Cloud Pak for Data service to extract + Use the HTTP response and data received by the Discovery v2 service to extract information about the error that occurred. - parameter data: Raw data returned by the service that may represent an error. @@ -182,11 +183,280 @@ public class Discovery { request.responseObject(completionHandler: completionHandler) } + /** + Create a collection. + + Create a new collection in the specified project. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter name: The name of the collection. + - parameter description: A description of the collection. + - parameter language: The language of the collection. + - parameter enrichments: An array of enrichments that are applied to this collection. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func createCollection( + projectID: String, + name: String, + description: String? = nil, + language: String? = nil, + enrichments: [CollectionEnrichment]? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct body + let createCollectionRequest = CollectionDetails( + name: name, + description: description, + language: language, + enrichments: enrichments) + guard let body = try? JSON.encoder.encode(createCollectionRequest) else { + completionHandler(nil, WatsonError.serialization(values: "request body")) + return + } + + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "createCollection") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + headerParameters["Content-Type"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/collections" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "POST", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters, + messageBody: body + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Get collection. + + Get details about the specified collection. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter collectionID: The ID of the collection. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func getCollection( + projectID: String, + collectionID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "getCollection") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/collections/\(collectionID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Update a collection. + + Updates the specified collection's name, description, and enrichments. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter collectionID: The ID of the collection. + - parameter name: The name of the collection. + - parameter description: A description of the collection. + - parameter enrichments: An array of enrichments that are applied to this collection. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func updateCollection( + projectID: String, + collectionID: String, + name: String? = nil, + description: String? = nil, + enrichments: [CollectionEnrichment]? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct body + let updateCollectionRequest = UpdateCollection( + name: name, + description: description, + enrichments: enrichments) + guard let body = try? JSON.encoder.encode(updateCollectionRequest) else { + completionHandler(nil, WatsonError.serialization(values: "request body")) + return + } + + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "updateCollection") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + headerParameters["Content-Type"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/collections/\(collectionID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "POST", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters, + messageBody: body + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Delete a collection. + + Deletes the specified collection from the project. All documents stored in the specified collection and not shared + is also deleted. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter collectionID: The ID of the collection. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func deleteCollection( + projectID: String, + collectionID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "deleteCollection") + headerParameters.merge(sdkHeaders) { (_, new) in new } + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/collections/\(collectionID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "DELETE", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.response(completionHandler: completionHandler) + } + /** Query a project. By using this method, you can construct queries. For details, see the [Discovery - documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). + documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). The default query + parameters are defined by the settings for this project, see the [Discovery + documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults) for an overview of + the standard default settings, and see [the Projects API documentation](#create-project) for details about how to + set custom default query settings. - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling. @@ -535,7 +805,7 @@ public class Discovery { } /** - Configuration settings for components. + List component settings. Returns default configuration settings for components. @@ -619,7 +889,8 @@ public class Discovery { - parameter filename: The filename for file. - parameter fileContentType: The content type of file. - parameter metadata: The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are - rejected. Example: ``` { + rejected. + Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. @@ -723,7 +994,8 @@ public class Discovery { - parameter filename: The filename for file. - parameter fileContentType: The content type of file. - parameter metadata: The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are - rejected. Example: ``` { + rejected. + Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. @@ -1188,4 +1460,663 @@ public class Discovery { request.responseObject(completionHandler: completionHandler) } + /** + List Enrichments. + + List the enrichments available to this project. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func listEnrichments( + projectID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "listEnrichments") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/enrichments" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Create an enrichment. + + Create an enrichment for use with the specified project/. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter enrichment: + - parameter file: The enrichment file to upload. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func createEnrichment( + projectID: String, + enrichment: CreateEnrichment, + file: Data? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct body + let multipartFormData = MultipartFormData() + if let enrichmentData = "\(enrichment)".data(using: .utf8) { + multipartFormData.append(enrichmentData, withName: "enrichment") + } + if let file = file { + multipartFormData.append(file, withName: "file", fileName: "filename") + } + guard let body = try? multipartFormData.toData() else { + completionHandler(nil, WatsonError.serialization(values: "request multipart form data")) + return + } + + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "createEnrichment") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + headerParameters["Content-Type"] = multipartFormData.contentType + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/enrichments" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "POST", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters, + messageBody: body + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Get enrichment. + + Get details about a specific enrichment. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter enrichmentID: The ID of the enrichment. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func getEnrichment( + projectID: String, + enrichmentID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "getEnrichment") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/enrichments/\(enrichmentID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Update an enrichment. + + Updates an existing enrichment's name and description. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter enrichmentID: The ID of the enrichment. + - parameter name: A new name for the enrichment. + - parameter description: A new description for the enrichment. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func updateEnrichment( + projectID: String, + enrichmentID: String, + name: String, + description: String? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct body + let updateEnrichmentRequest = UpdateEnrichment( + name: name, + description: description) + guard let body = try? JSON.encoder.encode(updateEnrichmentRequest) else { + completionHandler(nil, WatsonError.serialization(values: "request body")) + return + } + + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "updateEnrichment") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + headerParameters["Content-Type"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/enrichments/\(enrichmentID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "POST", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters, + messageBody: body + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Delete an enrichment. + + Deletes an existing enrichment from the specified project. + **Note:** Only enrichments that have been manually created can be deleted. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter enrichmentID: The ID of the enrichment. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func deleteEnrichment( + projectID: String, + enrichmentID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "deleteEnrichment") + headerParameters.merge(sdkHeaders) { (_, new) in new } + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)/enrichments/\(enrichmentID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "DELETE", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.response(completionHandler: completionHandler) + } + + /** + List projects. + + Lists existing projects for this instance. + + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func listProjects( + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "listProjects") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + "/v2/projects", + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Create a Project. + + Create a new project for this instance. + + - parameter name: The human readable name of this project. + - parameter type: The project type of this project. + - parameter defaultQueryParameters: Default query parameters for this project. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func createProject( + name: String, + type: String, + defaultQueryParameters: DefaultQueryParams? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct body + let createProjectRequest = ProjectCreation( + name: name, + type: type, + defaultQueryParameters: defaultQueryParameters) + guard let body = try? JSON.encoder.encode(createProjectRequest) else { + completionHandler(nil, WatsonError.serialization(values: "request body")) + return + } + + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "createProject") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + headerParameters["Content-Type"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "POST", + url: serviceEndpoint + "/v2/projects", + headerParameters: headerParameters, + queryItems: queryParameters, + messageBody: body + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Get project. + + Get details on the specified project. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func getProject( + projectID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "getProject") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Update a project. + + Update the specified project's name. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter name: The new name to give this project. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func updateProject( + projectID: String, + name: String? = nil, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct body + let updateProjectRequest = ProjectName( + name: name) + guard let body = try? JSON.encoder.encodeIfPresent(updateProjectRequest) else { + completionHandler(nil, WatsonError.serialization(values: "request body")) + return + } + + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "updateProject") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + headerParameters["Content-Type"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "POST", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters, + messageBody: body + ) + + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Delete a project. + + Deletes the specified project. + **Important:** Deleting a project deletes everything that is part of the specified project, including all + collections. + + - parameter projectID: The ID of the project. This information can be found from the deploy page of the Discovery + administrative tooling. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func deleteProject( + projectID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "deleteProject") + headerParameters.merge(sdkHeaders) { (_, new) in new } + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + let path = "/v2/projects/\(projectID)" + guard let encodedPath = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else { + completionHandler(nil, WatsonError.urlEncoding(path: path)) + return + } + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "DELETE", + url: serviceEndpoint + encodedPath, + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.response(completionHandler: completionHandler) + } + + /** + Delete labeled data. + + Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with + the customer ID. + You associate a customer ID with data by passing the **X-Watson-Metadata** header with a request that passes data. + For more information about personal data and customer IDs, see [Information + security](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-information-security#information-security). + **Note:** This method is only supported on IBM Cloud instances of Discovery. + + - parameter customerID: The customer ID for which all data is to be deleted. + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func deleteUserData( + customerID: String, + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "deleteUserData") + headerParameters.merge(sdkHeaders) { (_, new) in new } + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + queryParameters.append(URLQueryItem(name: "customer_id", value: customerID)) + + // construct REST request + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "DELETE", + url: serviceEndpoint + "/v2/user_data", + headerParameters: headerParameters, + queryItems: queryParameters + ) + + // execute REST request + request.response(completionHandler: completionHandler) + } + } diff --git a/Source/DiscoveryV2/Models/Collection.swift b/Source/DiscoveryV2/Models/Collection.swift index ab96a0413..ba374b2ef 100644 --- a/Source/DiscoveryV2/Models/Collection.swift +++ b/Source/DiscoveryV2/Models/Collection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/CollectionDetails.swift b/Source/DiscoveryV2/Models/CollectionDetails.swift new file mode 100644 index 000000000..abdca9f71 --- /dev/null +++ b/Source/DiscoveryV2/Models/CollectionDetails.swift @@ -0,0 +1,93 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + A collection for storing documents. + */ +public struct CollectionDetails: Codable, Equatable { + + /** + The unique identifier of the collection. + */ + public var collectionID: String? + + /** + The name of the collection. + */ + public var name: String + + /** + A description of the collection. + */ + public var description: String? + + /** + The date that the collection was created. + */ + public var created: Date? + + /** + The language of the collection. + */ + public var language: String? + + /** + An array of enrichments that are applied to this collection. + */ + public var enrichments: [CollectionEnrichment]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case collectionID = "collection_id" + case name = "name" + case description = "description" + case created = "created" + case language = "language" + case enrichments = "enrichments" + } + + /** + Initialize a `CollectionDetails` with member variables. + + - parameter name: The name of the collection. + - parameter collectionID: The unique identifier of the collection. + - parameter description: A description of the collection. + - parameter created: The date that the collection was created. + - parameter language: The language of the collection. + - parameter enrichments: An array of enrichments that are applied to this collection. + + - returns: An initialized `CollectionDetails`. + */ + public init( + name: String, + collectionID: String? = nil, + description: String? = nil, + created: Date? = nil, + language: String? = nil, + enrichments: [CollectionEnrichment]? = nil + ) + { + self.name = name + self.collectionID = collectionID + self.description = description + self.created = created + self.language = language + self.enrichments = enrichments + } + +} diff --git a/Source/DiscoveryV2/Models/CollectionEnrichment.swift b/Source/DiscoveryV2/Models/CollectionEnrichment.swift new file mode 100644 index 000000000..ba76d173c --- /dev/null +++ b/Source/DiscoveryV2/Models/CollectionEnrichment.swift @@ -0,0 +1,57 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + An object describing an Enrichment for a collection. + */ +public struct CollectionEnrichment: Codable, Equatable { + + /** + The unique identifier of this enrichment. + */ + public var enrichmentID: String? + + /** + An array of field names that the enrichment is applied to. + */ + public var fields: [String]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case enrichmentID = "enrichment_id" + case fields = "fields" + } + + /** + Initialize a `CollectionEnrichment` with member variables. + + - parameter enrichmentID: The unique identifier of this enrichment. + - parameter fields: An array of field names that the enrichment is applied to. + + - returns: An initialized `CollectionEnrichment`. + */ + public init( + enrichmentID: String? = nil, + fields: [String]? = nil + ) + { + self.enrichmentID = enrichmentID + self.fields = fields + } + +} diff --git a/Source/DiscoveryV2/Models/Completions.swift b/Source/DiscoveryV2/Models/Completions.swift index dd35db739..80c755b6d 100644 --- a/Source/DiscoveryV2/Models/Completions.swift +++ b/Source/DiscoveryV2/Models/Completions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ComponentSettingsAggregation.swift b/Source/DiscoveryV2/Models/ComponentSettingsAggregation.swift index a2deb0fd8..52ddacf3f 100644 --- a/Source/DiscoveryV2/Models/ComponentSettingsAggregation.swift +++ b/Source/DiscoveryV2/Models/ComponentSettingsAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ComponentSettingsFieldsShown.swift b/Source/DiscoveryV2/Models/ComponentSettingsFieldsShown.swift index d90ffd05a..574894c22 100644 --- a/Source/DiscoveryV2/Models/ComponentSettingsFieldsShown.swift +++ b/Source/DiscoveryV2/Models/ComponentSettingsFieldsShown.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownBody.swift b/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownBody.swift index d4d7f245e..26e259127 100644 --- a/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownBody.swift +++ b/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownBody.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownTitle.swift b/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownTitle.swift index 554e04687..f4ad1cd91 100644 --- a/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownTitle.swift +++ b/Source/DiscoveryV2/Models/ComponentSettingsFieldsShownTitle.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ComponentSettingsResponse.swift b/Source/DiscoveryV2/Models/ComponentSettingsResponse.swift index 41bebefc1..557d492b7 100644 --- a/Source/DiscoveryV2/Models/ComponentSettingsResponse.swift +++ b/Source/DiscoveryV2/Models/ComponentSettingsResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ import Foundation /** - A response containing the default component settings. + The default component settings for this project. */ public struct ComponentSettingsResponse: Codable, Equatable { diff --git a/Source/DiscoveryV2/Models/CreateEnrichment.swift b/Source/DiscoveryV2/Models/CreateEnrichment.swift new file mode 100644 index 000000000..fe1d3fb76 --- /dev/null +++ b/Source/DiscoveryV2/Models/CreateEnrichment.swift @@ -0,0 +1,86 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Information about a specific enrichment. + */ +public struct CreateEnrichment: Codable, Equatable { + + /** + The type of this enrichment. + */ + public enum TypeEnum: String { + case dictionary = "dictionary" + case regularExpression = "regular_expression" + case uimaAnnotator = "uima_annotator" + case ruleBased = "rule_based" + case watsonKnowledgeStudioModel = "watson_knowledge_studio_model" + } + + /** + The human readable name for this enrichment. + */ + public var name: String? + + /** + The description of this enrichment. + */ + public var description: String? + + /** + The type of this enrichment. + */ + public var type: String? + + /** + A object containing options for the current enrichment. + */ + public var options: EnrichmentOptions? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case name = "name" + case description = "description" + case type = "type" + case options = "options" + } + + /** + Initialize a `CreateEnrichment` with member variables. + + - parameter name: The human readable name for this enrichment. + - parameter description: The description of this enrichment. + - parameter type: The type of this enrichment. + - parameter options: A object containing options for the current enrichment. + + - returns: An initialized `CreateEnrichment`. + */ + public init( + name: String? = nil, + description: String? = nil, + type: String? = nil, + options: EnrichmentOptions? = nil + ) + { + self.name = name + self.description = description + self.type = type + self.options = options + } + +} diff --git a/Source/DiscoveryV2/Models/DefaultQueryParams.swift b/Source/DiscoveryV2/Models/DefaultQueryParams.swift new file mode 100644 index 000000000..7457cb3e9 --- /dev/null +++ b/Source/DiscoveryV2/Models/DefaultQueryParams.swift @@ -0,0 +1,130 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Default query parameters for this project. + */ +public struct DefaultQueryParams: Codable, Equatable { + + /** + An array of collection identifiers to query. If empty or omitted all collections in the project are queried. + */ + public var collectionIDs: [String]? + + /** + Default settings configuration for passage search options. + */ + public var passages: DefaultQueryParamsPassages? + + /** + Default project query settings for table results. + */ + public var tableResults: DefaultQueryParamsTableResults? + + /** + A string representing the default aggregation query for the project. + */ + public var aggregation: String? + + /** + Object containing suggested refinement settings. + */ + public var suggestedRefinements: DefaultQueryParamsSuggestedRefinements? + + /** + When `true`, a spelling suggestions for the query are retuned by default. + */ + public var spellingSuggestions: Bool? + + /** + When `true`, a highlights for the query are retuned by default. + */ + public var highlight: Bool? + + /** + The number of document results returned by default. + */ + public var count: Int? + + /** + A comma separated list of document fields to sort results by default. + */ + public var sort: String? + + /** + An array of field names to return in document results if present by default. + */ + public var `return`: [String]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case collectionIDs = "collection_ids" + case passages = "passages" + case tableResults = "table_results" + case aggregation = "aggregation" + case suggestedRefinements = "suggested_refinements" + case spellingSuggestions = "spelling_suggestions" + case highlight = "highlight" + case count = "count" + case sort = "sort" + case `return` = "return" + } + + /** + Initialize a `DefaultQueryParams` with member variables. + + - parameter collectionIDs: An array of collection identifiers to query. If empty or omitted all collections in + the project are queried. + - parameter passages: Default settings configuration for passage search options. + - parameter tableResults: Default project query settings for table results. + - parameter aggregation: A string representing the default aggregation query for the project. + - parameter suggestedRefinements: Object containing suggested refinement settings. + - parameter spellingSuggestions: When `true`, a spelling suggestions for the query are retuned by default. + - parameter highlight: When `true`, a highlights for the query are retuned by default. + - parameter count: The number of document results returned by default. + - parameter sort: A comma separated list of document fields to sort results by default. + - parameter `return`: An array of field names to return in document results if present by default. + + - returns: An initialized `DefaultQueryParams`. + */ + public init( + collectionIDs: [String]? = nil, + passages: DefaultQueryParamsPassages? = nil, + tableResults: DefaultQueryParamsTableResults? = nil, + aggregation: String? = nil, + suggestedRefinements: DefaultQueryParamsSuggestedRefinements? = nil, + spellingSuggestions: Bool? = nil, + highlight: Bool? = nil, + count: Int? = nil, + sort: String? = nil, + `return`: [String]? = nil + ) + { + self.collectionIDs = collectionIDs + self.passages = passages + self.tableResults = tableResults + self.aggregation = aggregation + self.suggestedRefinements = suggestedRefinements + self.spellingSuggestions = spellingSuggestions + self.highlight = highlight + self.count = count + self.sort = sort + self.`return` = `return` + } + +} diff --git a/Source/DiscoveryV2/Models/DefaultQueryParamsPassages.swift b/Source/DiscoveryV2/Models/DefaultQueryParamsPassages.swift new file mode 100644 index 000000000..3ea617cf6 --- /dev/null +++ b/Source/DiscoveryV2/Models/DefaultQueryParamsPassages.swift @@ -0,0 +1,96 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Default settings configuration for passage search options. + */ +public struct DefaultQueryParamsPassages: Codable, Equatable { + + /** + When `true`, a passage search is performed by default. + */ + public var enabled: Bool? + + /** + The number of passages to return. + */ + public var count: Int? + + /** + An array of field names to perfom the passage search on. + */ + public var fields: [String]? + + /** + The approximate number of characters that each returned passage will contain. + */ + public var characters: Int? + + /** + When `true` the number of passages that can be returned from a single document is restricted to the + *max_per_document* value. + */ + public var perDocument: Bool? + + /** + The default maximum number of passages that can be taken from a single document as the result of a passage query. + */ + public var maxPerDocument: Int? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case enabled = "enabled" + case count = "count" + case fields = "fields" + case characters = "characters" + case perDocument = "per_document" + case maxPerDocument = "max_per_document" + } + + /** + Initialize a `DefaultQueryParamsPassages` with member variables. + + - parameter enabled: When `true`, a passage search is performed by default. + - parameter count: The number of passages to return. + - parameter fields: An array of field names to perfom the passage search on. + - parameter characters: The approximate number of characters that each returned passage will contain. + - parameter perDocument: When `true` the number of passages that can be returned from a single document is + restricted to the *max_per_document* value. + - parameter maxPerDocument: The default maximum number of passages that can be taken from a single document as + the result of a passage query. + + - returns: An initialized `DefaultQueryParamsPassages`. + */ + public init( + enabled: Bool? = nil, + count: Int? = nil, + fields: [String]? = nil, + characters: Int? = nil, + perDocument: Bool? = nil, + maxPerDocument: Int? = nil + ) + { + self.enabled = enabled + self.count = count + self.fields = fields + self.characters = characters + self.perDocument = perDocument + self.maxPerDocument = maxPerDocument + } + +} diff --git a/Source/DiscoveryV2/Models/DefaultQueryParamsSuggestedRefinements.swift b/Source/DiscoveryV2/Models/DefaultQueryParamsSuggestedRefinements.swift new file mode 100644 index 000000000..84e28bbcc --- /dev/null +++ b/Source/DiscoveryV2/Models/DefaultQueryParamsSuggestedRefinements.swift @@ -0,0 +1,57 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Object containing suggested refinement settings. + */ +public struct DefaultQueryParamsSuggestedRefinements: Codable, Equatable { + + /** + When `true`, a suggested refinements for the query are retuned by default. + */ + public var enabled: Bool? + + /** + The number of suggested refinements to return by default. + */ + public var count: Int? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case enabled = "enabled" + case count = "count" + } + + /** + Initialize a `DefaultQueryParamsSuggestedRefinements` with member variables. + + - parameter enabled: When `true`, a suggested refinements for the query are retuned by default. + - parameter count: The number of suggested refinements to return by default. + + - returns: An initialized `DefaultQueryParamsSuggestedRefinements`. + */ + public init( + enabled: Bool? = nil, + count: Int? = nil + ) + { + self.enabled = enabled + self.count = count + } + +} diff --git a/Source/DiscoveryV2/Models/DefaultQueryParamsTableResults.swift b/Source/DiscoveryV2/Models/DefaultQueryParamsTableResults.swift new file mode 100644 index 000000000..22ffd6a07 --- /dev/null +++ b/Source/DiscoveryV2/Models/DefaultQueryParamsTableResults.swift @@ -0,0 +1,66 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Default project query settings for table results. + */ +public struct DefaultQueryParamsTableResults: Codable, Equatable { + + /** + When `true`, a table results for the query are retuned by default. + */ + public var enabled: Bool? + + /** + The number of table results to return by default. + */ + public var count: Int? + + /** + The number of table results to include in each result document. + */ + public var perDocument: Int? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case enabled = "enabled" + case count = "count" + case perDocument = "per_document" + } + + /** + Initialize a `DefaultQueryParamsTableResults` with member variables. + + - parameter enabled: When `true`, a table results for the query are retuned by default. + - parameter count: The number of table results to return by default. + - parameter perDocument: The number of table results to include in each result document. + + - returns: An initialized `DefaultQueryParamsTableResults`. + */ + public init( + enabled: Bool? = nil, + count: Int? = nil, + perDocument: Int? = nil + ) + { + self.enabled = enabled + self.count = count + self.perDocument = perDocument + } + +} diff --git a/Source/DiscoveryV2/Models/DeleteDocumentResponse.swift b/Source/DiscoveryV2/Models/DeleteDocumentResponse.swift index 167b7abcf..4ba59cec3 100644 --- a/Source/DiscoveryV2/Models/DeleteDocumentResponse.swift +++ b/Source/DiscoveryV2/Models/DeleteDocumentResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/DocumentAccepted.swift b/Source/DiscoveryV2/Models/DocumentAccepted.swift index 0054dafd5..6dc10a86d 100644 --- a/Source/DiscoveryV2/Models/DocumentAccepted.swift +++ b/Source/DiscoveryV2/Models/DocumentAccepted.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/DocumentAttribute.swift b/Source/DiscoveryV2/Models/DocumentAttribute.swift index 529b9e208..522435962 100644 --- a/Source/DiscoveryV2/Models/DocumentAttribute.swift +++ b/Source/DiscoveryV2/Models/DocumentAttribute.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/Enrichment.swift b/Source/DiscoveryV2/Models/Enrichment.swift new file mode 100644 index 000000000..5171ce221 --- /dev/null +++ b/Source/DiscoveryV2/Models/Enrichment.swift @@ -0,0 +1,72 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Information about a specific enrichment. + */ +public struct Enrichment: Codable, Equatable { + + /** + The type of this enrichment. + */ + public enum TypeEnum: String { + case partOfSpeech = "part_of_speech" + case sentiment = "sentiment" + case naturalLanguageUnderstanding = "natural_language_understanding" + case dictionary = "dictionary" + case regularExpression = "regular_expression" + case uimaAnnotator = "uima_annotator" + case ruleBased = "rule_based" + case watsonKnowledgeStudioModel = "watson_knowledge_studio_model" + } + + /** + The unique identifier of this enrichment. + */ + public var enrichmentID: String? + + /** + The human readable name for this enrichment. + */ + public var name: String? + + /** + The description of this enrichment. + */ + public var description: String? + + /** + The type of this enrichment. + */ + public var type: String? + + /** + A object containing options for the current enrichment. + */ + public var options: EnrichmentOptions? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case enrichmentID = "enrichment_id" + case name = "name" + case description = "description" + case type = "type" + case options = "options" + } + +} diff --git a/Source/DiscoveryV2/Models/EnrichmentOptions.swift b/Source/DiscoveryV2/Models/EnrichmentOptions.swift new file mode 100644 index 000000000..acf9bd2f7 --- /dev/null +++ b/Source/DiscoveryV2/Models/EnrichmentOptions.swift @@ -0,0 +1,82 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + A object containing options for the current enrichment. + */ +public struct EnrichmentOptions: Codable, Equatable { + + /** + An array of supported languages for this enrichment. + */ + public var languages: [String]? + + /** + The type of entity. Required when creating `dictionary` and `regular_expression` **type** enrichment. Not valid + when creating any other type of enrichment. + */ + public var entityType: String? + + /** + The regular expression to apply for this enrichment. Required only when the **type** of enrichment being created is + a `regular_expression`. Not valid when creating any other type of enrichment. + */ + public var regularExpression: String? + + /** + The name of the result document field that this enrichment creates. Required only when the enrichment **type** is + `rule_based`. Not valid when creating any other type of enrichment. + */ + public var resultField: String? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case languages = "languages" + case entityType = "entity_type" + case regularExpression = "regular_expression" + case resultField = "result_field" + } + + /** + Initialize a `EnrichmentOptions` with member variables. + + - parameter languages: An array of supported languages for this enrichment. + - parameter entityType: The type of entity. Required when creating `dictionary` and `regular_expression` + **type** enrichment. Not valid when creating any other type of enrichment. + - parameter regularExpression: The regular expression to apply for this enrichment. Required only when the + **type** of enrichment being created is a `regular_expression`. Not valid when creating any other type of + enrichment. + - parameter resultField: The name of the result document field that this enrichment creates. Required only when + the enrichment **type** is `rule_based`. Not valid when creating any other type of enrichment. + + - returns: An initialized `EnrichmentOptions`. + */ + public init( + languages: [String]? = nil, + entityType: String? = nil, + regularExpression: String? = nil, + resultField: String? = nil + ) + { + self.languages = languages + self.entityType = entityType + self.regularExpression = regularExpression + self.resultField = resultField + } + +} diff --git a/Source/DiscoveryV2/Models/Enrichments.swift b/Source/DiscoveryV2/Models/Enrichments.swift new file mode 100644 index 000000000..f5a10f092 --- /dev/null +++ b/Source/DiscoveryV2/Models/Enrichments.swift @@ -0,0 +1,34 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + An object containing an array of enrichment definitions. + */ +public struct Enrichments: Codable, Equatable { + + /** + An array of enrichment definitions. + */ + public var enrichments: [Enrichment]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case enrichments = "enrichments" + } + +} diff --git a/Source/DiscoveryV2/Models/Field.swift b/Source/DiscoveryV2/Models/Field.swift index 933bfce83..93979ee45 100644 --- a/Source/DiscoveryV2/Models/Field.swift +++ b/Source/DiscoveryV2/Models/Field.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ListCollectionsResponse.swift b/Source/DiscoveryV2/Models/ListCollectionsResponse.swift index 25961c8c1..0882b9c85 100644 --- a/Source/DiscoveryV2/Models/ListCollectionsResponse.swift +++ b/Source/DiscoveryV2/Models/ListCollectionsResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ListFieldsResponse.swift b/Source/DiscoveryV2/Models/ListFieldsResponse.swift index 8153a6df7..bff8e4f1b 100644 --- a/Source/DiscoveryV2/Models/ListFieldsResponse.swift +++ b/Source/DiscoveryV2/Models/ListFieldsResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ListProjectsResponse.swift b/Source/DiscoveryV2/Models/ListProjectsResponse.swift new file mode 100644 index 000000000..9d168aaaa --- /dev/null +++ b/Source/DiscoveryV2/Models/ListProjectsResponse.swift @@ -0,0 +1,34 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + A list of projects in this instance. + */ +public struct ListProjectsResponse: Codable, Equatable { + + /** + An array of project details. + */ + public var projects: [ProjectListDetails]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case projects = "projects" + } + +} diff --git a/Source/DiscoveryV2/Models/Notice.swift b/Source/DiscoveryV2/Models/Notice.swift index 7713fddd7..dcc079fe0 100644 --- a/Source/DiscoveryV2/Models/Notice.swift +++ b/Source/DiscoveryV2/Models/Notice.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/ProjectCreation.swift b/Source/DiscoveryV2/Models/ProjectCreation.swift new file mode 100644 index 000000000..c8cd19840 --- /dev/null +++ b/Source/DiscoveryV2/Models/ProjectCreation.swift @@ -0,0 +1,76 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Detailed information about the specified project. + */ +internal struct ProjectCreation: Codable, Equatable { + + /** + The project type of this project. + */ + public enum TypeEnum: String { + case documentRetrieval = "document_retrieval" + case answerRetrieval = "answer_retrieval" + case contentMining = "content_mining" + case other = "other" + } + + /** + The human readable name of this project. + */ + public var name: String + + /** + The project type of this project. + */ + public var type: String + + /** + Default query parameters for this project. + */ + public var defaultQueryParameters: DefaultQueryParams? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case name = "name" + case type = "type" + case defaultQueryParameters = "default_query_parameters" + } + + /** + Initialize a `ProjectCreation` with member variables. + + - parameter name: The human readable name of this project. + - parameter type: The project type of this project. + - parameter defaultQueryParameters: Default query parameters for this project. + + - returns: An initialized `ProjectCreation`. + */ + public init( + name: String, + type: String, + defaultQueryParameters: DefaultQueryParams? = nil + ) + { + self.name = name + self.type = type + self.defaultQueryParameters = defaultQueryParameters + } + +} diff --git a/Source/DiscoveryV2/Models/ProjectDetails.swift b/Source/DiscoveryV2/Models/ProjectDetails.swift new file mode 100644 index 000000000..3af6e6989 --- /dev/null +++ b/Source/DiscoveryV2/Models/ProjectDetails.swift @@ -0,0 +1,74 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Detailed information about the specified project. + */ +public struct ProjectDetails: Codable, Equatable { + + /** + The project type of this project. + */ + public enum TypeEnum: String { + case documentRetrieval = "document_retrieval" + case answerRetrieval = "answer_retrieval" + case contentMining = "content_mining" + case other = "other" + } + + /** + The unique identifier of this project. + */ + public var projectID: String? + + /** + The human readable name of this project. + */ + public var name: String? + + /** + The project type of this project. + */ + public var type: String? + + /** + Relevancy training status information for this project. + */ + public var relevancyTrainingStatus: ProjectListDetailsRelevancyTrainingStatus? + + /** + The number of collections configured in this project. + */ + public var collectionCount: Int? + + /** + Default query parameters for this project. + */ + public var defaultQueryParameters: DefaultQueryParams? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case projectID = "project_id" + case name = "name" + case type = "type" + case relevancyTrainingStatus = "relevancy_training_status" + case collectionCount = "collection_count" + case defaultQueryParameters = "default_query_parameters" + } + +} diff --git a/Source/DiscoveryV2/Models/ProjectListDetails.swift b/Source/DiscoveryV2/Models/ProjectListDetails.swift new file mode 100644 index 000000000..422422658 --- /dev/null +++ b/Source/DiscoveryV2/Models/ProjectListDetails.swift @@ -0,0 +1,68 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Details about a specific project. + */ +public struct ProjectListDetails: Codable, Equatable { + + /** + The project type of this project. + */ + public enum TypeEnum: String { + case documentRetrieval = "document_retrieval" + case answerRetrieval = "answer_retrieval" + case contentMining = "content_mining" + case other = "other" + } + + /** + The unique identifier of this project. + */ + public var projectID: String? + + /** + The human readable name of this project. + */ + public var name: String? + + /** + The project type of this project. + */ + public var type: String? + + /** + Relevancy training status information for this project. + */ + public var relevancyTrainingStatus: ProjectListDetailsRelevancyTrainingStatus? + + /** + The number of collections configured in this project. + */ + public var collectionCount: Int? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case projectID = "project_id" + case name = "name" + case type = "type" + case relevancyTrainingStatus = "relevancy_training_status" + case collectionCount = "collection_count" + } + +} diff --git a/Source/DiscoveryV2/Models/ProjectListDetailsRelevancyTrainingStatus.swift b/Source/DiscoveryV2/Models/ProjectListDetailsRelevancyTrainingStatus.swift new file mode 100644 index 000000000..f30f65df6 --- /dev/null +++ b/Source/DiscoveryV2/Models/ProjectListDetailsRelevancyTrainingStatus.swift @@ -0,0 +1,82 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Relevancy training status information for this project. + */ +public struct ProjectListDetailsRelevancyTrainingStatus: Codable, Equatable { + + /** + When the training data was updated. + */ + public var dataUpdated: String? + + /** + The total number of examples. + */ + public var totalExamples: Int? + + /** + When `true`, sufficent label diversity is present to allow training for this project. + */ + public var sufficientLabelDiversity: Bool? + + /** + When `true`, the relevancy training is in processing. + */ + public var processing: Bool? + + /** + When `true`, the minimum number of examples required to train has been met. + */ + public var minimumExamplesAdded: Bool? + + /** + The time that the most recent successful training occured. + */ + public var successfullyTrained: String? + + /** + When `true`, relevancy training is available when querying collections in the project. + */ + public var available: Bool? + + /** + The number of notices generated during the relevancy training. + */ + public var notices: Int? + + /** + When `true`, the minimum number of queries required to train has been met. + */ + public var minimumQueriesAdded: Bool? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case dataUpdated = "data_updated" + case totalExamples = "total_examples" + case sufficientLabelDiversity = "sufficient_label_diversity" + case processing = "processing" + case minimumExamplesAdded = "minimum_examples_added" + case successfullyTrained = "successfully_trained" + case available = "available" + case notices = "notices" + case minimumQueriesAdded = "minimum_queries_added" + } + +} diff --git a/Source/DiscoveryV2/Models/ProjectName.swift b/Source/DiscoveryV2/Models/ProjectName.swift new file mode 100644 index 000000000..895b77397 --- /dev/null +++ b/Source/DiscoveryV2/Models/ProjectName.swift @@ -0,0 +1,48 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Object containing a new name for the specified project. + */ +internal struct ProjectName: Codable, Equatable { + + /** + The new name to give this project. + */ + public var name: String? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case name = "name" + } + + /** + Initialize a `ProjectName` with member variables. + + - parameter name: The new name to give this project. + + - returns: An initialized `ProjectName`. + */ + public init( + name: String? = nil + ) + { + self.name = name + } + +} diff --git a/Source/DiscoveryV2/Models/QueryAggregation.swift b/Source/DiscoveryV2/Models/QueryAggregation.swift index 28e03676a..b69c4733b 100644 --- a/Source/DiscoveryV2/Models/QueryAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,91 +16,20 @@ import Foundation -/** An aggregation produced by the Discovery service to analyze the input provided. */ -public enum QueryAggregation: Codable, Equatable { - - // reference: https://cloud.ibm.com/docs/services/discovery/query-reference.html#aggregations +/** + An abstract aggregation type produced by Discovery to analyze the input provided. + */ +public struct QueryAggregation: Codable, Equatable { - case term(QueryTermAggregation) - case filter(QueryFilterAggregation) - case nested(QueryNestedAggregation) - case histogram(QueryHistogramAggregation) - case timeslice(QueryTimesliceAggregation) - case topHits(QueryTopHitsAggregation) - case uniqueCount(QueryCalculationAggregation) - case max(QueryCalculationAggregation) - case min(QueryCalculationAggregation) - case average(QueryCalculationAggregation) - case sum(QueryCalculationAggregation) - case generic(GenericQueryAggregation) + /** + The type of aggregation command used. Options include: term, histogram, timeslice, nested, filter, min, max, sum, + average, unique_count, and top_hits. + */ + public var type: String + // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { case type = "type" } - public init(from decoder: Decoder) throws { - let container = try decoder.container(keyedBy: CodingKeys.self) - guard let type = try container.decodeIfPresent(String.self, forKey: .type) else { - // the specification does not identify `type` as a required field, - // so we need a generic catch-all in case it is not present - self = .generic(try GenericQueryAggregation(from: decoder)) - return - } - switch type { - case "term": self = .term(try QueryTermAggregation(from: decoder)) - case "filter": self = .filter(try QueryFilterAggregation(from: decoder)) - case "nested": self = .nested(try QueryNestedAggregation(from: decoder)) - case "histogram": self = .histogram(try QueryHistogramAggregation(from: decoder)) - case "timeslice": self = .timeslice(try QueryTimesliceAggregation(from: decoder)) - case "top_hits": self = .topHits(try QueryTopHitsAggregation(from: decoder)) - case "unique_count": self = .uniqueCount(try QueryCalculationAggregation(from: decoder)) - case "max": self = .max(try QueryCalculationAggregation(from: decoder)) - case "min": self = .min(try QueryCalculationAggregation(from: decoder)) - case "average": self = .average(try QueryCalculationAggregation(from: decoder)) - case "sum": self = .sum(try QueryCalculationAggregation(from: decoder)) - default: self = .generic(try GenericQueryAggregation(from: decoder)) - } - } - - public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - switch self { - case .term(let term): - try container.encode("term", forKey: .type) - try term.encode(to: encoder) - case .filter(let filter): - try container.encode("filter", forKey: .type) - try filter.encode(to: encoder) - case .nested(let nested): - try container.encode("nested", forKey: .type) - try nested.encode(to: encoder) - case .histogram(let histogram): - try container.encode("histogram", forKey: .type) - try histogram.encode(to: encoder) - case .timeslice(let timeslice): - try container.encode("timeslice", forKey: .type) - try timeslice.encode(to: encoder) - case .topHits(let topHits): - try container.encode("top_hits", forKey: .type) - try topHits.encode(to: encoder) - case .uniqueCount(let uniqueCount): - try container.encode("unique_count", forKey: .type) - try uniqueCount.encode(to: encoder) - case .max(let max): - try container.encode("max", forKey: .type) - try max.encode(to: encoder) - case .min(let min): - try container.encode("min", forKey: .type) - try min.encode(to: encoder) - case .average(let average): - try container.encode("average", forKey: .type) - try average.encode(to: encoder) - case .sum(let sum): - try container.encode("sum", forKey: .type) - try sum.encode(to: encoder) - case .generic(let generic): - try generic.encode(to: encoder) - } - } - } diff --git a/Source/DiscoveryV2/Models/QueryCalculationAggregation.swift b/Source/DiscoveryV2/Models/QueryCalculationAggregation.swift index 0efe69850..02b363c67 100644 --- a/Source/DiscoveryV2/Models/QueryCalculationAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryCalculationAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryFilterAggregation.swift b/Source/DiscoveryV2/Models/QueryFilterAggregation.swift index a1275991b..5309c19e7 100644 --- a/Source/DiscoveryV2/Models/QueryFilterAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryFilterAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryGroupByAggregation.swift b/Source/DiscoveryV2/Models/QueryGroupByAggregation.swift new file mode 100644 index 000000000..67d45bc21 --- /dev/null +++ b/Source/DiscoveryV2/Models/QueryGroupByAggregation.swift @@ -0,0 +1,41 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Returns the top values for the field specified. + */ +public struct QueryGroupByAggregation: Codable, Equatable { + + /** + The type of aggregation command used. Options include: term, histogram, timeslice, nested, filter, min, max, sum, + average, unique_count, and top_hits. + */ + public var type: String + + /** + Array of top values for the field. + */ + public var results: [QueryGroupByAggregationResult]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case type = "type" + case results = "results" + } + +} diff --git a/Source/DiscoveryV2/Models/QueryGroupByAggregationResult.swift b/Source/DiscoveryV2/Models/QueryGroupByAggregationResult.swift new file mode 100644 index 000000000..d8af1de35 --- /dev/null +++ b/Source/DiscoveryV2/Models/QueryGroupByAggregationResult.swift @@ -0,0 +1,66 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Top value result for the term aggregation. + */ +public struct QueryGroupByAggregationResult: Codable, Equatable { + + /** + Value of the field with a non-zero frequency in the document set. + */ + public var key: String + + /** + Number of documents containing the 'key'. + */ + public var matchingResults: Int + + /** + The relevancy for this group. + */ + public var relevancy: Double? + + /** + The number of documents which have the group as the value of specified field in the whole set of documents in this + collection. Returned only when the `relevancy` parameter is set to `true`. + */ + public var totalMatchingDocuments: Int? + + /** + The estimated number of documents which would match the query and also meet the condition. Returned only when the + `relevancy` parameter is set to `true`. + */ + public var estimatedMatchingDocuments: Int? + + /** + An array of sub aggregations. + */ + public var aggregations: [QueryAggregation]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case key = "key" + case matchingResults = "matching_results" + case relevancy = "relevancy" + case totalMatchingDocuments = "total_matching_documents" + case estimatedMatchingDocuments = "estimated_matching_documents" + case aggregations = "aggregations" + } + +} diff --git a/Source/DiscoveryV2/Models/QueryHistogramAggregation.swift b/Source/DiscoveryV2/Models/QueryHistogramAggregation.swift index 5fa09f4e3..1261755ce 100644 --- a/Source/DiscoveryV2/Models/QueryHistogramAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryHistogramAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryHistogramAggregationResult.swift b/Source/DiscoveryV2/Models/QueryHistogramAggregationResult.swift index c9c9f879e..7c348ccfa 100644 --- a/Source/DiscoveryV2/Models/QueryHistogramAggregationResult.swift +++ b/Source/DiscoveryV2/Models/QueryHistogramAggregationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryLarge.swift b/Source/DiscoveryV2/Models/QueryLarge.swift index b16bee888..15b46d010 100644 --- a/Source/DiscoveryV2/Models/QueryLarge.swift +++ b/Source/DiscoveryV2/Models/QueryLarge.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,37 +120,37 @@ internal struct QueryLarge: Codable, Equatable { } /** - Initialize a `QueryLarge` with member variables. - - - parameter collectionIDs: A comma-separated list of collection IDs to be queried against. - - parameter filter: A cacheable query that excludes documents that don't mention the query content. Filter - searches are better for metadata-type searches and for assessing the concepts in the data set. - - parameter query: A query search returns all documents in your data set with full enrichments and full text, - but with the most relevant documents listed first. Use a query search when you want to find the most relevant - search results. - - parameter naturalLanguageQuery: A natural language query that returns relevant documents by utilizing training - data and natural language understanding. - - parameter aggregation: An aggregation search that returns an exact answer by combining query search with - filters. Useful for applications to build lists, tables, and time series. For a full list of possible - aggregations, see the Query reference. - - parameter count: Number of results to return. - - parameter `return`: A list of the fields in the document hierarchy to return. If this parameter not specified, - then all top-level fields are returned. - - parameter offset: The number of query results to skip at the beginning. For example, if the total number of - results that are returned is 10 and the offset is 8, it returns the last two results. - - parameter sort: A comma-separated list of fields in the document to sort on. You can optionally specify a sort - direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the default sort - direction if no prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. - - parameter highlight: When `true`, a highlight field is returned for each result which contains the fields - which match the query with `` tags around the matching query terms. - - parameter spellingSuggestions: When `true` and the **natural_language_query** parameter is used, the - **natural_language_query** parameter is spell checked. The most likely correction is returned in the - **suggested_query** field of the response (if one exists). - - parameter tableResults: Configuration for table retrieval. - - parameter suggestedRefinements: Configuration for suggested refinements. - - parameter passages: Configuration for passage retrieval. - - - returns: An initialized `QueryLarge`. + Initialize a `QueryLarge` with member variables. + + - parameter collectionIDs: A comma-separated list of collection IDs to be queried against. + - parameter filter: A cacheable query that excludes documents that don't mention the query content. Filter + searches are better for metadata-type searches and for assessing the concepts in the data set. + - parameter query: A query search returns all documents in your data set with full enrichments and full text, + but with the most relevant documents listed first. Use a query search when you want to find the most relevant + search results. + - parameter naturalLanguageQuery: A natural language query that returns relevant documents by utilizing training + data and natural language understanding. + - parameter aggregation: An aggregation search that returns an exact answer by combining query search with + filters. Useful for applications to build lists, tables, and time series. For a full list of possible + aggregations, see the Query reference. + - parameter count: Number of results to return. + - parameter `return`: A list of the fields in the document hierarchy to return. If this parameter not specified, + then all top-level fields are returned. + - parameter offset: The number of query results to skip at the beginning. For example, if the total number of + results that are returned is 10 and the offset is 8, it returns the last two results. + - parameter sort: A comma-separated list of fields in the document to sort on. You can optionally specify a sort + direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the default sort + direction if no prefix is specified. This parameter cannot be used in the same query as the **bias** parameter. + - parameter highlight: When `true`, a highlight field is returned for each result which contains the fields + which match the query with `` tags around the matching query terms. + - parameter spellingSuggestions: When `true` and the **natural_language_query** parameter is used, the + **natural_language_query** parameter is spell checked. The most likely correction is returned in the + **suggested_query** field of the response (if one exists). + - parameter tableResults: Configuration for table retrieval. + - parameter suggestedRefinements: Configuration for suggested refinements. + - parameter passages: Configuration for passage retrieval. + + - returns: An initialized `QueryLarge`. */ public init( collectionIDs: [String]? = nil, diff --git a/Source/DiscoveryV2/Models/QueryLargePassages.swift b/Source/DiscoveryV2/Models/QueryLargePassages.swift index b5247d127..46f0eafa5 100644 --- a/Source/DiscoveryV2/Models/QueryLargePassages.swift +++ b/Source/DiscoveryV2/Models/QueryLargePassages.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ public struct QueryLargePassages: Codable, Equatable { /** The maximum number of passages to return. The search returns fewer passages if the requested total is not found. - The default is `10`. The maximum is `100`. + The maximum is `100`. */ public var count: Int? @@ -64,18 +64,18 @@ public struct QueryLargePassages: Codable, Equatable { } /** - Initialize a `QueryLargePassages` with member variables. + Initialize a `QueryLargePassages` with member variables. - - parameter enabled: A passages query that returns the most relevant passages from the results. - - parameter perDocument: When `true`, passages will be returned within their respective result. - - parameter maxPerDocument: Maximum number of passages to return per result. - - parameter fields: A list of fields that passages are drawn from. If this parameter not specified, then all - top-level fields are included. - - parameter count: The maximum number of passages to return. The search returns fewer passages if the requested - total is not found. The default is `10`. The maximum is `100`. - - parameter characters: The approximate number of characters that any one passage will have. + - parameter enabled: A passages query that returns the most relevant passages from the results. + - parameter perDocument: When `true`, passages will be returned within their respective result. + - parameter maxPerDocument: Maximum number of passages to return per result. + - parameter fields: A list of fields that passages are drawn from. If this parameter not specified, then all + top-level fields are included. + - parameter count: The maximum number of passages to return. The search returns fewer passages if the requested + total is not found. The maximum is `100`. + - parameter characters: The approximate number of characters that any one passage will have. - - returns: An initialized `QueryLargePassages`. + - returns: An initialized `QueryLargePassages`. */ public init( enabled: Bool? = nil, diff --git a/Source/DiscoveryV2/Models/QueryLargeSuggestedRefinements.swift b/Source/DiscoveryV2/Models/QueryLargeSuggestedRefinements.swift index 03216a4d7..220e19d97 100644 --- a/Source/DiscoveryV2/Models/QueryLargeSuggestedRefinements.swift +++ b/Source/DiscoveryV2/Models/QueryLargeSuggestedRefinements.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ public struct QueryLargeSuggestedRefinements: Codable, Equatable { public var enabled: Bool? /** - Maximum number of suggested refinements texts to be returned. The default is `10`. The maximum is `100`. + Maximum number of suggested refinements texts to be returned. The maximum is `100`. */ public var count: Int? @@ -38,13 +38,12 @@ public struct QueryLargeSuggestedRefinements: Codable, Equatable { } /** - Initialize a `QueryLargeSuggestedRefinements` with member variables. + Initialize a `QueryLargeSuggestedRefinements` with member variables. - - parameter enabled: Whether to perform suggested refinements. - - parameter count: Maximum number of suggested refinements texts to be returned. The default is `10`. The - maximum is `100`. + - parameter enabled: Whether to perform suggested refinements. + - parameter count: Maximum number of suggested refinements texts to be returned. The maximum is `100`. - - returns: An initialized `QueryLargeSuggestedRefinements`. + - returns: An initialized `QueryLargeSuggestedRefinements`. */ public init( enabled: Bool? = nil, diff --git a/Source/DiscoveryV2/Models/QueryLargeTableResults.swift b/Source/DiscoveryV2/Models/QueryLargeTableResults.swift index ff2a98add..61b9c984f 100644 --- a/Source/DiscoveryV2/Models/QueryLargeTableResults.swift +++ b/Source/DiscoveryV2/Models/QueryLargeTableResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct QueryLargeTableResults: Codable, Equatable { } /** - Initialize a `QueryLargeTableResults` with member variables. + Initialize a `QueryLargeTableResults` with member variables. - - parameter enabled: Whether to enable table retrieval. - - parameter count: Maximum number of tables to return. + - parameter enabled: Whether to enable table retrieval. + - parameter count: Maximum number of tables to return. - - returns: An initialized `QueryLargeTableResults`. + - returns: An initialized `QueryLargeTableResults`. */ public init( enabled: Bool? = nil, diff --git a/Source/DiscoveryV2/Models/QueryNestedAggregation.swift b/Source/DiscoveryV2/Models/QueryNestedAggregation.swift index be6f84b40..f7adb3b0a 100644 --- a/Source/DiscoveryV2/Models/QueryNestedAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryNestedAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryNoticesResponse.swift b/Source/DiscoveryV2/Models/QueryNoticesResponse.swift index 18b075de3..214b0096f 100644 --- a/Source/DiscoveryV2/Models/QueryNoticesResponse.swift +++ b/Source/DiscoveryV2/Models/QueryNoticesResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryResponse.swift b/Source/DiscoveryV2/Models/QueryResponse.swift index f218b99fc..7dca50cf1 100644 --- a/Source/DiscoveryV2/Models/QueryResponse.swift +++ b/Source/DiscoveryV2/Models/QueryResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryResult.swift b/Source/DiscoveryV2/Models/QueryResult.swift index 81e68c4fe..40cc49e31 100644 --- a/Source/DiscoveryV2/Models/QueryResult.swift +++ b/Source/DiscoveryV2/Models/QueryResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryResultMetadata.swift b/Source/DiscoveryV2/Models/QueryResultMetadata.swift index 251e49d38..473c23c97 100644 --- a/Source/DiscoveryV2/Models/QueryResultMetadata.swift +++ b/Source/DiscoveryV2/Models/QueryResultMetadata.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryResultPassage.swift b/Source/DiscoveryV2/Models/QueryResultPassage.swift index 8486bc581..a814a92c1 100644 --- a/Source/DiscoveryV2/Models/QueryResultPassage.swift +++ b/Source/DiscoveryV2/Models/QueryResultPassage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QuerySuggestedRefinement.swift b/Source/DiscoveryV2/Models/QuerySuggestedRefinement.swift index 7f127896a..2750d302f 100644 --- a/Source/DiscoveryV2/Models/QuerySuggestedRefinement.swift +++ b/Source/DiscoveryV2/Models/QuerySuggestedRefinement.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryTableResult.swift b/Source/DiscoveryV2/Models/QueryTableResult.swift index 5ca21e722..e2295c251 100644 --- a/Source/DiscoveryV2/Models/QueryTableResult.swift +++ b/Source/DiscoveryV2/Models/QueryTableResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryTermAggregation.swift b/Source/DiscoveryV2/Models/QueryTermAggregation.swift index 3affded6f..5ee7b5da9 100644 --- a/Source/DiscoveryV2/Models/QueryTermAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryTermAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryTermAggregationResult.swift b/Source/DiscoveryV2/Models/QueryTermAggregationResult.swift index 696e8e997..bca895c99 100644 --- a/Source/DiscoveryV2/Models/QueryTermAggregationResult.swift +++ b/Source/DiscoveryV2/Models/QueryTermAggregationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,23 @@ public struct QueryTermAggregationResult: Codable, Equatable { */ public var matchingResults: Int + /** + The relevancy for this term. + */ + public var relevancy: Double? + + /** + The number of documents which have the term as the value of specified field in the whole set of documents in this + collection. Returned only when the `relevancy` parameter is set to `true`. + */ + public var totalMatchingDocuments: Int? + + /** + The estimated number of documents which would match the query and also meet the condition. Returned only when the + `relevancy` parameter is set to `true`. + */ + public var estimatedMatchingDocuments: Int? + /** An array of sub aggregations. */ @@ -40,6 +57,9 @@ public struct QueryTermAggregationResult: Codable, Equatable { private enum CodingKeys: String, CodingKey { case key = "key" case matchingResults = "matching_results" + case relevancy = "relevancy" + case totalMatchingDocuments = "total_matching_documents" + case estimatedMatchingDocuments = "estimated_matching_documents" case aggregations = "aggregations" } diff --git a/Source/DiscoveryV2/Models/QueryTimesliceAggregation.swift b/Source/DiscoveryV2/Models/QueryTimesliceAggregation.swift index 307f5355d..01038ce8b 100644 --- a/Source/DiscoveryV2/Models/QueryTimesliceAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryTimesliceAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryTimesliceAggregationResult.swift b/Source/DiscoveryV2/Models/QueryTimesliceAggregationResult.swift index 290930d07..6007c4c0c 100644 --- a/Source/DiscoveryV2/Models/QueryTimesliceAggregationResult.swift +++ b/Source/DiscoveryV2/Models/QueryTimesliceAggregationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryTopHitsAggregation.swift b/Source/DiscoveryV2/Models/QueryTopHitsAggregation.swift index fec6c28c5..c67bf1d58 100644 --- a/Source/DiscoveryV2/Models/QueryTopHitsAggregation.swift +++ b/Source/DiscoveryV2/Models/QueryTopHitsAggregation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/QueryTopHitsAggregationResult.swift b/Source/DiscoveryV2/Models/QueryTopHitsAggregationResult.swift index 7372401f7..fc836f078 100644 --- a/Source/DiscoveryV2/Models/QueryTopHitsAggregationResult.swift +++ b/Source/DiscoveryV2/Models/QueryTopHitsAggregationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/RetrievalDetails.swift b/Source/DiscoveryV2/Models/RetrievalDetails.swift index 4e4a13c65..12c31ba10 100644 --- a/Source/DiscoveryV2/Models/RetrievalDetails.swift +++ b/Source/DiscoveryV2/Models/RetrievalDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableBodyCells.swift b/Source/DiscoveryV2/Models/TableBodyCells.swift index e5bb4df2a..cb3ecf4be 100644 --- a/Source/DiscoveryV2/Models/TableBodyCells.swift +++ b/Source/DiscoveryV2/Models/TableBodyCells.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableCellKey.swift b/Source/DiscoveryV2/Models/TableCellKey.swift index ccabecc75..63cb8bc07 100644 --- a/Source/DiscoveryV2/Models/TableCellKey.swift +++ b/Source/DiscoveryV2/Models/TableCellKey.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableCellValues.swift b/Source/DiscoveryV2/Models/TableCellValues.swift index fb5aff896..71cc0ae55 100644 --- a/Source/DiscoveryV2/Models/TableCellValues.swift +++ b/Source/DiscoveryV2/Models/TableCellValues.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableColumnHeaderIDs.swift b/Source/DiscoveryV2/Models/TableColumnHeaderIDs.swift index f281f8f3f..c867ba56a 100644 --- a/Source/DiscoveryV2/Models/TableColumnHeaderIDs.swift +++ b/Source/DiscoveryV2/Models/TableColumnHeaderIDs.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableColumnHeaderTexts.swift b/Source/DiscoveryV2/Models/TableColumnHeaderTexts.swift index f4f7aff49..aa7e55ec7 100644 --- a/Source/DiscoveryV2/Models/TableColumnHeaderTexts.swift +++ b/Source/DiscoveryV2/Models/TableColumnHeaderTexts.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableColumnHeaderTextsNormalized.swift b/Source/DiscoveryV2/Models/TableColumnHeaderTextsNormalized.swift index 73fa17c52..f1b6363be 100644 --- a/Source/DiscoveryV2/Models/TableColumnHeaderTextsNormalized.swift +++ b/Source/DiscoveryV2/Models/TableColumnHeaderTextsNormalized.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableColumnHeaders.swift b/Source/DiscoveryV2/Models/TableColumnHeaders.swift index f535ffdb1..8ef2a1ac7 100644 --- a/Source/DiscoveryV2/Models/TableColumnHeaders.swift +++ b/Source/DiscoveryV2/Models/TableColumnHeaders.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableElementLocation.swift b/Source/DiscoveryV2/Models/TableElementLocation.swift index 29dd4a31c..372050d5c 100644 --- a/Source/DiscoveryV2/Models/TableElementLocation.swift +++ b/Source/DiscoveryV2/Models/TableElementLocation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableHeaders.swift b/Source/DiscoveryV2/Models/TableHeaders.swift index 2c94f795e..d9c0c303f 100644 --- a/Source/DiscoveryV2/Models/TableHeaders.swift +++ b/Source/DiscoveryV2/Models/TableHeaders.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableKeyValuePairs.swift b/Source/DiscoveryV2/Models/TableKeyValuePairs.swift index 00cdf7962..228348a0c 100644 --- a/Source/DiscoveryV2/Models/TableKeyValuePairs.swift +++ b/Source/DiscoveryV2/Models/TableKeyValuePairs.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableResultTable.swift b/Source/DiscoveryV2/Models/TableResultTable.swift index e4f9f3e38..8df3c4fe5 100644 --- a/Source/DiscoveryV2/Models/TableResultTable.swift +++ b/Source/DiscoveryV2/Models/TableResultTable.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableRowHeaderIDs.swift b/Source/DiscoveryV2/Models/TableRowHeaderIDs.swift index 6f7ca235b..9b51602ea 100644 --- a/Source/DiscoveryV2/Models/TableRowHeaderIDs.swift +++ b/Source/DiscoveryV2/Models/TableRowHeaderIDs.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableRowHeaderTexts.swift b/Source/DiscoveryV2/Models/TableRowHeaderTexts.swift index 7fab790bd..2526d1909 100644 --- a/Source/DiscoveryV2/Models/TableRowHeaderTexts.swift +++ b/Source/DiscoveryV2/Models/TableRowHeaderTexts.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableRowHeaderTextsNormalized.swift b/Source/DiscoveryV2/Models/TableRowHeaderTextsNormalized.swift index 08bfd192f..fae008f47 100644 --- a/Source/DiscoveryV2/Models/TableRowHeaderTextsNormalized.swift +++ b/Source/DiscoveryV2/Models/TableRowHeaderTextsNormalized.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableRowHeaders.swift b/Source/DiscoveryV2/Models/TableRowHeaders.swift index 7c860024a..66569e2e5 100644 --- a/Source/DiscoveryV2/Models/TableRowHeaders.swift +++ b/Source/DiscoveryV2/Models/TableRowHeaders.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TableTextLocation.swift b/Source/DiscoveryV2/Models/TableTextLocation.swift index f916ac6f0..73eecd7b1 100644 --- a/Source/DiscoveryV2/Models/TableTextLocation.swift +++ b/Source/DiscoveryV2/Models/TableTextLocation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/TrainingExample.swift b/Source/DiscoveryV2/Models/TrainingExample.swift index a7d207010..cf39a7933 100644 --- a/Source/DiscoveryV2/Models/TrainingExample.swift +++ b/Source/DiscoveryV2/Models/TrainingExample.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,15 +56,15 @@ public struct TrainingExample: Codable, Equatable { } /** - Initialize a `TrainingExample` with member variables. + Initialize a `TrainingExample` with member variables. - - parameter documentID: The document ID associated with this training example. - - parameter collectionID: The collection ID associated with this training example. - - parameter relevance: The relevance of the training example. - - parameter created: The date and time the example was created. - - parameter updated: The date and time the example was updated. + - parameter documentID: The document ID associated with this training example. + - parameter collectionID: The collection ID associated with this training example. + - parameter relevance: The relevance of the training example. + - parameter created: The date and time the example was created. + - parameter updated: The date and time the example was updated. - - returns: An initialized `TrainingExample`. + - returns: An initialized `TrainingExample`. */ public init( documentID: String, diff --git a/Source/DiscoveryV2/Models/TrainingQuery.swift b/Source/DiscoveryV2/Models/TrainingQuery.swift index bdb46b857..97a383ffe 100644 --- a/Source/DiscoveryV2/Models/TrainingQuery.swift +++ b/Source/DiscoveryV2/Models/TrainingQuery.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,16 +62,16 @@ public struct TrainingQuery: Codable, Equatable { } /** - Initialize a `TrainingQuery` with member variables. + Initialize a `TrainingQuery` with member variables. - - parameter naturalLanguageQuery: The natural text query for the training query. - - parameter examples: Array of training examples. - - parameter queryID: The query ID associated with the training query. - - parameter filter: The filter used on the collection before the **natural_language_query** is applied. - - parameter created: The date and time the query was created. - - parameter updated: The date and time the query was updated. + - parameter naturalLanguageQuery: The natural text query for the training query. + - parameter examples: Array of training examples. + - parameter queryID: The query ID associated with the training query. + - parameter filter: The filter used on the collection before the **natural_language_query** is applied. + - parameter created: The date and time the query was created. + - parameter updated: The date and time the query was updated. - - returns: An initialized `TrainingQuery`. + - returns: An initialized `TrainingQuery`. */ public init( naturalLanguageQuery: String, diff --git a/Source/DiscoveryV2/Models/TrainingQuerySet.swift b/Source/DiscoveryV2/Models/TrainingQuerySet.swift index bdeaae7b8..fd4408a7b 100644 --- a/Source/DiscoveryV2/Models/TrainingQuerySet.swift +++ b/Source/DiscoveryV2/Models/TrainingQuerySet.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/DiscoveryV2/Models/UpdateCollection.swift b/Source/DiscoveryV2/Models/UpdateCollection.swift new file mode 100644 index 000000000..086828e19 --- /dev/null +++ b/Source/DiscoveryV2/Models/UpdateCollection.swift @@ -0,0 +1,66 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + A collection for storing documents. + */ +internal struct UpdateCollection: Codable, Equatable { + + /** + The name of the collection. + */ + public var name: String? + + /** + A description of the collection. + */ + public var description: String? + + /** + An array of enrichments that are applied to this collection. + */ + public var enrichments: [CollectionEnrichment]? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case name = "name" + case description = "description" + case enrichments = "enrichments" + } + + /** + Initialize a `UpdateCollection` with member variables. + + - parameter name: The name of the collection. + - parameter description: A description of the collection. + - parameter enrichments: An array of enrichments that are applied to this collection. + + - returns: An initialized `UpdateCollection`. + */ + public init( + name: String? = nil, + description: String? = nil, + enrichments: [CollectionEnrichment]? = nil + ) + { + self.name = name + self.description = description + self.enrichments = enrichments + } + +} diff --git a/Source/DiscoveryV2/Models/UpdateEnrichment.swift b/Source/DiscoveryV2/Models/UpdateEnrichment.swift new file mode 100644 index 000000000..3b48c091e --- /dev/null +++ b/Source/DiscoveryV2/Models/UpdateEnrichment.swift @@ -0,0 +1,57 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + An object containing a new name and description for an enrichment. + */ +internal struct UpdateEnrichment: Codable, Equatable { + + /** + A new name for the enrichment. + */ + public var name: String + + /** + A new description for the enrichment. + */ + public var description: String? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case name = "name" + case description = "description" + } + + /** + Initialize a `UpdateEnrichment` with member variables. + + - parameter name: A new name for the enrichment. + - parameter description: A new description for the enrichment. + + - returns: An initialized `UpdateEnrichment`. + */ + public init( + name: String, + description: String? = nil + ) + { + self.name = name + self.description = description + } + +} diff --git a/Source/LanguageTranslatorV3/LanguageTranslator.swift b/Source/LanguageTranslatorV3/LanguageTranslator.swift index 76c37d48f..6a70a546e 100644 --- a/Source/LanguageTranslatorV3/LanguageTranslator.swift +++ b/Source/LanguageTranslatorV3/LanguageTranslator.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,15 @@ import Foundation import IBMSwiftSDKCore /** - IBM Watson™ Language Translator translates text from one language to another. The service offers multiple IBM - provided translation models that you can customize based on your unique terminology and language. Use Language + IBM Watson™ Language Translator translates text from one language to another. The service offers multiple + IBM-provided translation models that you can customize based on your unique terminology and language. Use Language Translator to take news from across the globe and present it in your language, communicate with your customers in their own language, and more. */ public class LanguageTranslator { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/language-translator/api" + public var serviceURL: String? = "https://api.us-south.language-translator.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "LanguageTranslator" @@ -55,10 +55,11 @@ public class LanguageTranslator { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -84,8 +85,8 @@ public class LanguageTranslator { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -128,17 +129,68 @@ public class LanguageTranslator { } /** - Translate. + List supported languages. + + Lists all supported languages. The method returns an array of supported languages with information about each + language. Languages are listed in alphabetical order by language code (for example, `af`, `ar`). + + - parameter headers: A dictionary of request headers to be sent with this request. + - parameter completionHandler: A function executed when the request completes with a successful result or error + */ + public func listLanguages( + headers: [String: String]? = nil, + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + { + // construct header parameters + var headerParameters = defaultHeaders + if let headers = headers { + headerParameters.merge(headers) { (_, new) in new } + } + let sdkHeaders = Shared.getSDKHeaders(serviceName: serviceName, serviceVersion: serviceVersion, methodName: "listLanguages") + headerParameters.merge(sdkHeaders) { (_, new) in new } + headerParameters["Accept"] = "application/json" + + // construct query parameters + var queryParameters = [URLQueryItem]() + queryParameters.append(URLQueryItem(name: "version", value: version)) + + // construct REST request + + // ensure that serviceURL is set + guard let serviceEndpoint = serviceURL else { + completionHandler(nil, WatsonError.noEndpoint) + return + } + + let request = RestRequest( + session: session, + authenticator: authenticator, + errorResponseDecoder: errorResponseDecoder, + method: "GET", + url: serviceEndpoint + "/v3/languages", + headerParameters: headerParameters, + queryItems: queryParameters + ) - Translates the input text from the source language to the target language. A target language or translation model - ID is required. The service attempts to detect the language of the source text if it is not specified. + // execute REST request + request.responseObject(completionHandler: completionHandler) + } + + /** + Translate. - - parameter text: Input text in UTF-8 encoding. Multiple entries will result in multiple translations in the - response. - - parameter modelID: The model to use for translation. For example, `en-de` selects the IBM provided base model - for English to German translation. A model ID overrides the source and target parameters and is required if you - use a custom model. If no model ID is specified, you must specify a target language. - - parameter source: Language code that specifies the language of the source document. + Translates the input text from the source language to the target language. Specify a model ID that indicates the + source and target languages, or specify the source and target languages individually. You can omit the source + language to have the service attempt to detect the language from the input text. If you omit the source language, + the request must contain sufficient input text for the service to identify the source language. + + - parameter text: Input text in UTF-8 encoding. Multiple entries result in multiple translations in the response. + - parameter modelID: The model to use for translation. For example, `en-de` selects the IBM-provided base model + for English-to-German translation. A model ID overrides the `source` and `target` parameters and is required if + you use a custom model. If no model ID is specified, you must specify at least a target language. + - parameter source: Language code that specifies the language of the input text. If omitted, the service derives + the source language from the input text. The input must contain sufficient text for the service to identify the + language reliably. - parameter target: Language code that specifies the target language for translation. Required if model ID is not specified. - parameter headers: A dictionary of request headers to be sent with this request. @@ -314,10 +366,10 @@ public class LanguageTranslator { - parameter source: Specify a language code to filter results by source language. - parameter target: Specify a language code to filter results by target language. - - parameter `default`: 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. + - parameter `default`: If the `default` parameter isn't specified, the service returns all models (default and + non-default) for each language pair. To return only default models, set this parameter to `true`. To return only + non-default models, set this parameter to `false`. There is exactly one default model, the IBM-provided base + model, per language pair. - parameter headers: A dictionary of request headers to be sent with this request. - parameter completionHandler: A function executed when the request completes with a successful result or error */ @@ -378,29 +430,74 @@ public class LanguageTranslator { /** Create model. - Uploads Translation Memory eXchange (TMX) files to customize a translation model. - You can either customize a model with a forced glossary or with a corpus that contains parallel sentences. To - create a model that is customized with a parallel corpus and a forced glossary, proceed in two steps: - customize with a parallel corpus first and then customize the resulting model with a glossary. Depending on the - type of customization and the size of the uploaded corpora, training can range from minutes for a glossary to - several hours for a large parallel corpus. You can upload a single forced glossary file and this file must be less - than 10 MB. You can upload multiple parallel corpora tmx files. The cumulative file size of all uploaded - 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 maximum of 10 custom models per language pair. - - - parameter baseModelID: The model ID of the model to use as the base for customization. To see available models, - use the `List models` method. Usually all IBM provided models are customizable. In addition, all your models that - have been created via parallel corpus customization, can be further customized with a forced glossary. - - parameter forcedGlossary: A TMX file with your customizations. The customizations in the file completely - overwrite the domain translaton data, including high frequency or high confidence phrase translations. You can - upload only one glossary with a file size less than 10 MB per call. A forced glossary should contain single words - or short phrases. - - parameter parallelCorpus: A TMX file with parallel sentences for source and target language. You can upload - multiple parallel_corpus files in one request. All uploaded parallel_corpus files combined, your parallel corpus - must contain at least 5,000 parallel sentences to train successfully. + Uploads training files to customize a translation model. You can customize a model with a forced glossary or with a + parallel corpus: + * Use a *forced glossary* to force certain terms and phrases to be translated in a specific way. You can upload + only a single forced glossary file for a model. The size of a forced glossary file for a custom model is limited to + 10 MB. + * Use a *parallel corpus* when you want your custom model to learn from general translation patterns in parallel + sentences in your samples. What your model learns from a parallel corpus can improve translation results for input + text that the model has not been trained on. You can upload multiple parallel corpora files with a request. To + successfully train with parallel corpora, the corpora files must contain a cumulative total of at least 5000 + parallel sentences. The cumulative size of all uploaded corpus files for a custom model is limited to 250 MB. + Depending on the type of customization and the size of the uploaded files, training time can range from minutes for + a glossary to several hours for a large parallel corpus. To create a model that is customized with a parallel + corpus and a forced glossary, customize the model with a parallel corpus first and then customize the resulting + model with a forced glossary. + You can create a maximum of 10 custom models per language pair. For more information about customizing a + translation model, including the formatting and character restrictions for data files, see [Customizing your + model](https://cloud.ibm.com/docs/language-translator?topic=language-translator-customizing). + #### Supported file formats + You can provide your training data for customization in the following document formats: + * **TMX** (`.tmx`) - Translation Memory eXchange (TMX) is an XML specification for the exchange of translation + memories. + * **XLIFF** (`.xliff`) - XML Localization Interchange File Format (XLIFF) is an XML specification for the exchange + of translation memories. + * **CSV** (`.csv`) - Comma-separated values (CSV) file with two columns for aligned sentences and phrases. The + first row contains the language code. + * **TSV** (`.tsv` or `.tab`) - Tab-separated values (TSV) file with two columns for aligned sentences and phrases. + The first row contains the language code. + * **JSON** (`.json`) - Custom JSON format for specifying aligned sentences and phrases. + * **Microsoft Excel** (`.xls` or `.xlsx`) - Excel file with the first two columns for aligned sentences and + phrases. The first row contains the language code. + You must encode all text data in UTF-8 format. For more information, see [Supported document formats for training + data](https://cloud.ibm.com/docs/language-translator?topic=language-translator-customizing#supported-document-formats-for-training-data). + #### Specifying file formats + You can indicate the format of a file by including the file extension with the file name. Use the file extensions + shown in **Supported file formats**. + Alternatively, you can omit the file extension and specify one of the following `content-type` specifications for + the file: + * **TMX** - `application/x-tmx+xml` + * **XLIFF** - `application/xliff+xml` + * **CSV** - `text/csv` + * **TSV** - `text/tab-separated-values` + * **JSON** - `application/json` + * **Microsoft Excel** - `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` + For example, with `curl`, use the following `content-type` specification to indicate the format of a CSV file named + **glossary**: + `--form "forced_glossary=@glossary;type=text/csv"`. + + - parameter baseModelID: The ID of the translation model to use as the base for customization. To see available + models and IDs, use the `List models` method. Most models that are provided with the service are customizable. In + addition, all models that you create with parallel corpora customization can be further customized with a forced + glossary. + - parameter forcedGlossary: A file with forced glossary terms for the source and target languages. The + customizations in the file completely overwrite the domain translation data, including high frequency or high + confidence phrase translations. + You can upload only one glossary file for a custom model, and the glossary can have a maximum size of 10 MB. A + forced glossary must contain single words or short phrases. For more information, see **Supported file formats** + in the method description. + *With `curl`, use `--form forced_glossary=@{filename}`.*. + - parameter parallelCorpus: A file with parallel sentences for the source and target languages. You can upload + multiple parallel corpus files in one request by repeating the parameter. All uploaded parallel corpus files + combined must contain at least 5000 parallel sentences to train successfully. You can provide a maximum of + 500,000 parallel sentences across all corpora. + A single entry in a corpus file can contain a maximum of 80 words. All corpora files for a custom model can have + a cumulative maximum size of 250 MB. For more information, see **Supported file formats** in the method + description. + *With `curl`, use `--form parallel_corpus=@{filename}`.*. - parameter name: An optional model name that you can use to identify the model. Valid characters are letters, - numbers, dashes, underscores, spaces and apostrophes. The maximum length is 32 characters. + numbers, dashes, underscores, spaces, and apostrophes. The maximum length of the name is 32 characters. - parameter headers: A dictionary of request headers to be sent with this request. - parameter completionHandler: A function executed when the request completes with a successful result or error */ @@ -525,7 +622,7 @@ public class LanguageTranslator { Get model details. Gets information about a translation model, including training status for custom models. Use this API call to poll - the status of your customization request. A successfully completed training will have a status of `available`. + the status of your customization request. A successfully completed training has a status of `available`. - parameter modelID: Model ID of the model to get. - parameter headers: A dictionary of request headers to be sent with this request. @@ -635,10 +732,12 @@ public class LanguageTranslator { Maximum file size: **20 MB**. - parameter filename: The filename for file. - parameter fileContentType: The content type of file. - - parameter modelID: The model to use for translation. For example, `en-de` selects the IBM provided base model - for English to German translation. A model ID overrides the source and target parameters and is required if you - use a custom model. If no model ID is specified, you must specify a target language. - - parameter source: Language code that specifies the language of the source document. + - parameter modelID: The model to use for translation. For example, `en-de` selects the IBM-provided base model + for English-to-German translation. A model ID overrides the `source` and `target` parameters and is required if + you use a custom model. If no model ID is specified, you must specify at least a target language. + - parameter source: Language code that specifies the language of the source document. If omitted, the service + derives the source language from the input text. The input must contain sufficient text for the service to + identify the language reliably. - parameter target: Language code that specifies the target language for translation. Required if model ID is not specified. - parameter documentID: To use a previously submitted document as the source for a new translation, enter the diff --git a/Source/LanguageTranslatorV3/Models/DeleteModelResult.swift b/Source/LanguageTranslatorV3/Models/DeleteModelResult.swift index d5d3c9ef3..e000956aa 100644 --- a/Source/LanguageTranslatorV3/Models/DeleteModelResult.swift +++ b/Source/LanguageTranslatorV3/Models/DeleteModelResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/DocumentList.swift b/Source/LanguageTranslatorV3/Models/DocumentList.swift index c01f4da54..9854dcb38 100644 --- a/Source/LanguageTranslatorV3/Models/DocumentList.swift +++ b/Source/LanguageTranslatorV3/Models/DocumentList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/DocumentStatus.swift b/Source/LanguageTranslatorV3/Models/DocumentStatus.swift index 0644f4e84..19bfcc2af 100644 --- a/Source/LanguageTranslatorV3/Models/DocumentStatus.swift +++ b/Source/LanguageTranslatorV3/Models/DocumentStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/IdentifiableLanguage.swift b/Source/LanguageTranslatorV3/Models/IdentifiableLanguage.swift index 5967d70bc..1096a56b4 100644 --- a/Source/LanguageTranslatorV3/Models/IdentifiableLanguage.swift +++ b/Source/LanguageTranslatorV3/Models/IdentifiableLanguage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/IdentifiableLanguages.swift b/Source/LanguageTranslatorV3/Models/IdentifiableLanguages.swift index 952342a96..c87ce9c16 100644 --- a/Source/LanguageTranslatorV3/Models/IdentifiableLanguages.swift +++ b/Source/LanguageTranslatorV3/Models/IdentifiableLanguages.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/IdentifiedLanguage.swift b/Source/LanguageTranslatorV3/Models/IdentifiedLanguage.swift index bd940170e..7fbaf79bb 100644 --- a/Source/LanguageTranslatorV3/Models/IdentifiedLanguage.swift +++ b/Source/LanguageTranslatorV3/Models/IdentifiedLanguage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/IdentifiedLanguages.swift b/Source/LanguageTranslatorV3/Models/IdentifiedLanguages.swift index ccb64757d..d894a904c 100644 --- a/Source/LanguageTranslatorV3/Models/IdentifiedLanguages.swift +++ b/Source/LanguageTranslatorV3/Models/IdentifiedLanguages.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/Language.swift b/Source/LanguageTranslatorV3/Models/Language.swift new file mode 100644 index 000000000..d932a352e --- /dev/null +++ b/Source/LanguageTranslatorV3/Models/Language.swift @@ -0,0 +1,86 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + Response payload for languages. + */ +public struct Language: Codable, Equatable { + + /** + The language code for the language (for example, `af`). + */ + public var language: String? + + /** + The name of the language in English (for example, `Afrikaans`). + */ + public var languageName: String? + + /** + The native name of the language (for example, `Afrikaans`). + */ + public var nativeLanguageName: String? + + /** + The country code for the language (for example, `ZA` for South Africa). + */ + public var countryCode: String? + + /** + Indicates whether words of the language are separated by whitespace: `true` if the words are separated; `false` + otherwise. + */ + public var wordsSeparated: Bool? + + /** + Indicates the direction of the language: `right_to_left` or `left_to_right`. + */ + public var direction: String? + + /** + Indicates whether the language can be used as the source for translation: `true` if the language can be used as the + source; `false` otherwise. + */ + public var supportedAsSource: Bool? + + /** + Indicates whether the language can be used as the target for translation: `true` if the language can be used as the + target; `false` otherwise. + */ + public var supportedAsTarget: Bool? + + /** + Indicates whether the language supports automatic detection: `true` if the language can be detected automatically; + `false` otherwise. + */ + public var identifiable: Bool? + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case language = "language" + case languageName = "language_name" + case nativeLanguageName = "native_language_name" + case countryCode = "country_code" + case wordsSeparated = "words_separated" + case direction = "direction" + case supportedAsSource = "supported_as_source" + case supportedAsTarget = "supported_as_target" + case identifiable = "identifiable" + } + +} diff --git a/Source/LanguageTranslatorV3/Models/Languages.swift b/Source/LanguageTranslatorV3/Models/Languages.swift new file mode 100644 index 000000000..18f16e4c5 --- /dev/null +++ b/Source/LanguageTranslatorV3/Models/Languages.swift @@ -0,0 +1,34 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.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. + **/ + +import Foundation + +/** + The response type for listing supported languages. + */ +public struct Languages: Codable, Equatable { + + /** + An array of supported languages with information about each language. + */ + public var languages: [Language] + + // Map each property name to the key that shall be used for encoding/decoding. + private enum CodingKeys: String, CodingKey { + case languages = "languages" + } + +} diff --git a/Source/LanguageTranslatorV3/Models/TranslateRequest.swift b/Source/LanguageTranslatorV3/Models/TranslateRequest.swift index e51319a60..f55d72fb5 100644 --- a/Source/LanguageTranslatorV3/Models/TranslateRequest.swift +++ b/Source/LanguageTranslatorV3/Models/TranslateRequest.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,19 +20,20 @@ import Foundation internal struct TranslateRequest: Codable, Equatable { /** - Input text in UTF-8 encoding. Multiple entries will result in multiple translations in the response. + Input text in UTF-8 encoding. Multiple entries result in multiple translations in the response. */ public var text: [String] /** - The model to use for translation. For example, `en-de` selects the IBM provided base model for English to German - translation. A model ID overrides the source and target parameters and is required if you use a custom model. If no - model ID is specified, you must specify a target language. + The model to use for translation. For example, `en-de` selects the IBM-provided base model for English-to-German + translation. A model ID overrides the `source` and `target` parameters and is required if you use a custom model. + If no model ID is specified, you must specify at least a target language. */ public var modelID: String? /** - Language code that specifies the language of the source document. + Language code that specifies the language of the input text. If omitted, the service derives the source language + from the input text. The input must contain sufficient text for the service to identify the language reliably. */ public var source: String? @@ -50,18 +51,20 @@ internal struct TranslateRequest: Codable, Equatable { } /** - Initialize a `TranslateRequest` with member variables. + Initialize a `TranslateRequest` with member variables. - - parameter text: Input text in UTF-8 encoding. Multiple entries will result in multiple translations in the - response. - - parameter modelID: The model to use for translation. For example, `en-de` selects the IBM provided base model - for English to German translation. A model ID overrides the source and target parameters and is required if you - use a custom model. If no model ID is specified, you must specify a target language. - - parameter source: Language code that specifies the language of the source document. - - parameter target: Language code that specifies the target language for translation. Required if model ID is - not specified. + - parameter text: Input text in UTF-8 encoding. Multiple entries result in multiple translations in the + response. + - parameter modelID: The model to use for translation. For example, `en-de` selects the IBM-provided base model + for English-to-German translation. A model ID overrides the `source` and `target` parameters and is required if + you use a custom model. If no model ID is specified, you must specify at least a target language. + - parameter source: Language code that specifies the language of the input text. If omitted, the service derives + the source language from the input text. The input must contain sufficient text for the service to identify the + language reliably. + - parameter target: Language code that specifies the target language for translation. Required if model ID is + not specified. - - returns: An initialized `TranslateRequest`. + - returns: An initialized `TranslateRequest`. */ public init( text: [String], diff --git a/Source/LanguageTranslatorV3/Models/Translation.swift b/Source/LanguageTranslatorV3/Models/Translation.swift index 106a72e01..16fce32d6 100644 --- a/Source/LanguageTranslatorV3/Models/Translation.swift +++ b/Source/LanguageTranslatorV3/Models/Translation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/TranslationModel.swift b/Source/LanguageTranslatorV3/Models/TranslationModel.swift index df883c9fe..2a89c4f87 100644 --- a/Source/LanguageTranslatorV3/Models/TranslationModel.swift +++ b/Source/LanguageTranslatorV3/Models/TranslationModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/TranslationModels.swift b/Source/LanguageTranslatorV3/Models/TranslationModels.swift index 9476d63e8..b32d5a618 100644 --- a/Source/LanguageTranslatorV3/Models/TranslationModels.swift +++ b/Source/LanguageTranslatorV3/Models/TranslationModels.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/LanguageTranslatorV3/Models/TranslationResult.swift b/Source/LanguageTranslatorV3/Models/TranslationResult.swift index 22b3c96ae..440d2dfa9 100644 --- a/Source/LanguageTranslatorV3/Models/TranslationResult.swift +++ b/Source/LanguageTranslatorV3/Models/TranslationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageClassifierV1/Models/Classification.swift b/Source/NaturalLanguageClassifierV1/Models/Classification.swift index 3839560a3..f45646672 100644 --- a/Source/NaturalLanguageClassifierV1/Models/Classification.swift +++ b/Source/NaturalLanguageClassifierV1/Models/Classification.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageClassifierV1/Models/ClassificationCollection.swift b/Source/NaturalLanguageClassifierV1/Models/ClassificationCollection.swift index 6cdb8bf16..2c5008d56 100644 --- a/Source/NaturalLanguageClassifierV1/Models/ClassificationCollection.swift +++ b/Source/NaturalLanguageClassifierV1/Models/ClassificationCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageClassifierV1/Models/ClassifiedClass.swift b/Source/NaturalLanguageClassifierV1/Models/ClassifiedClass.swift index f6ac69602..872b512d9 100644 --- a/Source/NaturalLanguageClassifierV1/Models/ClassifiedClass.swift +++ b/Source/NaturalLanguageClassifierV1/Models/ClassifiedClass.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageClassifierV1/Models/Classifier.swift b/Source/NaturalLanguageClassifierV1/Models/Classifier.swift index 328a6f8e7..6bec8aa79 100644 --- a/Source/NaturalLanguageClassifierV1/Models/Classifier.swift +++ b/Source/NaturalLanguageClassifierV1/Models/Classifier.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageClassifierV1/Models/ClassifierList.swift b/Source/NaturalLanguageClassifierV1/Models/ClassifierList.swift index 45a7e7c0b..cffd0e028 100644 --- a/Source/NaturalLanguageClassifierV1/Models/ClassifierList.swift +++ b/Source/NaturalLanguageClassifierV1/Models/ClassifierList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageClassifierV1/Models/ClassifyCollectionInput.swift b/Source/NaturalLanguageClassifierV1/Models/ClassifyCollectionInput.swift index bba831fdb..4320ed04f 100644 --- a/Source/NaturalLanguageClassifierV1/Models/ClassifyCollectionInput.swift +++ b/Source/NaturalLanguageClassifierV1/Models/ClassifyCollectionInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ internal struct ClassifyCollectionInput: Codable, Equatable { } /** - Initialize a `ClassifyCollectionInput` with member variables. + Initialize a `ClassifyCollectionInput` with member variables. - - parameter collection: The submitted phrases. + - parameter collection: The submitted phrases. - - returns: An initialized `ClassifyCollectionInput`. + - returns: An initialized `ClassifyCollectionInput`. */ public init( collection: [ClassifyInput] diff --git a/Source/NaturalLanguageClassifierV1/Models/ClassifyInput.swift b/Source/NaturalLanguageClassifierV1/Models/ClassifyInput.swift index 252ad33ff..dc33fadd0 100644 --- a/Source/NaturalLanguageClassifierV1/Models/ClassifyInput.swift +++ b/Source/NaturalLanguageClassifierV1/Models/ClassifyInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct ClassifyInput: Codable, Equatable { } /** - Initialize a `ClassifyInput` with member variables. + Initialize a `ClassifyInput` with member variables. - - parameter text: The submitted phrase. The maximum length is 2048 characters. + - parameter text: The submitted phrase. The maximum length is 2048 characters. - - returns: An initialized `ClassifyInput`. + - returns: An initialized `ClassifyInput`. */ public init( text: String diff --git a/Source/NaturalLanguageClassifierV1/Models/CollectionItem.swift b/Source/NaturalLanguageClassifierV1/Models/CollectionItem.swift index 7a397077f..d574098fa 100644 --- a/Source/NaturalLanguageClassifierV1/Models/CollectionItem.swift +++ b/Source/NaturalLanguageClassifierV1/Models/CollectionItem.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageClassifierV1/NaturalLanguageClassifier.swift b/Source/NaturalLanguageClassifierV1/NaturalLanguageClassifier.swift index 73f36785d..c0ec0a6cc 100644 --- a/Source/NaturalLanguageClassifierV1/NaturalLanguageClassifier.swift +++ b/Source/NaturalLanguageClassifierV1/NaturalLanguageClassifier.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import IBMSwiftSDKCore public class NaturalLanguageClassifier { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/natural-language-classifier/api" + public var serviceURL: String? = "https://api.us-south.natural-language-classifier.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "NaturalLanguageClassifier" @@ -51,8 +51,10 @@ public class NaturalLanguageClassifier { In that case, try another initializer that directly passes in the credentials. */ - public init() throws { - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + public init?() { + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -75,8 +77,8 @@ public class NaturalLanguageClassifier { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() diff --git a/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResults.swift index 177f6c5b6..fd00dbc35 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsMetadata.swift b/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsMetadata.swift index f397aed2b..d7882d620 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsMetadata.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsMetadata.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsUsage.swift b/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsUsage.swift index 21f710ea4..f225436ea 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsUsage.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/AnalysisResultsUsage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/Author.swift b/Source/NaturalLanguageUnderstandingV1/Models/Author.swift index b846576a2..9ecd9a657 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/Author.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/Author.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesOptions.swift index feeac1b3d..881f33e82 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,10 @@ public struct CategoriesOptions: Codable, Equatable { Enter a [custom model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) ID to override the standard categories model. + The custom categories experimental feature will be retired on 19 December 2019. On that date, deployed custom + categories models will no longer be accessible in Natural Language Understanding. The feature will be removed from + Knowledge Studio on an earlier date. Custom categories models will no longer be accessible in Knowledge Studio on + 17 December 2019. */ public var model: String? @@ -48,14 +52,20 @@ public struct CategoriesOptions: Codable, Equatable { } /** - Initialize a `CategoriesOptions` with member variables. - - parameter explanation: Set this to `true` to return explanations for each categorization. **This is available - only for English categories.**. - - parameter limit: Maximum number of categories to return. - - parameter model: Enter a [custom - model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) - ID to override the standard categories model. - - returns: An initialized `CategoriesOptions`. + Initialize a `CategoriesOptions` with member variables. + + - parameter explanation: Set this to `true` to return explanations for each categorization. **This is available + only for English categories.**. + - parameter limit: Maximum number of categories to return. + - parameter model: Enter a [custom + model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) + ID to override the standard categories model. + The custom categories experimental feature will be retired on 19 December 2019. On that date, deployed custom + categories models will no longer be accessible in Natural Language Understanding. The feature will be removed + from Knowledge Studio on an earlier date. Custom categories models will no longer be accessible in Knowledge + Studio on 17 December 2019. + + - returns: An initialized `CategoriesOptions`. */ public init( explanation: Bool? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesRelevantText.swift b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesRelevantText.swift index 5c9f667ea..5aa648454 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesRelevantText.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesRelevantText.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResult.swift index 083422c1d..c25afb38a 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,9 @@ import Foundation public struct CategoriesResult: Codable, Equatable { /** - The path to the category through the 5-level taxonomy hierarchy. For the complete list of categories, see the + The path to the category through the 5-level taxonomy hierarchy. For more information about the categories, see [Categories - hierarchy](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy) - documentation. + hierarchy](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy). */ public var label: String? diff --git a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResultExplanation.swift b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResultExplanation.swift index 4e1f0e50f..30ce3ab14 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResultExplanation.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/CategoriesResultExplanation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/ConceptsOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/ConceptsOptions.swift index af064a217..26c89dee8 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/ConceptsOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/ConceptsOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,11 +34,11 @@ public struct ConceptsOptions: Codable, Equatable { } /** - Initialize a `ConceptsOptions` with member variables. + Initialize a `ConceptsOptions` with member variables. - - parameter limit: Maximum number of concepts to return. + - parameter limit: Maximum number of concepts to return. - - returns: An initialized `ConceptsOptions`. + - returns: An initialized `ConceptsOptions`. */ public init( limit: Int? = nil diff --git a/Source/NaturalLanguageUnderstandingV1/Models/ConceptsResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/ConceptsResult.swift index da2f0e390..fb0f83f2a 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/ConceptsResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/ConceptsResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/DeleteModelResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/DeleteModelResults.swift index 511a91a2c..49b1907c7 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/DeleteModelResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/DeleteModelResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/DisambiguationResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/DisambiguationResult.swift index c5f56dd33..a971d8fe6 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/DisambiguationResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/DisambiguationResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/DocumentEmotionResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/DocumentEmotionResults.swift index 30554ebe9..496356de1 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/DocumentEmotionResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/DocumentEmotionResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/DocumentSentimentResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/DocumentSentimentResults.swift index b458d77cf..281fa8e16 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/DocumentSentimentResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/DocumentSentimentResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/EmotionOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/EmotionOptions.swift index 045cc4eb1..95718b491 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/EmotionOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/EmotionOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,12 +41,12 @@ public struct EmotionOptions: Codable, Equatable { } /** - Initialize a `EmotionOptions` with member variables. + Initialize a `EmotionOptions` with member variables. - - parameter document: Set this to `false` to hide document-level emotion results. - - parameter targets: Emotion results will be returned for each target string that is found in the document. + - parameter document: Set this to `false` to hide document-level emotion results. + - parameter targets: Emotion results will be returned for each target string that is found in the document. - - returns: An initialized `EmotionOptions`. + - returns: An initialized `EmotionOptions`. */ public init( document: Bool? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/EmotionResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/EmotionResult.swift index 0e4840349..6036e2141 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/EmotionResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/EmotionResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/EmotionScores.swift b/Source/NaturalLanguageUnderstandingV1/Models/EmotionScores.swift index 1ef04094e..159aabb86 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/EmotionScores.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/EmotionScores.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/EntitiesOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/EntitiesOptions.swift index c3583d42f..057c26bab 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/EntitiesOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/EntitiesOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,8 @@ import Foundation /** - Identifies people, cities, organizations, and other entities in the content. See [Entity types and + Identifies people, cities, organizations, and other entities in the content. For more information, see [Entity types + and subtypes](https://cloud.ibm.com/docs/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. @@ -61,17 +62,17 @@ public struct EntitiesOptions: Codable, Equatable { } /** - Initialize a `EntitiesOptions` with member variables. + Initialize a `EntitiesOptions` with member variables. - - parameter limit: Maximum number of entities to return. - - parameter mentions: Set this to `true` to return locations of entity mentions. - - parameter model: Enter a [custom - model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) - ID to override the standard entity detection model. - - parameter sentiment: Set this to `true` to return sentiment information for detected entities. - - parameter emotion: Set this to `true` to analyze emotion for detected keywords. + - parameter limit: Maximum number of entities to return. + - parameter mentions: Set this to `true` to return locations of entity mentions. + - parameter model: Enter a [custom + model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) + ID to override the standard entity detection model. + - parameter sentiment: Set this to `true` to return sentiment information for detected entities. + - parameter emotion: Set this to `true` to analyze emotion for detected keywords. - - returns: An initialized `EntitiesOptions`. + - returns: An initialized `EntitiesOptions`. */ public init( limit: Int? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/EntitiesResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/EntitiesResult.swift index b55e0ef0b..8027a9f47 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/EntitiesResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/EntitiesResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/EntityMention.swift b/Source/NaturalLanguageUnderstandingV1/Models/EntityMention.swift index b79edfccf..a3df44cae 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/EntityMention.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/EntityMention.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/FeatureSentimentResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/FeatureSentimentResults.swift index 5b28b3e9a..2e5709f88 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/FeatureSentimentResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/FeatureSentimentResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/Features.swift b/Source/NaturalLanguageUnderstandingV1/Models/Features.swift index 771c52265..b1278fbef 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/Features.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/Features.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,8 @@ public struct Features: Codable, Equatable { public var emotion: EmotionOptions? /** - Identifies people, cities, organizations, and other entities in the content. See [Entity types and + Identifies people, cities, organizations, and other entities in the content. For more information, see [Entity + types and subtypes](https://cloud.ibm.com/docs/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. @@ -58,7 +59,7 @@ public struct Features: Codable, Equatable { /** 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 + might connect the entities "Nobel Prize" and "Albert Einstein". For more information, see [Relation types](https://cloud.ibm.com/docs/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. @@ -104,40 +105,41 @@ public struct Features: Codable, Equatable { } /** - Initialize a `Features` with member variables. - - - parameter concepts: Returns high-level concepts in the content. For example, a research paper about deep - learning might return the concept, "Artificial Intelligence" although the term is not mentioned. - Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. - - parameter emotion: Detects anger, disgust, fear, joy, or sadness that is conveyed in the content or by the - context around target phrases specified in the targets parameter. You can analyze emotion for detected entities - with `entities.emotion` and for keywords with `keywords.emotion`. - Supported languages: English. - - parameter entities: Identifies people, cities, organizations, and other entities in the content. See [Entity - types and - subtypes](https://cloud.ibm.com/docs/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. - - parameter keywords: Returns important keywords in the content. - Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. - - parameter metadata: Returns information from the document, including author name, title, RSS/ATOM feeds, - prominent page image, and publication date. Supports URL and HTML input types only. - - parameter relations: 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/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. - - parameter semanticRoles: Parses sentences into subject, action, and object form. - Supported languages: English, German, Japanese, Korean, Spanish. - - parameter sentiment: Analyzes the general sentiment of your content or the sentiment toward specific target - phrases. You can analyze sentiment for detected entities with `entities.sentiment` and for keywords with - `keywords.sentiment`. - Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish. - - parameter categories: Returns a five-level taxonomy of the content. The top three categories are returned. - Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. - - parameter syntax: Returns tokens and sentences from the input text. - - - returns: An initialized `Features`. + Initialize a `Features` with member variables. + + - parameter concepts: Returns high-level concepts in the content. For example, a research paper about deep + learning might return the concept, "Artificial Intelligence" although the term is not mentioned. + Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. + - parameter emotion: Detects anger, disgust, fear, joy, or sadness that is conveyed in the content or by the + context around target phrases specified in the targets parameter. You can analyze emotion for detected entities + with `entities.emotion` and for keywords with `keywords.emotion`. + Supported languages: English. + - parameter entities: Identifies people, cities, organizations, and other entities in the content. For more + information, see [Entity types and + subtypes](https://cloud.ibm.com/docs/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. + - parameter keywords: Returns important keywords in the content. + Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. + - parameter metadata: Returns information from the document, including author name, title, RSS/ATOM feeds, + prominent page image, and publication date. Supports URL and HTML input types only. + - parameter relations: 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". For more + information, see [Relation + types](https://cloud.ibm.com/docs/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. + - parameter semanticRoles: Parses sentences into subject, action, and object form. + Supported languages: English, German, Japanese, Korean, Spanish. + - parameter sentiment: Analyzes the general sentiment of your content or the sentiment toward specific target + phrases. You can analyze sentiment for detected entities with `entities.sentiment` and for keywords with + `keywords.sentiment`. + Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish. + - parameter categories: Returns a five-level taxonomy of the content. The top three categories are returned. + Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. + - parameter syntax: Returns tokens and sentences from the input text. + + - returns: An initialized `Features`. */ public init( concepts: ConceptsOptions? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/Feed.swift b/Source/NaturalLanguageUnderstandingV1/Models/Feed.swift index cb14574da..226875ce2 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/Feed.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/Feed.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/KeywordsOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/KeywordsOptions.swift index 0f41226fd..7905e6c08 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/KeywordsOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/KeywordsOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,13 +45,13 @@ public struct KeywordsOptions: Codable, Equatable { } /** - Initialize a `KeywordsOptions` with member variables. + Initialize a `KeywordsOptions` with member variables. - - parameter limit: Maximum number of keywords to return. - - parameter sentiment: Set this to `true` to return sentiment information for detected keywords. - - parameter emotion: Set this to `true` to analyze emotion for detected keywords. + - parameter limit: Maximum number of keywords to return. + - parameter sentiment: Set this to `true` to return sentiment information for detected keywords. + - parameter emotion: Set this to `true` to analyze emotion for detected keywords. - - returns: An initialized `KeywordsOptions`. + - returns: An initialized `KeywordsOptions`. */ public init( limit: Int? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/KeywordsResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/KeywordsResult.swift index ba36d133d..319f4e926 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/KeywordsResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/KeywordsResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/ListModelsResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/ListModelsResults.swift index b10ba5fb5..977ea66cc 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/ListModelsResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/ListModelsResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/MetadataOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/MetadataOptions.swift index 95c7e89a5..20ccb01d8 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/MetadataOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/MetadataOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,4 @@ import Foundation Returns information from the document, including author name, title, RSS/ATOM feeds, prominent page image, and publication date. Supports URL and HTML input types only. */ -public struct MetadataOptions: Codable, Equatable { - public init() { } -} +public typealias MetadataOptions = JSON diff --git a/Source/NaturalLanguageUnderstandingV1/Models/Model.swift b/Source/NaturalLanguageUnderstandingV1/Models/Model.swift index 45c6bfb2e..6de6932b9 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/Model.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/Model.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,18 @@ import Foundation /** Model. */ public struct Model: Codable, Equatable { + /** + When the status is `available`, the model is ready to use. + */ + public enum Status: String { + case starting = "starting" + case training = "training" + case deploying = "deploying" + case available = "available" + case error = "error" + case deleted = "deleted" + } + /** When the status is `available`, the model is ready to use. */ @@ -30,7 +42,7 @@ public struct Model: Codable, Equatable { public var modelID: String? /** - ISO 639-1 code indicating the language of the model. + ISO 639-1 code that indicates the language of the model. */ public var language: String? diff --git a/Source/NaturalLanguageUnderstandingV1/Models/Parameters.swift b/Source/NaturalLanguageUnderstandingV1/Models/Parameters.swift index db8ff052d..42d3195fa 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/Parameters.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/Parameters.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,9 +42,8 @@ internal struct Parameters: Codable, Equatable { public var features: Features /** - Set this to `false` to disable webpage cleaning. To learn more about webpage cleaning, see the [Analyzing - webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages) - documentation. + Set this to `false` to disable webpage cleaning. For more information about webpage cleaning, see [Analyzing + webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages). */ public var clean: Bool? @@ -68,9 +67,8 @@ internal struct Parameters: Codable, Equatable { /** 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/natural-language-understanding?topic=natural-language-understanding-language-support) - for more information. + support differs depending on the features you include in your analysis. For more information, see [Language + support](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-language-support). */ public var language: String? @@ -94,29 +92,28 @@ internal struct Parameters: Codable, Equatable { } /** - Initialize a `Parameters` with member variables. - - - parameter features: Specific features to analyze the document for. - - parameter text: The plain text to analyze. One of the `text`, `html`, or `url` parameters is required. - - parameter html: The HTML file to analyze. One of the `text`, `html`, or `url` parameters is required. - - parameter url: The webpage to analyze. One of the `text`, `html`, or `url` parameters is required. - - parameter clean: Set this to `false` to disable webpage cleaning. To learn more about webpage cleaning, see - the [Analyzing - webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages) - documentation. - - parameter xpath: An [XPath - query](https://cloud.ibm.com/docs/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`. - - parameter fallbackToRaw: Whether to use raw HTML content if text cleaning fails. - - parameter returnAnalyzedText: Whether or not to return the analyzed text. - - parameter language: 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/natural-language-understanding?topic=natural-language-understanding-language-support) - for more information. - - parameter limitTextCharacters: Sets the maximum number of characters that are processed by the service. - - - returns: An initialized `Parameters`. + Initialize a `Parameters` with member variables. + + - parameter features: Specific features to analyze the document for. + - parameter text: The plain text to analyze. One of the `text`, `html`, or `url` parameters is required. + - parameter html: The HTML file to analyze. One of the `text`, `html`, or `url` parameters is required. + - parameter url: The webpage to analyze. One of the `text`, `html`, or `url` parameters is required. + - parameter clean: Set this to `false` to disable webpage cleaning. For more information about webpage cleaning, + see [Analyzing + webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages). + - parameter xpath: An [XPath + query](https://cloud.ibm.com/docs/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`. + - parameter fallbackToRaw: Whether to use raw HTML content if text cleaning fails. + - parameter returnAnalyzedText: Whether or not to return the analyzed text. + - parameter language: 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. For more information, + see [Language + support](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-language-support). + - parameter limitTextCharacters: Sets the maximum number of characters that are processed by the service. + + - returns: An initialized `Parameters`. */ public init( features: Features, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/RelationArgument.swift b/Source/NaturalLanguageUnderstandingV1/Models/RelationArgument.swift index acfd7df44..4642566d7 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/RelationArgument.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/RelationArgument.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/RelationEntity.swift b/Source/NaturalLanguageUnderstandingV1/Models/RelationEntity.swift index 8a0b309ba..017ca4cc7 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/RelationEntity.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/RelationEntity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/RelationsOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/RelationsOptions.swift index 840a26c01..61d15afcf 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/RelationsOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/RelationsOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import Foundation /** 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 + might connect the entities "Nobel Prize" and "Albert Einstein". For more information, see [Relation types](https://cloud.ibm.com/docs/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. @@ -38,13 +38,13 @@ public struct RelationsOptions: Codable, Equatable { } /** - Initialize a `RelationsOptions` with member variables. + Initialize a `RelationsOptions` with member variables. - - parameter model: Enter a [custom - model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) - ID to override the default model. + - parameter model: Enter a [custom + model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) + ID to override the default model. - - returns: An initialized `RelationsOptions`. + - returns: An initialized `RelationsOptions`. */ public init( model: String? = nil diff --git a/Source/NaturalLanguageUnderstandingV1/Models/RelationsResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/RelationsResult.swift index 3f7627666..78d0351d2 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/RelationsResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/RelationsResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesEntity.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesEntity.swift index fc7ec2cff..76092fda9 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesEntity.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesEntity.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesKeyword.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesKeyword.swift index 641b456fd..0dd63b366 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesKeyword.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesKeyword.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesOptions.swift index dd2bbdc1f..80e4998f5 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,13 +45,13 @@ public struct SemanticRolesOptions: Codable, Equatable { } /** - Initialize a `SemanticRolesOptions` with member variables. + Initialize a `SemanticRolesOptions` with member variables. - - parameter limit: Maximum number of semantic_roles results to return. - - parameter keywords: Set this to `true` to return keyword information for subjects and objects. - - parameter entities: Set this to `true` to return entity information for subjects and objects. + - parameter limit: Maximum number of semantic_roles results to return. + - parameter keywords: Set this to `true` to return keyword information for subjects and objects. + - parameter entities: Set this to `true` to return entity information for subjects and objects. - - returns: An initialized `SemanticRolesOptions`. + - returns: An initialized `SemanticRolesOptions`. */ public init( limit: Int? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResult.swift index 167024aaa..ac583a94d 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultAction.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultAction.swift index 90e055b82..f0ed3b15c 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultAction.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultAction.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultObject.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultObject.swift index 36f081c5a..4385fdb8b 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultObject.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultObject.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultSubject.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultSubject.swift index 94ee96ade..98d21191a 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultSubject.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesResultSubject.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesVerb.swift b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesVerb.swift index 0244ef3ad..7063c0444 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesVerb.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SemanticRolesVerb.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SentenceResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/SentenceResult.swift index 3314e0d13..47932aef5 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SentenceResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SentenceResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SentimentOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/SentimentOptions.swift index b3897f03f..415af06aa 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SentimentOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SentimentOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,12 +40,12 @@ public struct SentimentOptions: Codable, Equatable { } /** - Initialize a `SentimentOptions` with member variables. + Initialize a `SentimentOptions` with member variables. - - parameter document: Set this to `false` to hide document-level sentiment results. - - parameter targets: Sentiment results will be returned for each target string that is found in the document. + - parameter document: Set this to `false` to hide document-level sentiment results. + - parameter targets: Sentiment results will be returned for each target string that is found in the document. - - returns: An initialized `SentimentOptions`. + - returns: An initialized `SentimentOptions`. */ public init( document: Bool? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SentimentResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/SentimentResult.swift index 7e7be890c..07e117c47 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SentimentResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SentimentResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptions.swift b/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptions.swift index db99294a4..33dea6e75 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptions.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct SyntaxOptions: Codable, Equatable { } /** - Initialize a `SyntaxOptions` with member variables. + Initialize a `SyntaxOptions` with member variables. - - parameter tokens: Tokenization options. - - parameter sentences: Set this to `true` to return sentence information. + - parameter tokens: Tokenization options. + - parameter sentences: Set this to `true` to return sentence information. - - returns: An initialized `SyntaxOptions`. + - returns: An initialized `SyntaxOptions`. */ public init( tokens: SyntaxOptionsTokens? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptionsTokens.swift b/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptionsTokens.swift index da760b45e..d8c09cfff 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptionsTokens.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SyntaxOptionsTokens.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct SyntaxOptionsTokens: Codable, Equatable { } /** - Initialize a `SyntaxOptionsTokens` with member variables. + Initialize a `SyntaxOptionsTokens` with member variables. - - parameter lemma: Set this to `true` to return the lemma for each token. - - parameter partOfSpeech: Set this to `true` to return the part of speech for each token. + - parameter lemma: Set this to `true` to return the lemma for each token. + - parameter partOfSpeech: Set this to `true` to return the part of speech for each token. - - returns: An initialized `SyntaxOptionsTokens`. + - returns: An initialized `SyntaxOptionsTokens`. */ public init( lemma: Bool? = nil, diff --git a/Source/NaturalLanguageUnderstandingV1/Models/SyntaxResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/SyntaxResult.swift index e9f1d2698..2d776be43 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/SyntaxResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/SyntaxResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/TargetedEmotionResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/TargetedEmotionResults.swift index 5c4a2b306..f2fd9c6fa 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/TargetedEmotionResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/TargetedEmotionResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/TargetedSentimentResults.swift b/Source/NaturalLanguageUnderstandingV1/Models/TargetedSentimentResults.swift index 7b5f20dcb..7abbfa801 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/TargetedSentimentResults.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/TargetedSentimentResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/NaturalLanguageUnderstandingV1/Models/TokenResult.swift b/Source/NaturalLanguageUnderstandingV1/Models/TokenResult.swift index a432ca2c8..ad28ac2a2 100644 --- a/Source/NaturalLanguageUnderstandingV1/Models/TokenResult.swift +++ b/Source/NaturalLanguageUnderstandingV1/Models/TokenResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import Foundation public struct TokenResult: Codable, Equatable { /** - The part of speech of the token. For descriptions of the values, see [Universal Dependencies POS + The part of speech of the token. For more information about the values, see [Universal Dependencies POS tags](https://universaldependencies.org/u/pos/). */ public enum PartOfSpeech: String { @@ -49,7 +49,7 @@ public struct TokenResult: Codable, Equatable { public var text: String? /** - The part of speech of the token. For descriptions of the values, see [Universal Dependencies POS + The part of speech of the token. For more information about the values, see [Universal Dependencies POS tags](https://universaldependencies.org/u/pos/). */ public var partOfSpeech: String? diff --git a/Source/NaturalLanguageUnderstandingV1/NaturalLanguageUnderstanding.swift b/Source/NaturalLanguageUnderstandingV1/NaturalLanguageUnderstanding.swift index 36462233a..f20356f3f 100644 --- a/Source/NaturalLanguageUnderstandingV1/NaturalLanguageUnderstanding.swift +++ b/Source/NaturalLanguageUnderstandingV1/NaturalLanguageUnderstanding.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import IBMSwiftSDKCore public class NaturalLanguageUnderstanding { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/natural-language-understanding/api" + public var serviceURL: String? = "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "NaturalLanguageUnderstanding" @@ -57,10 +57,11 @@ public class NaturalLanguageUnderstanding { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -86,8 +87,8 @@ public class NaturalLanguageUnderstanding { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -142,7 +143,7 @@ public class NaturalLanguageUnderstanding { - Relations - Semantic roles - Sentiment - - Syntax (Experimental). + - Syntax. If a language for the input text is not specified with the `language` parameter, the service [automatically detects the language](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-detectable-languages). @@ -151,10 +152,9 @@ public class NaturalLanguageUnderstanding { - parameter text: The plain text to analyze. One of the `text`, `html`, or `url` parameters is required. - parameter html: The HTML file to analyze. One of the `text`, `html`, or `url` parameters is required. - parameter url: The webpage to analyze. One of the `text`, `html`, or `url` parameters is required. - - parameter clean: Set this to `false` to disable webpage cleaning. To learn more about webpage cleaning, see the - [Analyzing - webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages) - documentation. + - parameter clean: Set this to `false` to disable webpage cleaning. For more information about webpage cleaning, + see [Analyzing + webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages). - parameter xpath: An [XPath query](https://cloud.ibm.com/docs/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 @@ -162,9 +162,9 @@ public class NaturalLanguageUnderstanding { - parameter fallbackToRaw: Whether to use raw HTML content if text cleaning fails. - parameter returnAnalyzedText: Whether or not to return the analyzed text. - parameter language: 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/natural-language-understanding?topic=natural-language-understanding-language-support) - for more information. + detection. Language support differs depending on the features you include in your analysis. For more information, + see [Language + support](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-language-support). - parameter limitTextCharacters: Sets the maximum number of characters that are processed by the service. - parameter headers: A dictionary of request headers to be sent with this request. - parameter completionHandler: A function executed when the request completes with a successful result or error diff --git a/Source/PersonalityInsightsV3/Models/Behavior.swift b/Source/PersonalityInsightsV3/Models/Behavior.swift index 498ca52c7..1d27175bc 100644 --- a/Source/PersonalityInsightsV3/Models/Behavior.swift +++ b/Source/PersonalityInsightsV3/Models/Behavior.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/PersonalityInsightsV3/Models/ConsumptionPreferences.swift b/Source/PersonalityInsightsV3/Models/ConsumptionPreferences.swift index 344af97e5..f9cd0ab20 100644 --- a/Source/PersonalityInsightsV3/Models/ConsumptionPreferences.swift +++ b/Source/PersonalityInsightsV3/Models/ConsumptionPreferences.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/PersonalityInsightsV3/Models/ConsumptionPreferencesCategory.swift b/Source/PersonalityInsightsV3/Models/ConsumptionPreferencesCategory.swift index 7704717a9..a40bf30c4 100644 --- a/Source/PersonalityInsightsV3/Models/ConsumptionPreferencesCategory.swift +++ b/Source/PersonalityInsightsV3/Models/ConsumptionPreferencesCategory.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/PersonalityInsightsV3/Models/Content.swift b/Source/PersonalityInsightsV3/Models/Content.swift index f582dd319..919aea725 100644 --- a/Source/PersonalityInsightsV3/Models/Content.swift +++ b/Source/PersonalityInsightsV3/Models/Content.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct Content: Codable, Equatable { } /** - Initialize a `Content` with member variables. + Initialize a `Content` with member variables. - - parameter contentItems: An array of `ContentItem` objects that provides the text that is to be analyzed. + - parameter contentItems: An array of `ContentItem` objects that provides the text that is to be analyzed. - - returns: An initialized `Content`. + - returns: An initialized `Content`. */ public init( contentItems: [ContentItem] diff --git a/Source/PersonalityInsightsV3/Models/ContentItem.swift b/Source/PersonalityInsightsV3/Models/ContentItem.swift index 091fc71f8..ed77cfedc 100644 --- a/Source/PersonalityInsightsV3/Models/ContentItem.swift +++ b/Source/PersonalityInsightsV3/Models/ContentItem.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -115,32 +115,32 @@ public struct ContentItem: Codable, Equatable { } /** - Initialize a `ContentItem` with member variables. - - - parameter content: The content that is to be analyzed. The service supports up to 20 MB of content for all - `ContentItem` objects combined. - - parameter id: A unique identifier for this content item. - - parameter created: A timestamp that identifies when this content was created. Specify a value in milliseconds - since the UNIX Epoch (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior - data. - - parameter updated: A timestamp that identifies when this content was last updated. Specify a value in - milliseconds since the UNIX Epoch (January 1, 1970, at 0:00 UTC). Required only for results that include temporal - behavior data. - - parameter contenttype: The MIME type of the content. The default is plain text. The tags are stripped from - HTML content before it is analyzed; plain text is processed as submitted. - - parameter language: The language identifier (two-letter ISO 639-1 identifier) for the language of the content - item. The default is `en` (English). Regional variants are treated as their parent language; for example, `en-US` - is interpreted as `en`. A language specified with the **Content-Type** parameter overrides the value of this - parameter; any content items that specify a different language are ignored. Omit the **Content-Type** parameter - to base the language on the most prevalent specification among the content items; again, content items that - specify a different language are ignored. You can specify any combination of languages for the input and response - content. - - parameter parentid: The unique ID of the parent content item for this item. Used to identify hierarchical - relationships between posts/replies, messages/replies, and so on. - - parameter reply: Indicates whether this content item is a reply to another content item. - - parameter forward: Indicates whether this content item is a forwarded/copied version of another content item. - - - returns: An initialized `ContentItem`. + Initialize a `ContentItem` with member variables. + + - parameter content: The content that is to be analyzed. The service supports up to 20 MB of content for all + `ContentItem` objects combined. + - parameter id: A unique identifier for this content item. + - parameter created: A timestamp that identifies when this content was created. Specify a value in milliseconds + since the UNIX Epoch (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior + data. + - parameter updated: A timestamp that identifies when this content was last updated. Specify a value in + milliseconds since the UNIX Epoch (January 1, 1970, at 0:00 UTC). Required only for results that include temporal + behavior data. + - parameter contenttype: The MIME type of the content. The default is plain text. The tags are stripped from + HTML content before it is analyzed; plain text is processed as submitted. + - parameter language: The language identifier (two-letter ISO 639-1 identifier) for the language of the content + item. The default is `en` (English). Regional variants are treated as their parent language; for example, `en-US` + is interpreted as `en`. A language specified with the **Content-Type** parameter overrides the value of this + parameter; any content items that specify a different language are ignored. Omit the **Content-Type** parameter + to base the language on the most prevalent specification among the content items; again, content items that + specify a different language are ignored. You can specify any combination of languages for the input and response + content. + - parameter parentid: The unique ID of the parent content item for this item. Used to identify hierarchical + relationships between posts/replies, messages/replies, and so on. + - parameter reply: Indicates whether this content item is a reply to another content item. + - parameter forward: Indicates whether this content item is a forwarded/copied version of another content item. + + - returns: An initialized `ContentItem`. */ public init( content: String, diff --git a/Source/PersonalityInsightsV3/Models/Profile.swift b/Source/PersonalityInsightsV3/Models/Profile.swift index b9052fa1e..9b5d7987a 100644 --- a/Source/PersonalityInsightsV3/Models/Profile.swift +++ b/Source/PersonalityInsightsV3/Models/Profile.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/PersonalityInsightsV3/Models/ProfileContent.swift b/Source/PersonalityInsightsV3/Models/ProfileContent.swift index 7cb459c2c..2b31ef8bc 100644 --- a/Source/PersonalityInsightsV3/Models/ProfileContent.swift +++ b/Source/PersonalityInsightsV3/Models/ProfileContent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/PersonalityInsightsV3/Models/Trait.swift b/Source/PersonalityInsightsV3/Models/Trait.swift index c6cac75d2..bac58d0a2 100644 --- a/Source/PersonalityInsightsV3/Models/Trait.swift +++ b/Source/PersonalityInsightsV3/Models/Trait.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/PersonalityInsightsV3/Models/Warning.swift b/Source/PersonalityInsightsV3/Models/Warning.swift index ad38bd459..5a08a65ca 100644 --- a/Source/PersonalityInsightsV3/Models/Warning.swift +++ b/Source/PersonalityInsightsV3/Models/Warning.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/PersonalityInsightsV3/PersonalityInsights.swift b/Source/PersonalityInsightsV3/PersonalityInsights.swift index 8c0a5d265..44f9440e6 100644 --- a/Source/PersonalityInsightsV3/PersonalityInsights.swift +++ b/Source/PersonalityInsightsV3/PersonalityInsights.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ import IBMSwiftSDKCore public class PersonalityInsights { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/personality-insights/api" + public var serviceURL: String? = "https://api.us-south.personality-insights.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "PersonalityInsights" @@ -64,10 +64,11 @@ public class PersonalityInsights { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -93,8 +94,8 @@ public class PersonalityInsights { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -184,6 +185,8 @@ public class PersonalityInsights { - parameter rawScores: Indicates whether a raw score in addition to a normalized percentile is returned for each characteristic; raw scores are not compared with a sample population. By default, only normalized percentiles are returned. + - parameter csvHeaders: Indicates whether column labels are returned with a CSV response. By default, no column + labels are returned. Applies only when the response type is CSV (`text/csv`). - parameter consumptionPreferences: Indicates whether consumption preferences are returned with the results. By default, no consumption preferences are returned. - parameter headers: A dictionary of request headers to be sent with this request. @@ -194,6 +197,7 @@ public class PersonalityInsights { contentLanguage: String? = nil, acceptLanguage: String? = nil, rawScores: Bool? = nil, + csvHeaders: Bool? = nil, consumptionPreferences: Bool? = nil, headers: [String: String]? = nil, completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) @@ -227,6 +231,10 @@ public class PersonalityInsights { let queryParameter = URLQueryItem(name: "raw_scores", value: "\(rawScores)") queryParameters.append(queryParameter) } + if let csvHeaders = csvHeaders { + let queryParameter = URLQueryItem(name: "csv_headers", value: "\(csvHeaders)") + queryParameters.append(queryParameter) + } if let consumptionPreferences = consumptionPreferences { let queryParameter = URLQueryItem(name: "consumption_preferences", value: "\(consumptionPreferences)") queryParameters.append(queryParameter) @@ -318,7 +326,7 @@ public class PersonalityInsights { csvHeaders: Bool? = nil, consumptionPreferences: Bool? = nil, headers: [String: String]? = nil, - completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) { // construct body guard let body = profileContent.content else { diff --git a/Source/SpeechToTextV1/Models/AcousticModel.swift b/Source/SpeechToTextV1/Models/AcousticModel.swift index 6ea00194b..a07536572 100644 --- a/Source/SpeechToTextV1/Models/AcousticModel.swift +++ b/Source/SpeechToTextV1/Models/AcousticModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AcousticModels.swift b/Source/SpeechToTextV1/Models/AcousticModels.swift index a03909df1..273d730bf 100644 --- a/Source/SpeechToTextV1/Models/AcousticModels.swift +++ b/Source/SpeechToTextV1/Models/AcousticModels.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AudioDetails.swift b/Source/SpeechToTextV1/Models/AudioDetails.swift index 60ab3af7b..e459a3b06 100644 --- a/Source/SpeechToTextV1/Models/AudioDetails.swift +++ b/Source/SpeechToTextV1/Models/AudioDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AudioListing.swift b/Source/SpeechToTextV1/Models/AudioListing.swift index 1042785a5..915df6182 100644 --- a/Source/SpeechToTextV1/Models/AudioListing.swift +++ b/Source/SpeechToTextV1/Models/AudioListing.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AudioMetrics.swift b/Source/SpeechToTextV1/Models/AudioMetrics.swift index e34b7b807..2b10fc0d2 100644 --- a/Source/SpeechToTextV1/Models/AudioMetrics.swift +++ b/Source/SpeechToTextV1/Models/AudioMetrics.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AudioMetricsDetails.swift b/Source/SpeechToTextV1/Models/AudioMetricsDetails.swift index 30aea1a55..a4ab9a09b 100644 --- a/Source/SpeechToTextV1/Models/AudioMetricsDetails.swift +++ b/Source/SpeechToTextV1/Models/AudioMetricsDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AudioMetricsHistogramBin.swift b/Source/SpeechToTextV1/Models/AudioMetricsHistogramBin.swift index e7e4eb1ea..3ada8c366 100644 --- a/Source/SpeechToTextV1/Models/AudioMetricsHistogramBin.swift +++ b/Source/SpeechToTextV1/Models/AudioMetricsHistogramBin.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AudioResource.swift b/Source/SpeechToTextV1/Models/AudioResource.swift index c27eaa686..62b1b5d3a 100644 --- a/Source/SpeechToTextV1/Models/AudioResource.swift +++ b/Source/SpeechToTextV1/Models/AudioResource.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/AudioResources.swift b/Source/SpeechToTextV1/Models/AudioResources.swift index 9fef02463..a58250cf5 100644 --- a/Source/SpeechToTextV1/Models/AudioResources.swift +++ b/Source/SpeechToTextV1/Models/AudioResources.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/Corpora.swift b/Source/SpeechToTextV1/Models/Corpora.swift index 6d1c64b13..1fabedcc7 100644 --- a/Source/SpeechToTextV1/Models/Corpora.swift +++ b/Source/SpeechToTextV1/Models/Corpora.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/Corpus.swift b/Source/SpeechToTextV1/Models/Corpus.swift index 440588325..833dc293c 100644 --- a/Source/SpeechToTextV1/Models/Corpus.swift +++ b/Source/SpeechToTextV1/Models/Corpus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/CreateAcousticModel.swift b/Source/SpeechToTextV1/Models/CreateAcousticModel.swift index 49b946952..98b862954 100644 --- a/Source/SpeechToTextV1/Models/CreateAcousticModel.swift +++ b/Source/SpeechToTextV1/Models/CreateAcousticModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,20 +93,20 @@ internal struct CreateAcousticModel: Codable, Equatable { } /** - Initialize a `CreateAcousticModel` with member variables. + Initialize a `CreateAcousticModel` with member variables. - - parameter name: A user-defined name for the new custom acoustic model. Use a name that is unique among all - custom acoustic models that you own. Use a localized name that matches the language of the custom model. Use a - name that describes the acoustic environment of the custom model, such as `Mobile custom model` or `Noisy car - custom model`. - - parameter baseModelName: The name of the base language model that is to be customized by the new custom - acoustic model. The new custom model 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/speech-to-text?topic=speech-to-text-customization#languageSupport). - - parameter description: A description of the new custom acoustic model. Use a localized description that - matches the language of the custom model. + - parameter name: A user-defined name for the new custom acoustic model. Use a name that is unique among all + custom acoustic models that you own. Use a localized name that matches the language of the custom model. Use a + name that describes the acoustic environment of the custom model, such as `Mobile custom model` or `Noisy car + custom model`. + - parameter baseModelName: The name of the base language model that is to be customized by the new custom + acoustic model. The new custom model 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/speech-to-text?topic=speech-to-text-customization#languageSupport). + - parameter description: A description of the new custom acoustic model. Use a localized description that + matches the language of the custom model. - - returns: An initialized `CreateAcousticModel`. + - returns: An initialized `CreateAcousticModel`. */ public init( name: String, diff --git a/Source/SpeechToTextV1/Models/CreateLanguageModel.swift b/Source/SpeechToTextV1/Models/CreateLanguageModel.swift index 1eb50c14d..23fd9892c 100644 --- a/Source/SpeechToTextV1/Models/CreateLanguageModel.swift +++ b/Source/SpeechToTextV1/Models/CreateLanguageModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,33 +110,33 @@ internal struct CreateLanguageModel: Codable, Equatable { } /** - Initialize a `CreateLanguageModel` with member variables. + Initialize a `CreateLanguageModel` with member variables. - - parameter name: A user-defined name for the new custom language model. Use a name that is unique among all - custom language models that you own. Use a localized name that matches the language of the custom model. Use a - name that describes the domain of the custom model, such as `Medical custom model` or `Legal custom model`. - - parameter baseModelName: The name of the base language model that is to be customized by the new custom - language model. The new custom model can be used only with the base model that it customizes. - 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/speech-to-text?topic=speech-to-text-customization#languageSupport). - - parameter dialect: 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. - 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. - - parameter description: A description of the new custom language model. Use a localized description that - matches the language of the custom model. + - parameter name: A user-defined name for the new custom language model. Use a name that is unique among all + custom language models that you own. Use a localized name that matches the language of the custom model. Use a + name that describes the domain of the custom model, such as `Medical custom model` or `Legal custom model`. + - parameter baseModelName: The name of the base language model that is to be customized by the new custom + language model. The new custom model can be used only with the base model that it customizes. + 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/speech-to-text?topic=speech-to-text-customization#languageSupport). + - parameter dialect: 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. + 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. + - parameter description: A description of the new custom language model. Use a localized description that + matches the language of the custom model. - - returns: An initialized `CreateLanguageModel`. + - returns: An initialized `CreateLanguageModel`. */ public init( name: String, diff --git a/Source/SpeechToTextV1/Models/CustomWord.swift b/Source/SpeechToTextV1/Models/CustomWord.swift index dd4ce522b..921d084ca 100644 --- a/Source/SpeechToTextV1/Models/CustomWord.swift +++ b/Source/SpeechToTextV1/Models/CustomWord.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,26 +57,26 @@ public struct CustomWord: Codable, Equatable { } /** - Initialize a `CustomWord` with member variables. + Initialize a `CustomWord` with member variables. - - parameter word: For the **Add custom words** method, you must specify the custom word that is to be added to - or updated in the custom model. Do not include spaces in the word. Use a `-` (dash) or `_` (underscore) to - connect the tokens of compound words. - Omit this parameter for the **Add a custom word** method. - - parameter soundsLike: An array of sounds-like pronunciations for the custom word. Specify how words that are - difficult to pronounce, foreign words, acronyms, and so on can be pronounced by users. - * For a word that is not in the service's base vocabulary, omit the parameter to have the service automatically - generate a sounds-like pronunciation for the word. - * For a word that is in the service's base vocabulary, use the parameter to specify additional pronunciations for - the word. You cannot override the default pronunciation of a word; pronunciations you add augment the - pronunciation from the base vocabulary. - A word can have at most five sounds-like pronunciations. A pronunciation can include at most 40 characters not - including spaces. - - parameter displayAs: An alternative spelling for the custom word when it appears in a transcript. Use the - parameter when you want the word to have a spelling that is different from its usual representation or from its - spelling in corpora training data. + - parameter word: For the **Add custom words** method, you must specify the custom word that is to be added to + or updated in the custom model. Do not include spaces in the word. Use a `-` (dash) or `_` (underscore) to + connect the tokens of compound words. + Omit this parameter for the **Add a custom word** method. + - parameter soundsLike: An array of sounds-like pronunciations for the custom word. Specify how words that are + difficult to pronounce, foreign words, acronyms, and so on can be pronounced by users. + * For a word that is not in the service's base vocabulary, omit the parameter to have the service automatically + generate a sounds-like pronunciation for the word. + * For a word that is in the service's base vocabulary, use the parameter to specify additional pronunciations for + the word. You cannot override the default pronunciation of a word; pronunciations you add augment the + pronunciation from the base vocabulary. + A word can have at most five sounds-like pronunciations. A pronunciation can include at most 40 characters not + including spaces. + - parameter displayAs: An alternative spelling for the custom word when it appears in a transcript. Use the + parameter when you want the word to have a spelling that is different from its usual representation or from its + spelling in corpora training data. - - returns: An initialized `CustomWord`. + - returns: An initialized `CustomWord`. */ public init( word: String? = nil, diff --git a/Source/SpeechToTextV1/Models/CustomWords.swift b/Source/SpeechToTextV1/Models/CustomWords.swift index 25eec38e5..bba17ed03 100644 --- a/Source/SpeechToTextV1/Models/CustomWords.swift +++ b/Source/SpeechToTextV1/Models/CustomWords.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,12 +33,12 @@ internal struct CustomWords: Codable, Equatable { } /** - Initialize a `CustomWords` with member variables. + Initialize a `CustomWords` with member variables. - - parameter words: An array of `CustomWord` objects that provides information about each custom word that is to - be added to or updated in the custom language model. + - parameter words: An array of `CustomWord` objects that provides information about each custom word that is to + be added to or updated in the custom language model. - - returns: An initialized `CustomWords`. + - returns: An initialized `CustomWords`. */ public init( words: [CustomWord] diff --git a/Source/SpeechToTextV1/Models/Grammar.swift b/Source/SpeechToTextV1/Models/Grammar.swift index 9a8ad6a01..b23cc1675 100644 --- a/Source/SpeechToTextV1/Models/Grammar.swift +++ b/Source/SpeechToTextV1/Models/Grammar.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/Grammars.swift b/Source/SpeechToTextV1/Models/Grammars.swift index f9e742437..bd9ebd9b1 100644 --- a/Source/SpeechToTextV1/Models/Grammars.swift +++ b/Source/SpeechToTextV1/Models/Grammars.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/KeywordResult.swift b/Source/SpeechToTextV1/Models/KeywordResult.swift index ad74f0194..f15a9a1c6 100644 --- a/Source/SpeechToTextV1/Models/KeywordResult.swift +++ b/Source/SpeechToTextV1/Models/KeywordResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/LanguageModel.swift b/Source/SpeechToTextV1/Models/LanguageModel.swift index 7c89dd8f6..bdec0cf8e 100644 --- a/Source/SpeechToTextV1/Models/LanguageModel.swift +++ b/Source/SpeechToTextV1/Models/LanguageModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/LanguageModels.swift b/Source/SpeechToTextV1/Models/LanguageModels.swift index e10ddcc48..462129775 100644 --- a/Source/SpeechToTextV1/Models/LanguageModels.swift +++ b/Source/SpeechToTextV1/Models/LanguageModels.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/ProcessedAudio.swift b/Source/SpeechToTextV1/Models/ProcessedAudio.swift index 5eed30083..d2b1a8ca9 100644 --- a/Source/SpeechToTextV1/Models/ProcessedAudio.swift +++ b/Source/SpeechToTextV1/Models/ProcessedAudio.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/ProcessingMetrics.swift b/Source/SpeechToTextV1/Models/ProcessingMetrics.swift index 5222c551e..d2078e574 100644 --- a/Source/SpeechToTextV1/Models/ProcessingMetrics.swift +++ b/Source/SpeechToTextV1/Models/ProcessingMetrics.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/RecognitionJob.swift b/Source/SpeechToTextV1/Models/RecognitionJob.swift index 86a72a6a4..6dca56505 100644 --- a/Source/SpeechToTextV1/Models/RecognitionJob.swift +++ b/Source/SpeechToTextV1/Models/RecognitionJob.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/RecognitionJobs.swift b/Source/SpeechToTextV1/Models/RecognitionJobs.swift index 24bf67e8b..d5dc492ac 100644 --- a/Source/SpeechToTextV1/Models/RecognitionJobs.swift +++ b/Source/SpeechToTextV1/Models/RecognitionJobs.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/RegisterStatus.swift b/Source/SpeechToTextV1/Models/RegisterStatus.swift index fbdb0c47a..3ba853cc6 100644 --- a/Source/SpeechToTextV1/Models/RegisterStatus.swift +++ b/Source/SpeechToTextV1/Models/RegisterStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ public struct RegisterStatus: Codable, Equatable { /** The current status of the job: - * `created`: The service successfully white-listed the callback URL as a result of the call. - * `already created`: The URL was already white-listed. + * `created`: The service successfully allowlisted the callback URL as a result of the call. + * `already created`: The URL was already allowlisted. */ public enum Status: String { case created = "created" @@ -33,8 +33,8 @@ public struct RegisterStatus: Codable, Equatable { /** The current status of the job: - * `created`: The service successfully white-listed the callback URL as a result of the call. - * `already created`: The URL was already white-listed. + * `created`: The service successfully allowlisted the callback URL as a result of the call. + * `already created`: The URL was already allowlisted. */ public var status: String diff --git a/Source/SpeechToTextV1/Models/SpeakerLabelsResult.swift b/Source/SpeechToTextV1/Models/SpeakerLabelsResult.swift index 8f8d90e82..71527924b 100644 --- a/Source/SpeechToTextV1/Models/SpeakerLabelsResult.swift +++ b/Source/SpeechToTextV1/Models/SpeakerLabelsResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/SpeechModel.swift b/Source/SpeechToTextV1/Models/SpeechModel.swift index c1bd9ee14..29c255652 100644 --- a/Source/SpeechToTextV1/Models/SpeechModel.swift +++ b/Source/SpeechToTextV1/Models/SpeechModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/SpeechModels.swift b/Source/SpeechToTextV1/Models/SpeechModels.swift index 18acb54d4..0c6bf642d 100644 --- a/Source/SpeechToTextV1/Models/SpeechModels.swift +++ b/Source/SpeechToTextV1/Models/SpeechModels.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/SpeechRecognitionAlternative.swift b/Source/SpeechToTextV1/Models/SpeechRecognitionAlternative.swift index 6802419fa..7ae4bea11 100644 --- a/Source/SpeechToTextV1/Models/SpeechRecognitionAlternative.swift +++ b/Source/SpeechToTextV1/Models/SpeechRecognitionAlternative.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,14 +37,14 @@ public struct SpeechRecognitionAlternative: Codable, Equatable { the word followed by its start and end time in seconds, for example: `[["hello",0.0,1.2],["world",1.2,2.5]]`. Timestamps are returned only for the best alternative. */ - public var timestamps: [WordTimestamp]? + public var timestamps: [String]? /** A confidence score for each word of the transcript as a list of lists. Each inner list consists of two elements: the word and its confidence score in the range of 0.0 to 1.0, for example: `[["hello",0.95],["world",0.866]]`. Confidence scores are returned only for the best alternative and only with results marked as final. */ - public var wordConfidence: [WordConfidence]? + public var wordConfidence: [String]? // Map each property name to the key that shall be used for encoding/decoding. private enum CodingKeys: String, CodingKey { diff --git a/Source/SpeechToTextV1/Models/SpeechRecognitionResult.swift b/Source/SpeechToTextV1/Models/SpeechRecognitionResult.swift index 5efb54f03..a980523d8 100644 --- a/Source/SpeechToTextV1/Models/SpeechRecognitionResult.swift +++ b/Source/SpeechToTextV1/Models/SpeechRecognitionResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/SpeechRecognitionResults.swift b/Source/SpeechToTextV1/Models/SpeechRecognitionResults.swift index 700d6e262..36826396c 100644 --- a/Source/SpeechToTextV1/Models/SpeechRecognitionResults.swift +++ b/Source/SpeechToTextV1/Models/SpeechRecognitionResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/SupportedFeatures.swift b/Source/SpeechToTextV1/Models/SupportedFeatures.swift index dadb635e7..155fa17e5 100644 --- a/Source/SpeechToTextV1/Models/SupportedFeatures.swift +++ b/Source/SpeechToTextV1/Models/SupportedFeatures.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,9 @@ public struct SupportedFeatures: Codable, Equatable { /** Indicates whether the `speaker_labels` parameter can be used with the language model. + **Note:** The field returns `true` for all models. However, speaker labels are supported only for US English, + Australian English, German, Japanese, Korean, and Spanish (both broadband and narrowband models) and UK English + (narrowband model only). Speaker labels are not supported for any other models. */ public var speakerLabels: Bool diff --git a/Source/SpeechToTextV1/Models/TrainingResponse.swift b/Source/SpeechToTextV1/Models/TrainingResponse.swift index 7640276dc..6cf090be9 100644 --- a/Source/SpeechToTextV1/Models/TrainingResponse.swift +++ b/Source/SpeechToTextV1/Models/TrainingResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/TrainingWarning.swift b/Source/SpeechToTextV1/Models/TrainingWarning.swift index 4ab356239..1282e8900 100644 --- a/Source/SpeechToTextV1/Models/TrainingWarning.swift +++ b/Source/SpeechToTextV1/Models/TrainingWarning.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/Word.swift b/Source/SpeechToTextV1/Models/Word.swift index 9bfa8ee8c..4254c3c82 100644 --- a/Source/SpeechToTextV1/Models/Word.swift +++ b/Source/SpeechToTextV1/Models/Word.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2017, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/WordAlternativeResult.swift b/Source/SpeechToTextV1/Models/WordAlternativeResult.swift index 92fbb98c5..8beec9a2c 100644 --- a/Source/SpeechToTextV1/Models/WordAlternativeResult.swift +++ b/Source/SpeechToTextV1/Models/WordAlternativeResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/WordAlternativeResults.swift b/Source/SpeechToTextV1/Models/WordAlternativeResults.swift index c8bf1cb78..f2634939b 100644 --- a/Source/SpeechToTextV1/Models/WordAlternativeResults.swift +++ b/Source/SpeechToTextV1/Models/WordAlternativeResults.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/WordError.swift b/Source/SpeechToTextV1/Models/WordError.swift index 480bf27ea..2073a9b97 100644 --- a/Source/SpeechToTextV1/Models/WordError.swift +++ b/Source/SpeechToTextV1/Models/WordError.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/Models/Words.swift b/Source/SpeechToTextV1/Models/Words.swift index a38110407..3e033987d 100644 --- a/Source/SpeechToTextV1/Models/Words.swift +++ b/Source/SpeechToTextV1/Models/Words.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/SpeechToTextV1/SpeechToText.swift b/Source/SpeechToTextV1/SpeechToText.swift index 8a3f7d5ef..180dfcbe5 100644 --- a/Source/SpeechToTextV1/SpeechToText.swift +++ b/Source/SpeechToTextV1/SpeechToText.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ import Foundation import IBMSwiftSDKCore /** - The IBM® Speech to Text service provides APIs that use IBM's speech-recognition capabilities to produce transcripts - of spoken audio. The service can transcribe speech from various languages and audio formats. In addition to basic - transcription, the service can produce detailed information about many different aspects of the audio. For most + The IBM Watson™ Speech to Text service provides APIs that use IBM's speech-recognition capabilities to produce + transcripts of spoken audio. The service can transcribe speech from various languages and audio formats. In addition to + basic transcription, the service can produce detailed information about many different aspects of the audio. For most languages, the service supports two sampling rates, broadband and narrowband. It returns all JSON response content in the UTF-8 character set. For speech recognition, the service supports synchronous and asynchronous HTTP Representational State Transfer (REST) @@ -38,7 +38,7 @@ import IBMSwiftSDKCore public class SpeechToText { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://stream.watsonplatform.net/speech-to-text/api" + public var serviceURL: String? = "https://api.us-south.speech-to-text.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "SpeechToText" @@ -63,8 +63,10 @@ public class SpeechToText { In that case, try another initializer that directly passes in the credentials. */ - public init() throws { - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + public init?() { + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -87,8 +89,8 @@ public class SpeechToText { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -134,7 +136,8 @@ public class SpeechToText { List models. Lists all language models that are available for use with the service. The information includes the name of the - model and its minimum sampling rate in Hertz, among other things. + model and its minimum sampling rate in Hertz, among other things. The ordering of the list of models can change + from call to call; do not rely on an alphabetized or static list of models. **See also:** [Languages and models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-models#models). - parameter headers: A dictionary of request headers to be sent with this request. @@ -365,9 +368,8 @@ public class SpeechToText { participants in a 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, German, Japanese, Korean, 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`. + **Note:** Applies to US English, Australian English, German, Japanese, Korean, and Spanish (both broadband and + narrowband models) and UK English (narrowband model) transcription only. See [Speaker labels](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-output#speaker_labels). - parameter customizationID: **Deprecated.** Use the `language_customization_id` parameter to specify the customization ID (GUID) of a custom language model that is to be used with the recognition request. Do not @@ -597,7 +599,7 @@ public class SpeechToText { Register a callback. Registers a callback URL with the service for use with subsequent asynchronous recognition requests. The service - attempts to register, or white-list, the callback URL if it is not already registered by sending a `GET` request to + attempts to register, or allowlist, the callback URL if it is not already registered by sending a `GET` request to the callback URL. The service passes a random alphanumeric challenge string via the `challenge_string` parameter of the request. The request includes an `Accept` header that specifies `text/plain` as the required response type. To be registered successfully, the callback URL must respond to the `GET` request from the service. The response @@ -606,8 +608,8 @@ public class SpeechToText { response code 201. The service sends only a single `GET` request to the callback URL. If the service does not receive a reply with a response code of 200 and a body that echoes the challenge string sent by the service within five seconds, it does - not white-list the URL; it instead sends status code 400 in response to the **Register a callback** request. If the - requested callback URL is already white-listed, the service responds to the initial registration request with + not allowlist the URL; it instead sends status code 400 in response to the **Register a callback** request. If the + requested callback URL is already allowlisted, the service responds to the initial registration request with response code 200. If you specify a user secret with the request, the service uses it as a key to calculate an HMAC-SHA1 signature of the challenge string in its response to the `POST` request. It sends this signature in the `X-Callback-Signature` @@ -619,7 +621,7 @@ public class SpeechToText { **See also:** [Registering a callback URL](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-async#register). - - parameter callbackURL: An HTTP or HTTPS URL to which callback notifications are to be sent. To be white-listed, + - parameter callbackURL: An HTTP or HTTPS URL to which callback notifications are to be sent. To be allowlisted, the URL must successfully echo the challenge string during URL verification. During verification, the client can also check the signature that the service sends in the `X-Callback-Signature` header to verify the origin of the request. @@ -678,7 +680,7 @@ public class SpeechToText { /** Unregister a callback. - Unregisters a callback URL that was previously white-listed with a **Register a callback** request for use with the + Unregisters a callback URL that was previously allowlisted with a **Register a callback** request for use with the asynchronous interface. Once unregistered, the URL can no longer be used with asynchronous recognition requests. **See also:** [Unregistering a callback URL](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-async#unregister). @@ -802,7 +804,7 @@ public class SpeechToText { - parameter model: The identifier of the model that is to be used for the recognition request. See [Languages and models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-models#models). - parameter callbackURL: A URL to which callback notifications are to be sent. The URL must already be - successfully white-listed by using the **Register a callback** method. You can include the same callback URL with + successfully allowlisted by using the **Register a callback** method. You can include the same callback URL with any number of job creation requests. Omit the parameter to poll the service for job completion and results. Use the `user_token` parameter to specify a unique user-specified string with each job to differentiate the callback notifications for the jobs. @@ -898,9 +900,8 @@ public class SpeechToText { participants in a 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, German, Japanese, Korean, 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`. + **Note:** Applies to US English, Australian English, German, Japanese, Korean, and Spanish (both broadband and + narrowband models) and UK English (narrowband model) transcription only. See [Speaker labels](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-output#speaker_labels). - parameter customizationID: **Deprecated.** Use the `language_customization_id` parameter to specify the customization ID (GUID) of a custom language model that is to be used with the recognition request. Do not @@ -1431,8 +1432,9 @@ public class SpeechToText { models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-manageLanguageModels#listModels-language). - parameter language: The identifier of the language for which custom language or custom acoustic models are to - be returned (for example, `en-US`). Omit the parameter to see all custom language or custom acoustic models that - are owned by the requesting credentials. + be returned. Omit the parameter to see all custom language or custom acoustic models that are owned by the + requesting credentials. **Note:** The `ar-AR` (Modern Standard Arabic) and `zh-CN` (Mandarin Chinese) languages + are not available for language model customization. - parameter headers: A dictionary of request headers to be sent with this request. - parameter completionHandler: A function executed when the request completes with a successful result or error */ @@ -1638,7 +1640,7 @@ public class SpeechToText { wordTypeToAdd: String? = nil, customizationWeight: Double? = nil, headers: [String: String]? = nil, - completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) { // construct header parameters var headerParameters = defaultHeaders @@ -1684,7 +1686,7 @@ public class SpeechToText { ) // execute REST request - request.response(completionHandler: completionHandler) + request.responseObject(completionHandler: completionHandler) } /** @@ -2883,8 +2885,9 @@ public class SpeechToText { models](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-manageAcousticModels#listModels-acoustic). - parameter language: The identifier of the language for which custom language or custom acoustic models are to - be returned (for example, `en-US`). Omit the parameter to see all custom language or custom acoustic models that - are owned by the requesting credentials. + be returned. Omit the parameter to see all custom language or custom acoustic models that are owned by the + requesting credentials. **Note:** The `ar-AR` (Modern Standard Arabic) and `zh-CN` (Mandarin Chinese) languages + are not available for language model customization. - parameter headers: A dictionary of request headers to be sent with this request. - parameter completionHandler: A function executed when the request completes with a successful result or error */ @@ -3096,7 +3099,7 @@ public class SpeechToText { customizationID: String, customLanguageModelID: String? = nil, headers: [String: String]? = nil, - completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) + completionHandler: @escaping (WatsonResponse?, WatsonError?) -> Void) { // construct header parameters var headerParameters = defaultHeaders @@ -3138,7 +3141,7 @@ public class SpeechToText { ) // execute REST request - request.response(completionHandler: completionHandler) + request.responseObject(completionHandler: completionHandler) } /** @@ -3644,9 +3647,12 @@ public class SpeechToText { Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to - associate the customer ID with the data. - You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes the - data. + associate the customer ID with the data. You associate a customer ID with data by passing the `X-Watson-Metadata` + header with a request that passes the data. + **Note:** If you delete an instance of the service from the service console, all data associated with that service + instance is automatically deleted. This includes all custom language models, corpora, grammars, and words; all + custom acoustic models and audio resources; all registered endpoints for the asynchronous HTTP interface; and all + data related to speech recognition requests. **See also:** [Information security](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-information-security#information-security). diff --git a/Source/TextToSpeechV1/Models/CreateVoiceModel.swift b/Source/TextToSpeechV1/Models/CreateVoiceModel.swift index 150d3c158..0141fd952 100644 --- a/Source/TextToSpeechV1/Models/CreateVoiceModel.swift +++ b/Source/TextToSpeechV1/Models/CreateVoiceModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,15 +68,15 @@ internal struct CreateVoiceModel: Codable, Equatable { } /** - Initialize a `CreateVoiceModel` with member variables. + Initialize a `CreateVoiceModel` with member variables. - - parameter name: The name of the new custom voice model. - - parameter language: The language of the new custom voice model. You create a custom voice model for a specific - language, not for a specific voice. A custom model can be used with any voice, standard or neural, for its - specified language. Omit the parameter to use the the default language, `en-US`. - - parameter description: A description of the new custom voice model. Specifying a description is recommended. + - parameter name: The name of the new custom voice model. + - parameter language: The language of the new custom voice model. You create a custom voice model for a specific + language, not for a specific voice. A custom model can be used with any voice, standard or neural, for its + specified language. Omit the parameter to use the the default language, `en-US`. + - parameter description: A description of the new custom voice model. Specifying a description is recommended. - - returns: An initialized `CreateVoiceModel`. + - returns: An initialized `CreateVoiceModel`. */ public init( name: String, diff --git a/Source/TextToSpeechV1/Models/Pronunciation.swift b/Source/TextToSpeechV1/Models/Pronunciation.swift index d6ffe3743..f761a8720 100644 --- a/Source/TextToSpeechV1/Models/Pronunciation.swift +++ b/Source/TextToSpeechV1/Models/Pronunciation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/TextToSpeechV1/Models/SupportedFeatures.swift b/Source/TextToSpeechV1/Models/SupportedFeatures.swift index 841642670..cd8a3bb20 100644 --- a/Source/TextToSpeechV1/Models/SupportedFeatures.swift +++ b/Source/TextToSpeechV1/Models/SupportedFeatures.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/TextToSpeechV1/Models/Text.swift b/Source/TextToSpeechV1/Models/Text.swift index 3c75c39cd..33ff22197 100644 --- a/Source/TextToSpeechV1/Models/Text.swift +++ b/Source/TextToSpeechV1/Models/Text.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,11 +33,11 @@ internal struct Text: Codable, Equatable { } /** - Initialize a `Text` with member variables. + Initialize a `Text` with member variables. - - parameter text: The text to synthesize. + - parameter text: The text to synthesize. - - returns: An initialized `Text`. + - returns: An initialized `Text`. */ public init( text: String diff --git a/Source/TextToSpeechV1/Models/Translation.swift b/Source/TextToSpeechV1/Models/Translation.swift index d2dedb081..205925a18 100644 --- a/Source/TextToSpeechV1/Models/Translation.swift +++ b/Source/TextToSpeechV1/Models/Translation.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,19 +70,19 @@ public struct Translation: Codable, Equatable { } /** - Initialize a `Translation` with member variables. + Initialize a `Translation` with member variables. - - parameter translation: The phonetic or sounds-like translation for the word. A phonetic translation is based - on the SSML format for representing the phonetic string of a word either as an IPA translation or as an IBM SPR - translation. The Arabic, Chinese, Dutch, and Korean languages support only IPA. A sounds-like is one or more - words that, when combined, sound like the word. - - parameter partOfSpeech: **Japanese only.** The part of speech for the word. The service uses the value to - produce the correct intonation for the word. You can create only a single entry, with or without a single part of - speech, for any word; you cannot create multiple entries with different parts of speech for the same word. For - more information, see [Working with Japanese - entries](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-rules#jaNotes). + - parameter translation: The phonetic or sounds-like translation for the word. A phonetic translation is based + on the SSML format for representing the phonetic string of a word either as an IPA translation or as an IBM SPR + translation. The Arabic, Chinese, Dutch, and Korean languages support only IPA. A sounds-like is one or more + words that, when combined, sound like the word. + - parameter partOfSpeech: **Japanese only.** The part of speech for the word. The service uses the value to + produce the correct intonation for the word. You can create only a single entry, with or without a single part of + speech, for any word; you cannot create multiple entries with different parts of speech for the same word. For + more information, see [Working with Japanese + entries](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-rules#jaNotes). - - returns: An initialized `Translation`. + - returns: An initialized `Translation`. */ public init( translation: String, diff --git a/Source/TextToSpeechV1/Models/UpdateVoiceModel.swift b/Source/TextToSpeechV1/Models/UpdateVoiceModel.swift index be69c86f8..4081d2650 100644 --- a/Source/TextToSpeechV1/Models/UpdateVoiceModel.swift +++ b/Source/TextToSpeechV1/Models/UpdateVoiceModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,14 +45,14 @@ internal struct UpdateVoiceModel: Codable, Equatable { } /** - Initialize a `UpdateVoiceModel` with member variables. + Initialize a `UpdateVoiceModel` with member variables. - - parameter name: A new name for the custom voice model. - - parameter description: A new description for the custom voice model. - - parameter words: An array of `Word` objects that provides the words and their translations that are to be - added or updated for the custom voice model. Pass an empty array to make no additions or updates. + - parameter name: A new name for the custom voice model. + - parameter description: A new description for the custom voice model. + - parameter words: An array of `Word` objects that provides the words and their translations that are to be + added or updated for the custom voice model. Pass an empty array to make no additions or updates. - - returns: An initialized `UpdateVoiceModel`. + - returns: An initialized `UpdateVoiceModel`. */ public init( name: String? = nil, diff --git a/Source/TextToSpeechV1/Models/Voice.swift b/Source/TextToSpeechV1/Models/Voice.swift index 28d94ce0a..4c0769ba9 100644 --- a/Source/TextToSpeechV1/Models/Voice.swift +++ b/Source/TextToSpeechV1/Models/Voice.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/TextToSpeechV1/Models/VoiceModel.swift b/Source/TextToSpeechV1/Models/VoiceModel.swift index 5d5da5360..f2ad91218 100644 --- a/Source/TextToSpeechV1/Models/VoiceModel.swift +++ b/Source/TextToSpeechV1/Models/VoiceModel.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/TextToSpeechV1/Models/VoiceModels.swift b/Source/TextToSpeechV1/Models/VoiceModels.swift index c88f55666..25da15950 100644 --- a/Source/TextToSpeechV1/Models/VoiceModels.swift +++ b/Source/TextToSpeechV1/Models/VoiceModels.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/TextToSpeechV1/Models/Voices.swift b/Source/TextToSpeechV1/Models/Voices.swift index 355d64717..89be5e622 100644 --- a/Source/TextToSpeechV1/Models/Voices.swift +++ b/Source/TextToSpeechV1/Models/Voices.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/TextToSpeechV1/Models/Word.swift b/Source/TextToSpeechV1/Models/Word.swift index 42947a71b..cdfcba560 100644 --- a/Source/TextToSpeechV1/Models/Word.swift +++ b/Source/TextToSpeechV1/Models/Word.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,20 +76,20 @@ public struct Word: Codable, Equatable { } /** - Initialize a `Word` with member variables. + Initialize a `Word` with member variables. - - parameter word: The word for the custom voice model. The maximum length of a word is 49 characters. - - parameter translation: The phonetic or sounds-like translation for the word. A phonetic translation is based - on the SSML format for representing the phonetic string of a word either as an IPA or IBM SPR translation. The - Arabic, Chinese, Dutch, and Korean languages support only IPA. A sounds-like translation consists of one or more - words that, when combined, sound like the word. The maximum length of a translation is 499 characters. - - parameter partOfSpeech: **Japanese only.** The part of speech for the word. The service uses the value to - produce the correct intonation for the word. You can create only a single entry, with or without a single part of - speech, for any word; you cannot create multiple entries with different parts of speech for the same word. For - more information, see [Working with Japanese - entries](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-rules#jaNotes). + - parameter word: The word for the custom voice model. The maximum length of a word is 49 characters. + - parameter translation: The phonetic or sounds-like translation for the word. A phonetic translation is based + on the SSML format for representing the phonetic string of a word either as an IPA or IBM SPR translation. The + Arabic, Chinese, Dutch, and Korean languages support only IPA. A sounds-like translation consists of one or more + words that, when combined, sound like the word. The maximum length of a translation is 499 characters. + - parameter partOfSpeech: **Japanese only.** The part of speech for the word. The service uses the value to + produce the correct intonation for the word. You can create only a single entry, with or without a single part of + speech, for any word; you cannot create multiple entries with different parts of speech for the same word. For + more information, see [Working with Japanese + entries](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-rules#jaNotes). - - returns: An initialized `Word`. + - returns: An initialized `Word`. */ public init( word: String, diff --git a/Source/TextToSpeechV1/Models/Words.swift b/Source/TextToSpeechV1/Models/Words.swift index 447942877..2cc1046ed 100644 --- a/Source/TextToSpeechV1/Models/Words.swift +++ b/Source/TextToSpeechV1/Models/Words.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,15 +38,15 @@ public struct Words: Codable, Equatable { } /** - Initialize a `Words` with member variables. + Initialize a `Words` with member variables. - - parameter words: The **Add custom words** method accepts an array of `Word` objects. Each object provides a - word that is to be added or updated for the custom voice model and the word's translation. - The **List custom words** method returns an array of `Word` objects. Each object shows a word and its translation - from the custom voice model. The words are listed in alphabetical order, with uppercase letters listed before - lowercase letters. The array is empty if the custom model contains no words. + - parameter words: The **Add custom words** method accepts an array of `Word` objects. Each object provides a + word that is to be added or updated for the custom voice model and the word's translation. + The **List custom words** method returns an array of `Word` objects. Each object shows a word and its translation + from the custom voice model. The words are listed in alphabetical order, with uppercase letters listed before + lowercase letters. The array is empty if the custom model contains no words. - - returns: An initialized `Words`. + - returns: An initialized `Words`. */ public init( words: [Word] diff --git a/Source/TextToSpeechV1/TextToSpeech.swift b/Source/TextToSpeechV1/TextToSpeech.swift index 076070001..a3a6fea6f 100644 --- a/Source/TextToSpeechV1/TextToSpeech.swift +++ b/Source/TextToSpeechV1/TextToSpeech.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ import Foundation import IBMSwiftSDKCore /** - The IBM® Text to Speech service provides APIs that use IBM's speech-synthesis capabilities to synthesize text into - natural-sounding speech in a variety of languages, dialects, and voices. The service supports at least one male or - female voice, sometimes both, for each language. The audio is streamed back to the client with minimal delay. + The IBM Watson™ Text to Speech service provides APIs that use IBM's speech-synthesis capabilities to synthesize + text into natural-sounding speech in a variety of languages, dialects, and voices. The service supports at least one + male or female voice, sometimes both, for each language. The audio is streamed back to the client with minimal delay. For speech synthesis, the service supports a synchronous HTTP Representational State Transfer (REST) interface and a WebSocket interface. Both interfaces support plain text and SSML input. SSML is an XML-based markup language that provides text annotation for speech-synthesis applications. The WebSocket interface also supports the SSML @@ -35,7 +35,7 @@ import IBMSwiftSDKCore public class TextToSpeech { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://stream.watsonplatform.net/text-to-speech/api" + public var serviceURL: String? = "https://api.us-south.text-to-speech.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "TextToSpeech" @@ -60,8 +60,10 @@ public class TextToSpeech { In that case, try another initializer that directly passes in the credentials. */ - public init() throws { - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + public init?() { + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -84,8 +86,8 @@ public class TextToSpeech { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -131,7 +133,8 @@ public class TextToSpeech { List voices. Lists all voices available for use with the service. The information includes the name, language, gender, and other - details about the voice. To see information about a specific voice, use the **Get a voice** method. + details about the voice. The ordering of the list of voices can change from call to call; do not rely on an + alphabetized or static list of voices. To see information about a specific voice, use the **Get a voice** method. **See also:** [Listing all available voices](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-voices#listVoices). @@ -356,38 +359,7 @@ public class TextToSpeech { ) // execute REST request - request.response { (response: WatsonResponse?, error: WatsonError?) in - var response = response - guard let data = response?.result else { - completionHandler(response, error) - return - } - if accept?.lowercased().contains("audio/wav") == true { - // repair the WAV header - var wav = data - guard WAVRepair.isWAVFile(data: wav) else { - let error = WatsonError.other(message: "Expected returned audio to be in WAV format", metadata: nil) - completionHandler(nil, error) - return - } - WAVRepair.repairWAVHeader(data: &wav) - response?.result = wav - completionHandler(response, nil) - } else if accept?.lowercased().contains("ogg") == true && accept?.lowercased().contains("opus") == true { - do { - let decodedAudio = try TextToSpeechDecoder(audioData: data) - response?.result = decodedAudio.pcmDataWithHeaders - completionHandler(response, nil) - } catch { - let error = WatsonError.serialization(values: "returned audio") - completionHandler(nil, error) - return - } - } else { - completionHandler(response, nil) - } - } - + request.response(completionHandler: completionHandler) } /** @@ -1134,9 +1106,11 @@ public class TextToSpeech { Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to - associate the customer ID with the data. - You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes the - data. + associate the customer ID with the data. You associate a customer ID with data by passing the `X-Watson-Metadata` + header with a request that passes the data. + **Note:** If you delete an instance of the service from the service console, all data associated with that service + instance is automatically deleted. This includes all custom voice models and word/translation pairs, and all data + related to speech synthesis requests. **See also:** [Information security](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-information-security#information-security). diff --git a/Source/ToneAnalyzerV3/Models/DocumentAnalysis.swift b/Source/ToneAnalyzerV3/Models/DocumentAnalysis.swift index e53ea01c8..abae4978f 100644 --- a/Source/ToneAnalyzerV3/Models/DocumentAnalysis.swift +++ b/Source/ToneAnalyzerV3/Models/DocumentAnalysis.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/SentenceAnalysis.swift b/Source/ToneAnalyzerV3/Models/SentenceAnalysis.swift index 2abdb8ef7..051e92dcc 100644 --- a/Source/ToneAnalyzerV3/Models/SentenceAnalysis.swift +++ b/Source/ToneAnalyzerV3/Models/SentenceAnalysis.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/ToneAnalysis.swift b/Source/ToneAnalyzerV3/Models/ToneAnalysis.swift index 894687e58..82aae1d68 100644 --- a/Source/ToneAnalyzerV3/Models/ToneAnalysis.swift +++ b/Source/ToneAnalyzerV3/Models/ToneAnalysis.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/ToneCategory.swift b/Source/ToneAnalyzerV3/Models/ToneCategory.swift index cc209eac8..d525cb0ba 100644 --- a/Source/ToneAnalyzerV3/Models/ToneCategory.swift +++ b/Source/ToneAnalyzerV3/Models/ToneCategory.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/ToneChatInput.swift b/Source/ToneAnalyzerV3/Models/ToneChatInput.swift index d461889f4..5778edcdb 100644 --- a/Source/ToneAnalyzerV3/Models/ToneChatInput.swift +++ b/Source/ToneAnalyzerV3/Models/ToneChatInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,12 +32,12 @@ internal struct ToneChatInput: Codable, Equatable { } /** - Initialize a `ToneChatInput` with member variables. + Initialize a `ToneChatInput` with member variables. - - parameter utterances: An array of `Utterance` objects that provides the input content that the service is to - analyze. + - parameter utterances: An array of `Utterance` objects that provides the input content that the service is to + analyze. - - returns: An initialized `ToneChatInput`. + - returns: An initialized `ToneChatInput`. */ public init( utterances: [Utterance] diff --git a/Source/ToneAnalyzerV3/Models/ToneChatScore.swift b/Source/ToneAnalyzerV3/Models/ToneChatScore.swift index a2f5a7aee..e7442b00d 100644 --- a/Source/ToneAnalyzerV3/Models/ToneChatScore.swift +++ b/Source/ToneAnalyzerV3/Models/ToneChatScore.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/ToneContent.swift b/Source/ToneAnalyzerV3/Models/ToneContent.swift index 63f1bee1b..b1988d86c 100644 --- a/Source/ToneAnalyzerV3/Models/ToneContent.swift +++ b/Source/ToneAnalyzerV3/Models/ToneContent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/ToneInput.swift b/Source/ToneAnalyzerV3/Models/ToneInput.swift index 905f0835f..d9cc223e5 100644 --- a/Source/ToneAnalyzerV3/Models/ToneInput.swift +++ b/Source/ToneAnalyzerV3/Models/ToneInput.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct ToneInput: Codable, Equatable { } /** - Initialize a `ToneInput` with member variables. + Initialize a `ToneInput` with member variables. - - parameter text: The input content that the service is to analyze. + - parameter text: The input content that the service is to analyze. - - returns: An initialized `ToneInput`. + - returns: An initialized `ToneInput`. */ public init( text: String diff --git a/Source/ToneAnalyzerV3/Models/ToneScore.swift b/Source/ToneAnalyzerV3/Models/ToneScore.swift index 8fd1f922e..55e460013 100644 --- a/Source/ToneAnalyzerV3/Models/ToneScore.swift +++ b/Source/ToneAnalyzerV3/Models/ToneScore.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/Utterance.swift b/Source/ToneAnalyzerV3/Models/Utterance.swift index c0208a5f4..cca704490 100644 --- a/Source/ToneAnalyzerV3/Models/Utterance.swift +++ b/Source/ToneAnalyzerV3/Models/Utterance.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,14 +39,14 @@ public struct Utterance: Codable, Equatable { } /** - Initialize a `Utterance` with member variables. + Initialize a `Utterance` with member variables. - - parameter text: An utterance contributed by a user in the conversation that is to be analyzed. The utterance - can contain multiple sentences. - - parameter user: A string that identifies the user who contributed the utterance specified by the `text` - parameter. + - parameter text: An utterance contributed by a user in the conversation that is to be analyzed. The utterance + can contain multiple sentences. + - parameter user: A string that identifies the user who contributed the utterance specified by the `text` + parameter. - - returns: An initialized `Utterance`. + - returns: An initialized `Utterance`. */ public init( text: String, diff --git a/Source/ToneAnalyzerV3/Models/UtteranceAnalyses.swift b/Source/ToneAnalyzerV3/Models/UtteranceAnalyses.swift index 38a3aa18b..235cc69d3 100644 --- a/Source/ToneAnalyzerV3/Models/UtteranceAnalyses.swift +++ b/Source/ToneAnalyzerV3/Models/UtteranceAnalyses.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/Models/UtteranceAnalysis.swift b/Source/ToneAnalyzerV3/Models/UtteranceAnalysis.swift index b028ef9b0..fe127baa7 100644 --- a/Source/ToneAnalyzerV3/Models/UtteranceAnalysis.swift +++ b/Source/ToneAnalyzerV3/Models/UtteranceAnalysis.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/ToneAnalyzerV3/ToneAnalyzer.swift b/Source/ToneAnalyzerV3/ToneAnalyzer.swift index 4cbb720ef..59be97bd1 100644 --- a/Source/ToneAnalyzerV3/ToneAnalyzer.swift +++ b/Source/ToneAnalyzerV3/ToneAnalyzer.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ import IBMSwiftSDKCore public class ToneAnalyzer { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/tone-analyzer/api" + public var serviceURL: String? = "https://api.us-south.tone-analyzer.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "ToneAnalyzer" @@ -58,10 +58,11 @@ public class ToneAnalyzer { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -87,8 +88,8 @@ public class ToneAnalyzer { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -152,6 +153,11 @@ public class ToneAnalyzer { - parameter sentences: Indicates whether the service is to return an analysis of each individual sentence in addition to its analysis of the full document. If `true` (the default), the service returns results for each sentence. + - parameter tones: **`2017-09-21`:** Deprecated. The service continues to accept the parameter for + backward-compatibility, but the parameter no longer affects the response. + **`2016-05-19`:** A comma-separated list of tones for which the service is to return its analysis of the input; + the indicated tones apply both to the full document and to individual sentences of the document. You can specify + one or more of the valid values. Omit the parameter to request results for all three tones. - parameter contentLanguage: The language of the input text for the request: English or French. Regional variants are treated as their parent language; for example, `en-US` is interpreted as `en`. The input content must match the specified language. Do not submit content that contains both languages. You can use different languages for @@ -167,6 +173,7 @@ public class ToneAnalyzer { public func tone( toneContent: ToneContent, sentences: Bool? = nil, + tones: [String]? = nil, contentLanguage: String? = nil, acceptLanguage: String? = nil, headers: [String: String]? = nil, @@ -201,6 +208,10 @@ public class ToneAnalyzer { let queryParameter = URLQueryItem(name: "sentences", value: "\(sentences)") queryParameters.append(queryParameter) } + if let tones = tones { + let queryParameter = URLQueryItem(name: "tones", value: tones.joined(separator: ",")) + queryParameters.append(queryParameter) + } // construct REST request diff --git a/Source/VisualRecognitionV3/Models/Class.swift b/Source/VisualRecognitionV3/Models/Class.swift index 1c0789a6f..8e6951dd3 100644 --- a/Source/VisualRecognitionV3/Models/Class.swift +++ b/Source/VisualRecognitionV3/Models/Class.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/ClassResult.swift b/Source/VisualRecognitionV3/Models/ClassResult.swift index 5ec07a26e..fe81de588 100644 --- a/Source/VisualRecognitionV3/Models/ClassResult.swift +++ b/Source/VisualRecognitionV3/Models/ClassResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/ClassifiedImage.swift b/Source/VisualRecognitionV3/Models/ClassifiedImage.swift index e6edcc194..1226d7574 100644 --- a/Source/VisualRecognitionV3/Models/ClassifiedImage.swift +++ b/Source/VisualRecognitionV3/Models/ClassifiedImage.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/ClassifiedImages.swift b/Source/VisualRecognitionV3/Models/ClassifiedImages.swift index 11decfac9..42355715a 100644 --- a/Source/VisualRecognitionV3/Models/ClassifiedImages.swift +++ b/Source/VisualRecognitionV3/Models/ClassifiedImages.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/Classifier.swift b/Source/VisualRecognitionV3/Models/Classifier.swift index c57a9bb05..93d445973 100644 --- a/Source/VisualRecognitionV3/Models/Classifier.swift +++ b/Source/VisualRecognitionV3/Models/Classifier.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/ClassifierResult.swift b/Source/VisualRecognitionV3/Models/ClassifierResult.swift index 900430d43..f70889fe1 100644 --- a/Source/VisualRecognitionV3/Models/ClassifierResult.swift +++ b/Source/VisualRecognitionV3/Models/ClassifierResult.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/Classifiers.swift b/Source/VisualRecognitionV3/Models/Classifiers.swift index 583e596a7..ca7c936eb 100644 --- a/Source/VisualRecognitionV3/Models/Classifiers.swift +++ b/Source/VisualRecognitionV3/Models/Classifiers.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/ErrorInfo.swift b/Source/VisualRecognitionV3/Models/ErrorInfo.swift index b683ea46c..31cf302ee 100644 --- a/Source/VisualRecognitionV3/Models/ErrorInfo.swift +++ b/Source/VisualRecognitionV3/Models/ErrorInfo.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/Models/WarningInfo.swift b/Source/VisualRecognitionV3/Models/WarningInfo.swift index 25c733e94..68ba04881 100644 --- a/Source/VisualRecognitionV3/Models/WarningInfo.swift +++ b/Source/VisualRecognitionV3/Models/WarningInfo.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2018. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV3/VisualRecognition.swift b/Source/VisualRecognitionV3/VisualRecognition.swift index c34b83527..3d170359a 100644 --- a/Source/VisualRecognitionV3/VisualRecognition.swift +++ b/Source/VisualRecognitionV3/VisualRecognition.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2016, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import IBMSwiftSDKCore public class VisualRecognition { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/visual-recognition/api" + public var serviceURL: String? = "https://api.us-south.visual-recognition.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "WatsonVisionCombined" @@ -53,10 +53,11 @@ public class VisualRecognition { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -82,8 +83,8 @@ public class VisualRecognition { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -114,16 +115,6 @@ public class VisualRecognition { errorMessage = message } else if case let .some(.string(message)) = json["message"] { errorMessage = message - // ErrorAuthentication - } else if case let .some(.string(message)) = json["statusInfo"] { - errorMessage = message - // ErrorInfo - } else if case let .some(.object(errorObj)) = json["error"], // 404 - case let .some(.string(message)) = errorObj["description"] { - errorMessage = message - // ErrorHTML - } else if case let .some(.string(message)) = json["Error"] { // 413 - errorMessage = message } else { errorMessage = HTTPURLResponse.localizedString(forStatusCode: response.statusCode) } @@ -198,17 +189,20 @@ public class VisualRecognition { multipartFormData.append(thresholdData, withName: "threshold") } } - - // HAND EDIT: concat owners into csv data - if let csvOwners = owners?.joined(separator: ",").data(using: .utf8) { - multipartFormData.append(csvOwners, withName: "owners") + if let owners = owners { + for item in owners { + if let itemData = item.data(using: .utf8) { + multipartFormData.append(itemData, withName: "owners") + } + } } - - // HAND EDIT: concat classifier IDs into csv data - if let csvClassifierIDs = classifierIDs?.joined(separator: ",").data(using: .utf8) { - multipartFormData.append(csvClassifierIDs, withName: "classifier_ids") + if let classifierIDs = classifierIDs { + for item in classifierIDs { + if let itemData = item.data(using: .utf8) { + multipartFormData.append(itemData, withName: "classifier_ids") + } + } } - guard let body = try? multipartFormData.toData() else { completionHandler(nil, WatsonError.serialization(values: "request multipart form data")) return @@ -299,10 +293,10 @@ public class VisualRecognition { } positiveExamples.forEach { (classname, value) in let partName = "\(classname)_positive_examples" - multipartFormData.append(value, withName: partName, fileName: "\(classname).zip") + multipartFormData.append(value, withName: partName, fileName: classname) } if let negativeExamples = negativeExamples { - multipartFormData.append(negativeExamples, withName: "negative_examples", fileName: negativeExamplesFilename ?? "filename.zip") + multipartFormData.append(negativeExamples, withName: "negative_examples", fileName: negativeExamplesFilename ?? "filename") } guard let body = try? multipartFormData.toData() else { completionHandler(nil, WatsonError.serialization(values: "request multipart form data")) @@ -498,11 +492,11 @@ public class VisualRecognition { if let positiveExamples = positiveExamples { positiveExamples.forEach { (classname, value) in let partName = "\(classname)_positive_examples" - multipartFormData.append(value, withName: partName, fileName: "\(classname).zip") + multipartFormData.append(value, withName: partName, fileName: classname) } } if let negativeExamples = negativeExamples { - multipartFormData.append(negativeExamples, withName: "negative_examples", fileName: negativeExamplesFilename ?? "filename.zip") + multipartFormData.append(negativeExamples, withName: "negative_examples", fileName: negativeExamplesFilename ?? "filename") } guard let body = try? multipartFormData.toData() else { completionHandler(nil, WatsonError.serialization(values: "request multipart form data")) diff --git a/Source/VisualRecognitionV4/Models/AnalyzeResponse.swift b/Source/VisualRecognitionV4/Models/AnalyzeResponse.swift index 4d1f73fa8..f6af0267d 100644 --- a/Source/VisualRecognitionV4/Models/AnalyzeResponse.swift +++ b/Source/VisualRecognitionV4/Models/AnalyzeResponse.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/BaseCollection.swift b/Source/VisualRecognitionV4/Models/BaseCollection.swift index 565b0bbd2..0f61c2dfd 100644 --- a/Source/VisualRecognitionV4/Models/BaseCollection.swift +++ b/Source/VisualRecognitionV4/Models/BaseCollection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,19 +69,19 @@ internal struct BaseCollection: Codable, Equatable { } /** - Initialize a `BaseCollection` with member variables. + Initialize a `BaseCollection` with member variables. - - parameter collectionID: The identifier of the collection. - - parameter name: The name of the collection. The name can contain alphanumeric, underscore, hyphen, and dot - characters. It cannot begin with the reserved prefix `sys-`. - - parameter description: The description of the collection. - - parameter created: Date and time in Coordinated Universal Time (UTC) that the collection was created. - - parameter updated: Date and time in Coordinated Universal Time (UTC) that the collection was most recently - updated. - - parameter imageCount: Number of images in the collection. - - parameter trainingStatus: Training status information for the collection. + - parameter collectionID: The identifier of the collection. + - parameter name: The name of the collection. The name can contain alphanumeric, underscore, hyphen, and dot + characters. It cannot begin with the reserved prefix `sys-`. + - parameter description: The description of the collection. + - parameter created: Date and time in Coordinated Universal Time (UTC) that the collection was created. + - parameter updated: Date and time in Coordinated Universal Time (UTC) that the collection was most recently + updated. + - parameter imageCount: Number of images in the collection. + - parameter trainingStatus: Training status information for the collection. - - returns: An initialized `BaseCollection`. + - returns: An initialized `BaseCollection`. */ public init( collectionID: String? = nil, diff --git a/Source/VisualRecognitionV4/Models/BaseTrainingDataObjects.swift b/Source/VisualRecognitionV4/Models/BaseTrainingDataObjects.swift index 18d2644f7..b0d3fee3c 100644 --- a/Source/VisualRecognitionV4/Models/BaseTrainingDataObjects.swift +++ b/Source/VisualRecognitionV4/Models/BaseTrainingDataObjects.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ internal struct BaseTrainingDataObjects: Codable, Equatable { } /** - Initialize a `BaseTrainingDataObjects` with member variables. + Initialize a `BaseTrainingDataObjects` with member variables. - - parameter objects: Training data for specific objects. + - parameter objects: Training data for specific objects. - - returns: An initialized `BaseTrainingDataObjects`. + - returns: An initialized `BaseTrainingDataObjects`. */ public init( objects: [TrainingDataObject]? = nil diff --git a/Source/VisualRecognitionV4/Models/Collection.swift b/Source/VisualRecognitionV4/Models/Collection.swift index e051656c4..7987a5c68 100644 --- a/Source/VisualRecognitionV4/Models/Collection.swift +++ b/Source/VisualRecognitionV4/Models/Collection.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/CollectionObjects.swift b/Source/VisualRecognitionV4/Models/CollectionObjects.swift index 8c551ae98..7f1261e3c 100644 --- a/Source/VisualRecognitionV4/Models/CollectionObjects.swift +++ b/Source/VisualRecognitionV4/Models/CollectionObjects.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/CollectionsList.swift b/Source/VisualRecognitionV4/Models/CollectionsList.swift index 0df48ec27..ff47219d8 100644 --- a/Source/VisualRecognitionV4/Models/CollectionsList.swift +++ b/Source/VisualRecognitionV4/Models/CollectionsList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/DetectedObjects.swift b/Source/VisualRecognitionV4/Models/DetectedObjects.swift index edc95b5dd..2db77e00c 100644 --- a/Source/VisualRecognitionV4/Models/DetectedObjects.swift +++ b/Source/VisualRecognitionV4/Models/DetectedObjects.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/Error.swift b/Source/VisualRecognitionV4/Models/Error.swift index 209b9d698..44c8cacdd 100644 --- a/Source/VisualRecognitionV4/Models/Error.swift +++ b/Source/VisualRecognitionV4/Models/Error.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ErrorTarget.swift b/Source/VisualRecognitionV4/Models/ErrorTarget.swift index ec1949af2..43ffda8a3 100644 --- a/Source/VisualRecognitionV4/Models/ErrorTarget.swift +++ b/Source/VisualRecognitionV4/Models/ErrorTarget.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/FileWithMetadata.swift b/Source/VisualRecognitionV4/Models/FileWithMetadata.swift index f9bcbe39e..bfbf4831e 100644 --- a/Source/VisualRecognitionV4/Models/FileWithMetadata.swift +++ b/Source/VisualRecognitionV4/Models/FileWithMetadata.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,13 +44,13 @@ public struct FileWithMetadata: Codable, Equatable { } /** - Initialize a `FileWithMetadata` with member variables. + Initialize a `FileWithMetadata` with member variables. - - parameter data: The data / content for the file. - - parameter filename: The filename of the file. - - parameter contentType: The content type of the file. + - parameter data: The data / content for the file. + - parameter filename: The filename of the file. + - parameter contentType: The content type of the file. - - returns: An initialized `FileWithMetadata`. + - returns: An initialized `FileWithMetadata`. */ public init( data: Data, diff --git a/Source/VisualRecognitionV4/Models/Image.swift b/Source/VisualRecognitionV4/Models/Image.swift index 5be238cc8..1819f04e1 100644 --- a/Source/VisualRecognitionV4/Models/Image.swift +++ b/Source/VisualRecognitionV4/Models/Image.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ImageDetails.swift b/Source/VisualRecognitionV4/Models/ImageDetails.swift index 4bfbe353d..6f3a019c5 100644 --- a/Source/VisualRecognitionV4/Models/ImageDetails.swift +++ b/Source/VisualRecognitionV4/Models/ImageDetails.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ImageDetailsList.swift b/Source/VisualRecognitionV4/Models/ImageDetailsList.swift index ab993faf0..ba47160de 100644 --- a/Source/VisualRecognitionV4/Models/ImageDetailsList.swift +++ b/Source/VisualRecognitionV4/Models/ImageDetailsList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ImageDimensions.swift b/Source/VisualRecognitionV4/Models/ImageDimensions.swift index 227968240..e1b5000bf 100644 --- a/Source/VisualRecognitionV4/Models/ImageDimensions.swift +++ b/Source/VisualRecognitionV4/Models/ImageDimensions.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ImageSource.swift b/Source/VisualRecognitionV4/Models/ImageSource.swift index 11fcbf7c8..72873cab1 100644 --- a/Source/VisualRecognitionV4/Models/ImageSource.swift +++ b/Source/VisualRecognitionV4/Models/ImageSource.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ImageSummary.swift b/Source/VisualRecognitionV4/Models/ImageSummary.swift index 50a76f1f3..f696daf9d 100644 --- a/Source/VisualRecognitionV4/Models/ImageSummary.swift +++ b/Source/VisualRecognitionV4/Models/ImageSummary.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ImageSummaryList.swift b/Source/VisualRecognitionV4/Models/ImageSummaryList.swift index 30e3173bc..0efc7201e 100644 --- a/Source/VisualRecognitionV4/Models/ImageSummaryList.swift +++ b/Source/VisualRecognitionV4/Models/ImageSummaryList.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/Location.swift b/Source/VisualRecognitionV4/Models/Location.swift index f6b82c15d..03ad47709 100644 --- a/Source/VisualRecognitionV4/Models/Location.swift +++ b/Source/VisualRecognitionV4/Models/Location.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,14 +50,14 @@ public struct Location: Codable, Equatable { } /** - Initialize a `Location` with member variables. + Initialize a `Location` with member variables. - - parameter top: Y-position of top-left pixel of the bounding box. - - parameter left: X-position of top-left pixel of the bounding box. - - parameter width: Width in pixels of of the bounding box. - - parameter height: Height in pixels of the bounding box. + - parameter top: Y-position of top-left pixel of the bounding box. + - parameter left: X-position of top-left pixel of the bounding box. + - parameter width: Width in pixels of of the bounding box. + - parameter height: Height in pixels of the bounding box. - - returns: An initialized `Location`. + - returns: An initialized `Location`. */ public init( top: Int, diff --git a/Source/VisualRecognitionV4/Models/ObjectDetail.swift b/Source/VisualRecognitionV4/Models/ObjectDetail.swift index dc3e9ee58..6b0f1a27a 100644 --- a/Source/VisualRecognitionV4/Models/ObjectDetail.swift +++ b/Source/VisualRecognitionV4/Models/ObjectDetail.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift b/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift index e6bb1e77a..0a7350f2e 100644 --- a/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift +++ b/Source/VisualRecognitionV4/Models/ObjectTrainingStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,17 +63,17 @@ public struct ObjectTrainingStatus: Codable, Equatable { } /** - Initialize a `ObjectTrainingStatus` with member variables. + Initialize a `ObjectTrainingStatus` with member variables. - - parameter ready: Whether you can analyze images in the collection with the **objects** feature. - - parameter inProgress: Whether training is in progress. - - parameter dataChanged: Whether there are changes to the training data since the most recent training. - - parameter latestFailed: Whether the most recent training failed. - - parameter rscnnReady: Whether the model can be downloaded after the training status is `ready`. - - parameter description: Details about the training. If training is in progress, includes information about the - status. If training is not in progress, includes a success message or information about why training failed. + - parameter ready: Whether you can analyze images in the collection with the **objects** feature. + - parameter inProgress: Whether training is in progress. + - parameter dataChanged: Whether there are changes to the training data since the most recent training. + - parameter latestFailed: Whether the most recent training failed. + - parameter rscnnReady: Whether the model can be downloaded after the training status is `ready`. + - parameter description: Details about the training. If training is in progress, includes information about the + status. If training is not in progress, includes a success message or information about why training failed. - - returns: An initialized `ObjectTrainingStatus`. + - returns: An initialized `ObjectTrainingStatus`. */ public init( ready: Bool, diff --git a/Source/VisualRecognitionV4/Models/TrainingDataObject.swift b/Source/VisualRecognitionV4/Models/TrainingDataObject.swift index 1a8044369..ad1c47d3e 100644 --- a/Source/VisualRecognitionV4/Models/TrainingDataObject.swift +++ b/Source/VisualRecognitionV4/Models/TrainingDataObject.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ public struct TrainingDataObject: Codable, Equatable { } /** - Initialize a `TrainingDataObject` with member variables. + Initialize a `TrainingDataObject` with member variables. - - parameter object: The name of the object. - - parameter location: Defines the location of the bounding box around the object. + - parameter object: The name of the object. + - parameter location: Defines the location of the bounding box around the object. - - returns: An initialized `TrainingDataObject`. + - returns: An initialized `TrainingDataObject`. */ public init( object: String? = nil, diff --git a/Source/VisualRecognitionV4/Models/TrainingDataObjects.swift b/Source/VisualRecognitionV4/Models/TrainingDataObjects.swift index 36f920ee4..c5178ab8b 100644 --- a/Source/VisualRecognitionV4/Models/TrainingDataObjects.swift +++ b/Source/VisualRecognitionV4/Models/TrainingDataObjects.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/TrainingEvent.swift b/Source/VisualRecognitionV4/Models/TrainingEvent.swift index 7be6106db..6004d6b3b 100644 --- a/Source/VisualRecognitionV4/Models/TrainingEvent.swift +++ b/Source/VisualRecognitionV4/Models/TrainingEvent.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/TrainingEvents.swift b/Source/VisualRecognitionV4/Models/TrainingEvents.swift index ead2de3ac..548303fba 100644 --- a/Source/VisualRecognitionV4/Models/TrainingEvents.swift +++ b/Source/VisualRecognitionV4/Models/TrainingEvents.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/Models/TrainingStatus.swift b/Source/VisualRecognitionV4/Models/TrainingStatus.swift index 75ec7c2e9..cabc0d4a4 100644 --- a/Source/VisualRecognitionV4/Models/TrainingStatus.swift +++ b/Source/VisualRecognitionV4/Models/TrainingStatus.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,11 @@ public struct TrainingStatus: Codable, Equatable { } /** - Initialize a `TrainingStatus` with member variables. + Initialize a `TrainingStatus` with member variables. - - parameter objects: Training status for the objects in the collection. + - parameter objects: Training status for the objects in the collection. - - returns: An initialized `TrainingStatus`. + - returns: An initialized `TrainingStatus`. */ public init( objects: ObjectTrainingStatus diff --git a/Source/VisualRecognitionV4/Models/UpdateObjectMetadata.swift b/Source/VisualRecognitionV4/Models/UpdateObjectMetadata.swift index 9fca27f42..e1723b330 100644 --- a/Source/VisualRecognitionV4/Models/UpdateObjectMetadata.swift +++ b/Source/VisualRecognitionV4/Models/UpdateObjectMetadata.swift @@ -39,13 +39,13 @@ public struct UpdateObjectMetadata: Codable, Equatable { } /** - Initialize a `UpdateObjectMetadata` with member variables. + Initialize a `UpdateObjectMetadata` with member variables. - - parameter object: The updated name of the object. The name can contain alphanumeric, underscore, hyphen, - space, and dot characters. It cannot begin with the reserved prefix `sys-`. - - parameter count: Number of bounding boxes in the collection with the updated object name. + - parameter object: The updated name of the object. The name can contain alphanumeric, underscore, hyphen, + space, and dot characters. It cannot begin with the reserved prefix `sys-`. + - parameter count: Number of bounding boxes in the collection with the updated object name. - - returns: An initialized `UpdateObjectMetadata`. + - returns: An initialized `UpdateObjectMetadata`. */ public init( object: String, diff --git a/Source/VisualRecognitionV4/Models/Warning.swift b/Source/VisualRecognitionV4/Models/Warning.swift index 479f30ec2..736da7155 100644 --- a/Source/VisualRecognitionV4/Models/Warning.swift +++ b/Source/VisualRecognitionV4/Models/Warning.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/Source/VisualRecognitionV4/VisualRecognition.swift b/Source/VisualRecognitionV4/VisualRecognition.swift index 78d0cf955..e0d09d3f2 100644 --- a/Source/VisualRecognitionV4/VisualRecognition.swift +++ b/Source/VisualRecognitionV4/VisualRecognition.swift @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2019, 2020. + * (C) Copyright IBM Corp. 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import IBMSwiftSDKCore public class VisualRecognition { /// The base URL to use when contacting the service. - public var serviceURL: String? = "https://gateway.watsonplatform.net/visual-recognition/api" + public var serviceURL: String? = "https://api.us-south.visual-recognition.watson.cloud.ibm.com" /// Service identifiers internal let serviceName = "WatsonVisionCombined" @@ -53,10 +53,11 @@ public class VisualRecognition { - parameter version: The release date of the version of the API to use. Specify the date in "YYYY-MM-DD" format. */ - public init(version: String) throws { + public init?(version: String) { self.version = version - - let authenticator = try ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) + guard let authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(credentialPrefix: serviceSdkName) else { + return nil + } self.authenticator = authenticator if let serviceURL = CredentialUtils.getServiceURL(credentialPrefix: serviceSdkName) { @@ -82,8 +83,8 @@ public class VisualRecognition { #if !os(Linux) /** - Allow network requests to a server without verification of the server certificate. - **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. + Allow network requests to a server without verification of the server certificate. + **IMPORTANT**: This should ONLY be used if truly intended, as it is unsafe otherwise. */ public func disableSSLVerification() { session = InsecureConnection.session() @@ -161,17 +162,16 @@ public class VisualRecognition { { // construct body let multipartFormData = MultipartFormData() - - // HAND EDIT: join collectionIDs into CSV string - if let csvCollectionIDsData = collectionIDs.joined(separator: ",").data(using: .utf8) { - multipartFormData.append(csvCollectionIDsData, withName: "collection_ids") + for item in collectionIDs { + if let itemData = item.data(using: .utf8) { + multipartFormData.append(itemData, withName: "collection_ids") + } } - - // HAND EDIT: join features into CSV string - if let csvFeaturesData = features.joined(separator: ",").data(using: .utf8) { - multipartFormData.append(csvFeaturesData, withName: "features") + for item in features { + if let itemData = item.data(using: .utf8) { + multipartFormData.append(itemData, withName: "features") + } } - if let imagesFile = imagesFile { for item in imagesFile { multipartFormData.append(item.data, withName: "images_file", mimeType: item.contentType, fileName: item.filename)