diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java index 1c637845af6..1ada85669eb 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -101,10 +101,10 @@ */ public class Assistant extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "assistant"; + private static final String DEFAULT_SERVICE_NAME = "conversation"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/assistant/api"; + "https://api.us-south.assistant.watson.cloud.ibm.com"; private String versionDate; @@ -171,8 +171,6 @@ public Assistant(String versionDate, String serviceName, Authenticator authentic * 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. - * * @param messageOptions the {@link MessageOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link MessageResponse} */ @@ -234,9 +232,6 @@ public ServiceCall message(MessageOptions messageOptions) { * *

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**. - * * @param listWorkspacesOptions the {@link ListWorkspacesOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection} @@ -278,9 +273,6 @@ public ServiceCall listWorkspaces( * *

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**. - * * @return a {@link ServiceCall} with a response type of {@link WorkspaceCollection} */ public ServiceCall listWorkspaces() { @@ -293,9 +285,6 @@ public ServiceCall listWorkspaces() { *

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**. - * * @param createWorkspaceOptions the {@link CreateWorkspaceOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link Workspace} @@ -384,9 +373,6 @@ public ServiceCall createWorkspace(CreateWorkspaceOptions createWorks *

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**. - * * @return a {@link ServiceCall} with a response type of {@link Workspace} */ public ServiceCall createWorkspace() { @@ -398,10 +384,6 @@ public ServiceCall createWorkspace() { * *

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**. - * * @param getWorkspaceOptions the {@link GetWorkspaceOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Workspace} */ @@ -440,9 +422,6 @@ public ServiceCall getWorkspace(GetWorkspaceOptions getWorkspaceOptio *

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**. - * * @param updateWorkspaceOptions the {@link UpdateWorkspaceOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link Workspace} @@ -535,9 +514,6 @@ public ServiceCall updateWorkspace(UpdateWorkspaceOptions updateWorks * *

Delete a workspace from the service instance. * - *

This operation is limited to 30 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param deleteWorkspaceOptions the {@link DeleteWorkspaceOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of Void @@ -567,10 +543,6 @@ public ServiceCall deleteWorkspace(DeleteWorkspaceOptions deleteWorkspaceO * *

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**. - * * @param listIntentsOptions the {@link ListIntentsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link IntentCollection} */ @@ -617,9 +589,6 @@ public ServiceCall listIntents(ListIntentsOptions listIntentsO *

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**. - * * @param createIntentOptions the {@link CreateIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Intent} */ @@ -663,10 +632,6 @@ public ServiceCall createIntent(CreateIntentOptions createIntentOptions) * *

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**. - * * @param getIntentOptions the {@link GetIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Intent} */ @@ -705,9 +670,6 @@ public ServiceCall getIntent(GetIntentOptions getIntentOptions) { *

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**. - * * @param updateIntentOptions the {@link UpdateIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Intent} */ @@ -756,9 +718,6 @@ public ServiceCall updateIntent(UpdateIntentOptions updateIntentOptions) * *

Delete an intent from a workspace. * - *

This operation is limited to 2000 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param deleteIntentOptions the {@link DeleteIntentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ @@ -786,9 +745,6 @@ public ServiceCall deleteIntent(DeleteIntentOptions deleteIntentOptions) { * *

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**. - * * @param listExamplesOptions the {@link ListExamplesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ExampleCollection} */ @@ -832,9 +788,6 @@ public ServiceCall listExamples(ListExamplesOptions listExamp *

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**. - * * @param createExampleOptions the {@link CreateExampleOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link Example} @@ -876,9 +829,6 @@ public ServiceCall createExample(CreateExampleOptions createExampleOpti * *

Get information about a user input example. * - *

This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate - * limiting**. - * * @param getExampleOptions the {@link GetExampleOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Example} */ @@ -915,9 +865,6 @@ public ServiceCall getExample(GetExampleOptions getExampleOptions) { *

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**. - * * @param updateExampleOptions the {@link UpdateExampleOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link Example} @@ -963,9 +910,6 @@ public ServiceCall updateExample(UpdateExampleOptions updateExampleOpti * *

Delete a user input example from an intent. * - *

This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param deleteExampleOptions the {@link DeleteExampleOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of Void @@ -997,9 +941,6 @@ public ServiceCall deleteExample(DeleteExampleOptions deleteExampleOptions *

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**. - * * @param listCounterexamplesOptions the {@link ListCounterexamplesOptions} containing the options * for the call * @return a {@link ServiceCall} with a response type of {@link CounterexampleCollection} @@ -1047,9 +988,6 @@ public ServiceCall listCounterexamples( *

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**. - * * @param createCounterexampleOptions the {@link CreateCounterexampleOptions} containing the * options for the call * @return a {@link ServiceCall} with a response type of {@link Counterexample} @@ -1088,9 +1026,6 @@ public ServiceCall createCounterexample( *

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**. - * * @param getCounterexampleOptions the {@link GetCounterexampleOptions} containing the options for * the call * @return a {@link ServiceCall} with a response type of {@link Counterexample} @@ -1128,12 +1063,6 @@ public ServiceCall getCounterexample( *

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**. - * * @param updateCounterexampleOptions the {@link UpdateCounterexampleOptions} containing the * options for the call * @return a {@link ServiceCall} with a response type of {@link Counterexample} @@ -1176,9 +1105,6 @@ public ServiceCall updateCounterexample( *

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**. - * * @param deleteCounterexampleOptions the {@link DeleteCounterexampleOptions} containing the * options for the call * @return a {@link ServiceCall} with a response type of Void @@ -1211,10 +1137,6 @@ public ServiceCall deleteCounterexample( * *

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**. - * * @param listEntitiesOptions the {@link ListEntitiesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link EntityCollection} */ @@ -1261,9 +1183,6 @@ public ServiceCall listEntities(ListEntitiesOptions listEntiti *

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**. - * * @param createEntityOptions the {@link CreateEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Entity} */ @@ -1316,10 +1235,6 @@ public ServiceCall createEntity(CreateEntityOptions createEntityOptions) * *

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**. - * * @param getEntityOptions the {@link GetEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Entity} */ @@ -1358,9 +1273,6 @@ public ServiceCall getEntity(GetEntityOptions getEntityOptions) { *

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**. - * * @param updateEntityOptions the {@link UpdateEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Entity} */ @@ -1418,9 +1330,6 @@ public ServiceCall updateEntity(UpdateEntityOptions updateEntityOptions) * *

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**. - * * @param deleteEntityOptions the {@link DeleteEntityOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ @@ -1449,9 +1358,6 @@ public ServiceCall deleteEntity(DeleteEntityOptions deleteEntityOptions) { *

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**. - * * @param listMentionsOptions the {@link ListMentionsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link EntityMentionCollection} */ @@ -1487,9 +1393,6 @@ public ServiceCall listMentions( * *

List the values for an entity. * - *

This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param listValuesOptions the {@link ListValuesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ValueCollection} */ @@ -1536,9 +1439,6 @@ public ServiceCall listValues(ListValuesOptions listValuesOptio *

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**. - * * @param createValueOptions the {@link CreateValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Value} */ @@ -1594,9 +1494,6 @@ public ServiceCall createValue(CreateValueOptions createValueOptions) { * *

Get information about an entity value. * - *

This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate - * limiting**. - * * @param getValueOptions the {@link GetValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Value} */ @@ -1637,9 +1534,6 @@ public ServiceCall getValue(GetValueOptions getValueOptions) { *

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**. - * * @param updateValueOptions the {@link UpdateValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Value} */ @@ -1702,9 +1596,6 @@ public ServiceCall updateValue(UpdateValueOptions updateValueOptions) { * *

Delete a value from an entity. * - *

This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param deleteValueOptions the {@link DeleteValueOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ @@ -1734,9 +1625,6 @@ public ServiceCall deleteValue(DeleteValueOptions deleteValueOptions) { * *

List the synonyms for an entity value. * - *

This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param listSynonymsOptions the {@link ListSynonymsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link SynonymCollection} */ @@ -1782,9 +1670,6 @@ public ServiceCall listSynonyms(ListSynonymsOptions listSynon *

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**. - * * @param createSynonymOptions the {@link CreateSynonymOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link Synonym} @@ -1824,9 +1709,6 @@ public ServiceCall createSynonym(CreateSynonymOptions createSynonymOpti * *

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**. - * * @param getSynonymOptions the {@link GetSynonymOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Synonym} */ @@ -1866,9 +1748,6 @@ public ServiceCall getSynonym(GetSynonymOptions getSynonymOptions) { *

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**. - * * @param updateSynonymOptions the {@link UpdateSynonymOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link Synonym} @@ -1911,9 +1790,6 @@ public ServiceCall updateSynonym(UpdateSynonymOptions updateSynonymOpti * *

Delete a synonym from an entity value. * - *

This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param deleteSynonymOptions the {@link DeleteSynonymOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of Void @@ -1947,9 +1823,6 @@ public ServiceCall deleteSynonym(DeleteSynonymOptions deleteSynonymOptions * *

List the dialog nodes for a workspace. * - *

This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param listDialogNodesOptions the {@link ListDialogNodesOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link DialogNodeCollection} @@ -1996,9 +1869,6 @@ public ServiceCall listDialogNodes( *

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**. - * * @param createDialogNodeOptions the {@link CreateDialogNodeOptions} containing the options for * the call * @return a {@link ServiceCall} with a response type of {@link DialogNode} @@ -2105,9 +1975,6 @@ public ServiceCall createDialogNode(CreateDialogNodeOptions createDi * *

Get information about a dialog node. * - *

This operation is limited to 6000 requests per 5 minutes. For more information, see **Rate - * limiting**. - * * @param getDialogNodeOptions the {@link GetDialogNodeOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of {@link DialogNode} @@ -2145,9 +2012,6 @@ public ServiceCall getDialogNode(GetDialogNodeOptions getDialogNodeO *

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**. - * * @param updateDialogNodeOptions the {@link UpdateDialogNodeOptions} containing the options for * the call * @return a {@link ServiceCall} with a response type of {@link DialogNode} @@ -2258,9 +2122,6 @@ public ServiceCall updateDialogNode(UpdateDialogNodeOptions updateDi * *

Delete a dialog node from a workspace. * - *

This operation is limited to 500 requests per 30 minutes. For more information, see **Rate - * limiting**. - * * @param deleteDialogNodeOptions the {@link DeleteDialogNodeOptions} containing the options for * the call * @return a {@link ServiceCall} with a response type of Void @@ -2292,10 +2153,6 @@ public ServiceCall deleteDialogNode(DeleteDialogNodeOptions deleteDialogNo * *

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**. - * * @param listLogsOptions the {@link ListLogsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LogCollection} */ @@ -2336,10 +2193,6 @@ public ServiceCall listLogs(ListLogsOptions listLogsOptions) { * *

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**. - * * @param listAllLogsOptions the {@link ListAllLogsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link LogCollection} */ @@ -2382,9 +2235,6 @@ public ServiceCall listAllLogs(ListAllLogsOptions listAllLogsOpti * [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**. - * * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the * call * @return a {@link ServiceCall} with a response type of Void diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java index 01f42824181..fe2027cf0ff 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGeneric.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -24,8 +24,7 @@ public class DialogNodeOutputGeneric extends GenericModel { * The type of response returned by the dialog node. The specified response type must be supported * by the client application or channel. * - *

**Note:** The **search_skill** response type is available only for Plus and Premium users, - * and is used only by the v2 runtime API. + *

**Note:** The **search_skill** response type is used only by the v2 runtime API. */ public interface ResponseType { /** text. */ @@ -406,8 +405,7 @@ public Builder newBuilder() { *

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. * * @return the responseType */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java index 68ef115b187..48e3ba0b847 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/DialogSuggestionResponseGeneric.java @@ -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. You may obtain a copy of the License at @@ -24,9 +24,7 @@ public class DialogSuggestionResponseGeneric extends GenericModel { * The type of response returned by the dialog node. The specified response type must be supported * by the client application or channel. * - *

**Note:** The **suggestion** response type is part of the disambiguation feature, which is - * only available for Plus and Premium users. The **search_skill** response type is available only - * for Plus and Premium users, and is used only by the v2 runtime API. + *

**Note:** The **search_skill** response type is is used only by the v2 runtime API. */ public interface ResponseType { /** text. */ @@ -302,9 +300,7 @@ public Builder newBuilder() { *

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. * * @return the responseType */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java index 7a94a307c2c..510b4877128 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/RuntimeResponseGeneric.java @@ -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. You may obtain a copy of the License at @@ -23,9 +23,6 @@ public class RuntimeResponseGeneric extends GenericModel { /** * The type of response returned by the dialog node. The specified response type must be supported * by the client application or channel. - * - *

**Note:** The **suggestion** response type is part of the disambiguation feature, which is - * only available for Plus and Premium users. */ public interface ResponseType { /** text. */ @@ -332,9 +329,6 @@ public Builder newBuilder() { *

The type of response returned by the dialog node. The specified response type must be * supported by the client application or channel. * - *

**Note:** The **suggestion** response type is part of the disambiguation feature, which is - * only available for Plus and Premium users. - * * @return the responseType */ public String responseType() { @@ -470,9 +464,6 @@ public String dialogNode() { *

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. - * * @return the suggestions */ public List suggestions() { diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java index 2759b3ea627..3740fcca68a 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettings.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -182,8 +182,6 @@ public WorkspaceSystemSettingsTooling tooling() { * *

Workspace settings related to the disambiguation feature. * - *

**Note:** This feature is available only to Plus and Premium users. - * * @return the disambiguation */ public WorkspaceSystemSettingsDisambiguation disambiguation() { diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java index 54d5b75dfec..6687e86c20e 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v1/model/WorkspaceSystemSettingsDisambiguation.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,11 +15,7 @@ import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; -/** - * Workspace settings related to the disambiguation feature. - * - *

**Note:** This feature is available only to Plus and Premium users. - */ +/** Workspace settings related to the disambiguation feature. */ public class WorkspaceSystemSettingsDisambiguation extends GenericModel { /** diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java index aae8e8cf061..67794c50b02 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -22,6 +22,9 @@ import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; import com.ibm.watson.assistant.v2.model.CreateSessionOptions; import com.ibm.watson.assistant.v2.model.DeleteSessionOptions; +import com.ibm.watson.assistant.v2.model.DeleteUserDataOptions; +import com.ibm.watson.assistant.v2.model.ListLogsOptions; +import com.ibm.watson.assistant.v2.model.LogCollection; import com.ibm.watson.assistant.v2.model.MessageOptions; import com.ibm.watson.assistant.v2.model.MessageResponse; import com.ibm.watson.assistant.v2.model.MessageResponseStateless; @@ -44,10 +47,10 @@ */ public class Assistant extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "assistant"; + private static final String DEFAULT_SERVICE_NAME = "conversation"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/assistant/api"; + "https://api.us-south.assistant.watson.cloud.ibm.com"; private String versionDate; @@ -175,8 +178,6 @@ public ServiceCall deleteSession(DeleteSessionOptions deleteSessionOptions *

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. - * * @param messageOptions the {@link MessageOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link MessageResponse} */ @@ -217,8 +218,6 @@ public ServiceCall message(MessageOptions messageOptions) { *

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. - * * @param messageStatelessOptions the {@link MessageStatelessOptions} containing the options for * the call * @return a {@link ServiceCall} with a response type of {@link MessageResponseStateless} @@ -258,4 +257,82 @@ public ServiceCall messageStateless( new com.google.gson.reflect.TypeToken() {}.getType()); return createServiceCall(builder.build(), responseConverter); } + + /** + * List log events for an assistant. + * + *

List the events from the log of an assistant. + * + *

This method is available only with Premium plans. + * + * @param listLogsOptions the {@link ListLogsOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link LogCollection} + */ + public ServiceCall listLogs(ListLogsOptions listLogsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + listLogsOptions, "listLogsOptions cannot be null"); + String[] pathSegments = {"v2/assistants", "logs"}; + String[] pathParameters = {listLogsOptions.assistantId()}; + RequestBuilder builder = + RequestBuilder.get( + RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "listLogs"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listLogsOptions.sort() != null) { + builder.query("sort", listLogsOptions.sort()); + } + if (listLogsOptions.filter() != null) { + builder.query("filter", listLogsOptions.filter()); + } + if (listLogsOptions.pageLimit() != null) { + builder.query("page_limit", String.valueOf(listLogsOptions.pageLimit())); + } + if (listLogsOptions.cursor() != null) { + builder.query("cursor", listLogsOptions.cursor()); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * 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**. + * + * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the + * call + * @return a {@link ServiceCall} with a response type of Void + */ + public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull( + deleteUserDataOptions, "deleteUserDataOptions cannot be null"); + String[] pathSegments = {"v2/user_data"}; + RequestBuilder builder = + RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + builder.query("version", versionDate); + Map sdkHeaders = + SdkCommon.getSdkHeaders("conversation", "v2", "deleteUserData"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + builder.query("customer_id", deleteUserDataOptions.customerId()); + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DeleteUserDataOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DeleteUserDataOptions.java new file mode 100644 index 00000000000..6d64ffc7435 --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DeleteUserDataOptions.java @@ -0,0 +1,87 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.assistant.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The deleteUserData options. */ +public class DeleteUserDataOptions extends GenericModel { + + protected String customerId; + + /** Builder. */ + public static class Builder { + private String customerId; + + private Builder(DeleteUserDataOptions deleteUserDataOptions) { + this.customerId = deleteUserDataOptions.customerId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param customerId the customerId + */ + public Builder(String customerId) { + this.customerId = customerId; + } + + /** + * Builds a DeleteUserDataOptions. + * + * @return the deleteUserDataOptions + */ + public DeleteUserDataOptions build() { + return new DeleteUserDataOptions(this); + } + + /** + * Set the customerId. + * + * @param customerId the customerId + * @return the DeleteUserDataOptions builder + */ + public Builder customerId(String customerId) { + this.customerId = customerId; + return this; + } + } + + protected DeleteUserDataOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, "customerId cannot be null"); + customerId = builder.customerId; + } + + /** + * New builder. + * + * @return a DeleteUserDataOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the customerId. + * + *

The customer ID for which all data is to be deleted. + * + * @return the customerId + */ + public String customerId() { + return customerId; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java index e3ba9569cc3..c80276afd74 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/DialogSuggestion.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -25,8 +25,8 @@ public class DialogSuggestion extends GenericModel { /** * Gets the 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 + *

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. * * @return the label diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/ListLogsOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/ListLogsOptions.java new file mode 100644 index 00000000000..60bff4e4849 --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/ListLogsOptions.java @@ -0,0 +1,200 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.assistant.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The listLogs options. */ +public class ListLogsOptions extends GenericModel { + + protected String assistantId; + protected String sort; + protected String filter; + protected Long pageLimit; + protected String cursor; + + /** Builder. */ + public static class Builder { + private String assistantId; + private String sort; + private String filter; + private Long pageLimit; + private String cursor; + + private Builder(ListLogsOptions listLogsOptions) { + this.assistantId = listLogsOptions.assistantId; + this.sort = listLogsOptions.sort; + this.filter = listLogsOptions.filter; + this.pageLimit = listLogsOptions.pageLimit; + this.cursor = listLogsOptions.cursor; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param assistantId the assistantId + */ + public Builder(String assistantId) { + this.assistantId = assistantId; + } + + /** + * Builds a ListLogsOptions. + * + * @return the listLogsOptions + */ + public ListLogsOptions build() { + return new ListLogsOptions(this); + } + + /** + * Set the assistantId. + * + * @param assistantId the assistantId + * @return the ListLogsOptions builder + */ + public Builder assistantId(String assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the ListLogsOptions builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the filter. + * + * @param filter the filter + * @return the ListLogsOptions builder + */ + public Builder filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Set the pageLimit. + * + * @param pageLimit the pageLimit + * @return the ListLogsOptions builder + */ + public Builder pageLimit(long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + + /** + * Set the cursor. + * + * @param cursor the cursor + * @return the ListLogsOptions builder + */ + public Builder cursor(String cursor) { + this.cursor = cursor; + return this; + } + } + + protected ListLogsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.assistantId, "assistantId cannot be empty"); + assistantId = builder.assistantId; + sort = builder.sort; + filter = builder.filter; + pageLimit = builder.pageLimit; + cursor = builder.cursor; + } + + /** + * New builder. + * + * @return a ListLogsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the 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. + * + * @return the assistantId + */ + public String assistantId() { + return assistantId; + } + + /** + * Gets the 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 (`-`). + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the 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). + * + * @return the filter + */ + public String filter() { + return filter; + } + + /** + * Gets the pageLimit. + * + *

The number of records to return in each page of results. + * + * @return the pageLimit + */ + public Long pageLimit() { + return pageLimit; + } + + /** + * Gets the cursor. + * + *

A token identifying the page of results to retrieve. + * + * @return the cursor + */ + public String cursor() { + return cursor; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/Log.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/Log.java new file mode 100644 index 00000000000..11e7f03c207 --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/Log.java @@ -0,0 +1,170 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.assistant.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Log. */ +public class Log extends GenericModel { + + @SerializedName("log_id") + protected String logId; + + protected MessageRequest request; + protected MessageResponse response; + + @SerializedName("assistant_id") + protected String assistantId; + + @SerializedName("session_id") + protected String sessionId; + + @SerializedName("skill_id") + protected String skillId; + + protected String snapshot; + + @SerializedName("request_timestamp") + protected String requestTimestamp; + + @SerializedName("response_timestamp") + protected String responseTimestamp; + + protected String language; + + @SerializedName("customer_id") + protected String customerId; + + /** + * Gets the logId. + * + *

A unique identifier for the logged event. + * + * @return the logId + */ + public String getLogId() { + return logId; + } + + /** + * Gets the request. + * + *

A stateful message request formatted for the Watson Assistant service. + * + * @return the request + */ + public MessageRequest getRequest() { + return request; + } + + /** + * Gets the response. + * + *

A response from the Watson Assistant service. + * + * @return the response + */ + public MessageResponse getResponse() { + return response; + } + + /** + * Gets the assistantId. + * + *

Unique identifier of the assistant. + * + * @return the assistantId + */ + public String getAssistantId() { + return assistantId; + } + + /** + * Gets the sessionId. + * + *

The ID of the session the message was part of. + * + * @return the sessionId + */ + public String getSessionId() { + return sessionId; + } + + /** + * Gets the skillId. + * + *

The unique identifier of the skill that responded to the message. + * + * @return the skillId + */ + public String getSkillId() { + return skillId; + } + + /** + * Gets the snapshot. + * + *

The name of the snapshot (dialog skill version) that responded to the message (for example, + * `draft`). + * + * @return the snapshot + */ + public String getSnapshot() { + return snapshot; + } + + /** + * Gets the requestTimestamp. + * + *

The timestamp for receipt of the message. + * + * @return the requestTimestamp + */ + public String getRequestTimestamp() { + return requestTimestamp; + } + + /** + * Gets the responseTimestamp. + * + *

The timestamp for the system response to the message. + * + * @return the responseTimestamp + */ + public String getResponseTimestamp() { + return responseTimestamp; + } + + /** + * Gets the language. + * + *

The language of the assistant to which the message request was made. + * + * @return the language + */ + public String getLanguage() { + return language; + } + + /** + * Gets the customerId. + * + *

The customer ID specified for the message, if any. + * + * @return the customerId + */ + public String getCustomerId() { + return customerId; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/LogCollection.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/LogCollection.java new file mode 100644 index 00000000000..b331207d4fc --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/LogCollection.java @@ -0,0 +1,45 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.assistant.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + +/** LogCollection. */ +public class LogCollection extends GenericModel { + + protected List logs; + protected LogPagination pagination; + + /** + * Gets the logs. + * + *

An array of objects describing log events. + * + * @return the logs + */ + public List getLogs() { + return logs; + } + + /** + * Gets the pagination. + * + *

The pagination data for the returned objects. + * + * @return the pagination + */ + public LogPagination getPagination() { + return pagination; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/LogPagination.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/LogPagination.java new file mode 100644 index 00000000000..00a9dbcd0ac --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/LogPagination.java @@ -0,0 +1,61 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.assistant.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The pagination data for the returned objects. */ +public class LogPagination extends GenericModel { + + @SerializedName("next_url") + protected String nextUrl; + + protected Long matched; + + @SerializedName("next_cursor") + protected String nextCursor; + + /** + * Gets the nextUrl. + * + *

The URL that will return the next page of results, if any. + * + * @return the nextUrl + */ + public String getNextUrl() { + return nextUrl; + } + + /** + * Gets the matched. + * + *

Reserved for future use. + * + * @return the matched + */ + public Long getMatched() { + return matched; + } + + /** + * Gets the nextCursor. + * + *

A token identifying the next page of results. + * + * @return the nextCursor + */ + public String getNextCursor() { + return nextCursor; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java index bd0a7741b6b..66516baef05 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageContextSkill.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -25,12 +25,12 @@ public class MessageContextSkill extends GenericModel { @SerializedName("user_defined") protected Map userDefined; - protected Map system; + protected MessageContextSkillSystem system; /** Builder. */ public static class Builder { private Map userDefined; - private Map system; + private MessageContextSkillSystem system; private Builder(MessageContextSkill messageContextSkill) { this.userDefined = messageContextSkill.userDefined; @@ -66,7 +66,7 @@ public Builder userDefined(Map userDefined) { * @param system the system * @return the MessageContextSkill builder */ - public Builder system(Map system) { + public Builder system(MessageContextSkillSystem system) { this.system = system; return this; } @@ -104,7 +104,7 @@ public Map userDefined() { * * @return the system */ - public Map system() { + public MessageContextSkillSystem system() { return system; } } diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java index 06ed4b7ace2..6b5c5b6db73 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -102,6 +102,18 @@ public Builder context(MessageContext context) { this.context = context; return this; } + + /** + * Set the messageRequest. + * + * @param messageRequest the messageRequest + * @return the MessageOptions builder + */ + public Builder messageRequest(MessageRequest messageRequest) { + this.input = messageRequest.input(); + this.context = messageRequest.context(); + return this; + } } protected MessageOptions(Builder builder) { diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageRequest.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageRequest.java new file mode 100644 index 00000000000..889e5f618e1 --- /dev/null +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageRequest.java @@ -0,0 +1,108 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.assistant.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** A stateful message request formatted for the Watson Assistant service. */ +public class MessageRequest extends GenericModel { + + protected MessageInput input; + protected MessageContext context; + + /** Builder. */ + public static class Builder { + private MessageInput input; + private MessageContext context; + + private Builder(MessageRequest messageRequest) { + this.input = messageRequest.input; + this.context = messageRequest.context; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a MessageRequest. + * + * @return the messageRequest + */ + public MessageRequest build() { + return new MessageRequest(this); + } + + /** + * Set the input. + * + * @param input the input + * @return the MessageRequest builder + */ + public Builder input(MessageInput input) { + this.input = input; + return this; + } + + /** + * Set the context. + * + * @param context the context + * @return the MessageRequest builder + */ + public Builder context(MessageContext context) { + this.context = context; + return this; + } + } + + protected MessageRequest(Builder builder) { + input = builder.input; + context = builder.context; + } + + /** + * New builder. + * + * @return a MessageRequest builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the input. + * + *

An input object that includes the input text. + * + * @return the input + */ + public MessageInput input() { + return input; + } + + /** + * Gets the 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. + * + * @return the context + */ + public MessageContext context() { + return context; + } +} diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java index 31204c84cf9..fbcbfe3f5b7 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageResponse.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -38,7 +38,7 @@ public MessageOutput getOutput() { * 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. + * the message request. Full context is always included in logs. * * @return the context */ diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java index 797a4a6ebb9..eb0a3bff6bb 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/RuntimeResponseGeneric.java @@ -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. You may obtain a copy of the License at @@ -23,9 +23,6 @@ public class RuntimeResponseGeneric extends GenericModel { /** * The type of response returned by the dialog node. The specified response type must be supported * by the client application or channel. - * - *

**Note:** The **suggestion** response type is part of the disambiguation feature, which is - * only available for Premium users. */ public interface ResponseType { /** text. */ @@ -361,9 +358,6 @@ public Builder newBuilder() { *

The type of response returned by the dialog node. The specified response type must be * supported by the client application or channel. * - *

**Note:** The **suggestion** response type is part of the disambiguation feature, which is - * only available for Premium users. - * * @return the responseType */ public String responseType() { @@ -487,9 +481,6 @@ public String topic() { *

An array of objects describing the possible matching dialog nodes from which the user can * choose. * - *

**Note:** The **suggestions** property is part of the disambiguation feature, which is only - * available for Premium users. - * * @return the suggestions */ public List suggestions() { diff --git a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java index e0637d07092..0f08a44577c 100644 --- a/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java +++ b/assistant/src/main/java/com/ibm/watson/assistant/v2/model/SearchResult.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -33,8 +33,8 @@ public class SearchResult extends GenericModel { * *

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. * * @return the id */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java index 1dc07eb33af..b033eaa1d68 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -134,7 +134,7 @@ public class Discovery extends BaseService { private static final String DEFAULT_SERVICE_NAME = "discovery"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/discovery/api"; + "https://api.us-south.discovery.watson.cloud.ibm.com"; private String versionDate; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java index 894ca91c0b4..7d382c76295 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -39,7 +39,7 @@ public interface CredentialType { /** saml. */ String SAML = "saml"; /** username_password. */ - String USERNAME_PASSWORD = "username_password"; // pragma: whitelist secret + String USERNAME_PASSWORD = "username_password"; /** noauth. */ String NOAUTH = "noauth"; /** basic. */ @@ -141,7 +141,7 @@ private Builder(CredentialDetails credentialDetails) { this.publicKeyId = credentialDetails.publicKeyId; this.privateKey = credentialDetails.privateKey; this.passphrase = credentialDetails.passphrase; - this.password = credentialDetails.password; // pragma: whitelist secret + this.password = credentialDetails.password; this.gatewayId = credentialDetails.gatewayId; this.sourceVersion = credentialDetails.sourceVersion; this.webApplicationUrl = credentialDetails.webApplicationUrl; @@ -291,7 +291,7 @@ public Builder passphrase(String passphrase) { * @return the CredentialDetails builder */ public Builder password(String password) { - this.password = password; // pragma: whitelist secret + this.password = password; return this; } @@ -385,7 +385,7 @@ protected CredentialDetails(Builder builder) { publicKeyId = builder.publicKeyId; privateKey = builder.privateKey; passphrase = builder.passphrase; - password = builder.password; // pragma: whitelist secret + password = builder.password; gatewayId = builder.gatewayId; sourceVersion = builder.sourceVersion; webApplicationUrl = builder.webApplicationUrl; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java index c394a1a2515..a3d8886a0ce 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/Discovery.java @@ -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. You may obtain a copy of the License at @@ -23,38 +23,57 @@ import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; import com.ibm.watson.common.SdkCommon; import com.ibm.watson.discovery.v2.model.AddDocumentOptions; +import com.ibm.watson.discovery.v2.model.CollectionDetails; import com.ibm.watson.discovery.v2.model.Completions; import com.ibm.watson.discovery.v2.model.ComponentSettingsResponse; +import com.ibm.watson.discovery.v2.model.CreateCollectionOptions; +import com.ibm.watson.discovery.v2.model.CreateEnrichmentOptions; +import com.ibm.watson.discovery.v2.model.CreateProjectOptions; import com.ibm.watson.discovery.v2.model.CreateTrainingQueryOptions; +import com.ibm.watson.discovery.v2.model.DeleteCollectionOptions; import com.ibm.watson.discovery.v2.model.DeleteDocumentOptions; import com.ibm.watson.discovery.v2.model.DeleteDocumentResponse; +import com.ibm.watson.discovery.v2.model.DeleteEnrichmentOptions; +import com.ibm.watson.discovery.v2.model.DeleteProjectOptions; import com.ibm.watson.discovery.v2.model.DeleteTrainingQueriesOptions; +import com.ibm.watson.discovery.v2.model.DeleteUserDataOptions; import com.ibm.watson.discovery.v2.model.DocumentAccepted; +import com.ibm.watson.discovery.v2.model.Enrichment; +import com.ibm.watson.discovery.v2.model.Enrichments; import com.ibm.watson.discovery.v2.model.GetAutocompletionOptions; +import com.ibm.watson.discovery.v2.model.GetCollectionOptions; import com.ibm.watson.discovery.v2.model.GetComponentSettingsOptions; +import com.ibm.watson.discovery.v2.model.GetEnrichmentOptions; +import com.ibm.watson.discovery.v2.model.GetProjectOptions; import com.ibm.watson.discovery.v2.model.GetTrainingQueryOptions; import com.ibm.watson.discovery.v2.model.ListCollectionsOptions; import com.ibm.watson.discovery.v2.model.ListCollectionsResponse; +import com.ibm.watson.discovery.v2.model.ListEnrichmentsOptions; import com.ibm.watson.discovery.v2.model.ListFieldsOptions; import com.ibm.watson.discovery.v2.model.ListFieldsResponse; +import com.ibm.watson.discovery.v2.model.ListProjectsOptions; +import com.ibm.watson.discovery.v2.model.ListProjectsResponse; import com.ibm.watson.discovery.v2.model.ListTrainingQueriesOptions; +import com.ibm.watson.discovery.v2.model.ProjectDetails; import com.ibm.watson.discovery.v2.model.QueryNoticesOptions; import com.ibm.watson.discovery.v2.model.QueryNoticesResponse; import com.ibm.watson.discovery.v2.model.QueryOptions; import com.ibm.watson.discovery.v2.model.QueryResponse; import com.ibm.watson.discovery.v2.model.TrainingQuery; import com.ibm.watson.discovery.v2.model.TrainingQuerySet; +import com.ibm.watson.discovery.v2.model.UpdateCollectionOptions; import com.ibm.watson.discovery.v2.model.UpdateDocumentOptions; +import com.ibm.watson.discovery.v2.model.UpdateEnrichmentOptions; +import com.ibm.watson.discovery.v2.model.UpdateProjectOptions; import com.ibm.watson.discovery.v2.model.UpdateTrainingQueryOptions; import java.util.Map; import java.util.Map.Entry; import okhttp3.MultipartBody; /** - * 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 + * 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. * * @version v2 @@ -64,27 +83,26 @@ public class Discovery extends BaseService { private static final String DEFAULT_SERVICE_NAME = "discovery"; + private static final String DEFAULT_SERVICE_URL = "https://api.us-south.discovery.watson.cloud.ibm.com"; + private String versionDate; - /** +/** * Constructs a new `Discovery` client using the DEFAULT_SERVICE_NAME. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. */ public Discovery(String versionDate) { - this( - versionDate, - DEFAULT_SERVICE_NAME, - ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); + this(versionDate, DEFAULT_SERVICE_NAME, ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); } /** - * Constructs a new `Discovery` client with the DEFAULT_SERVICE_NAME and the specified - * Authenticator. + * Constructs a new `Discovery` client with the DEFAULT_SERVICE_NAME + * and the specified Authenticator. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. * @param authenticator the Authenticator instance to be configured for this service */ public Discovery(String versionDate, Authenticator authenticator) { @@ -94,8 +112,8 @@ public Discovery(String versionDate, Authenticator authenticator) { /** * Constructs a new `Discovery` client with the specified serviceName. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. * @param serviceName The name of the service to configure. */ public Discovery(String versionDate, String serviceName) { @@ -103,17 +121,18 @@ public Discovery(String versionDate, String serviceName) { } /** - * Constructs a new `Discovery` client with the specified Authenticator and serviceName. + * Constructs a new `Discovery` client with the specified Authenticator + * and serviceName. * - * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value - * will keep your API calls from failing when the service introduces breaking changes. + * @param versionDate The version date (yyyy-MM-dd) of the REST API to use. Specifying this value will keep your API + * calls from failing when the service introduces breaking changes. * @param serviceName The name of the service to configure. * @param authenticator the Authenticator instance to be configured for this service */ public Discovery(String versionDate, String serviceName, Authenticator authenticator) { super(serviceName, authenticator); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); + setServiceUrl(DEFAULT_SERVICE_URL); + com.ibm.cloud.sdk.core.util.Validator.isTrue((versionDate != null) && !versionDate.isEmpty(), "version cannot be null."); this.versionDate = versionDate; this.configureService(serviceName); } @@ -121,21 +140,17 @@ public Discovery(String versionDate, String serviceName, Authenticator authentic /** * List collections. * - *

Lists existing collections for the specified project. + * Lists existing collections for the specified project. * - * @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the - * call + * @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListCollectionsResponse} */ - public ServiceCall listCollections( - ListCollectionsOptions listCollectionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listCollectionsOptions, "listCollectionsOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections"}; - String[] pathParameters = {listCollectionsOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall listCollections(ListCollectionsOptions listCollectionsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listCollectionsOptions, + "listCollectionsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { listCollectionsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listCollections"); for (Entry header : sdkHeaders.entrySet()) { @@ -144,27 +159,153 @@ public ServiceCall listCollections( builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create a collection. + * + * Create a new collection in the specified project. + * + * @param createCollectionOptions the {@link CreateCollectionOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} + */ + public ServiceCall createCollection(CreateCollectionOptions createCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createCollectionOptions, + "createCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { createCollectionOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createCollection"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createCollectionOptions.name()); + if (createCollectionOptions.description() != null) { + contentJson.addProperty("description", createCollectionOptions.description()); + } + if (createCollectionOptions.language() != null) { + contentJson.addProperty("language", createCollectionOptions.language()); + } + if (createCollectionOptions.enrichments() != null) { + contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createCollectionOptions.enrichments())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get collection. + * + * Get details about the specified collection. + * + * @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} + */ + public ServiceCall getCollection(GetCollectionOptions getCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getCollectionOptions, + "getCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { getCollectionOptions.projectId(), getCollectionOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getCollection"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a collection. + * + * Updates the specified collection's name, description, and enrichments. + * + * @param updateCollectionOptions the {@link UpdateCollectionOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link CollectionDetails} + */ + public ServiceCall updateCollection(UpdateCollectionOptions updateCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateCollectionOptions, + "updateCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { updateCollectionOptions.projectId(), updateCollectionOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateCollection"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (updateCollectionOptions.name() != null) { + contentJson.addProperty("name", updateCollectionOptions.name()); + } + if (updateCollectionOptions.description() != null) { + contentJson.addProperty("description", updateCollectionOptions.description()); + } + if (updateCollectionOptions.enrichments() != null) { + contentJson.add("enrichments", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateCollectionOptions.enrichments())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a collection. + * + * Deletes the specified collection from the project. All documents stored in the specified collection and not shared + * is also deleted. + * + * @param deleteCollectionOptions the {@link DeleteCollectionOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of Void + */ + public ServiceCall deleteCollection(DeleteCollectionOptions deleteCollectionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteCollectionOptions, + "deleteCollectionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections" }; + String[] pathParameters = { deleteCollectionOptions.projectId(), deleteCollectionOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteCollection"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } /** * 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). + * 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). 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. * * @param queryOptions the {@link QueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link QueryResponse} */ public ServiceCall query(QueryOptions queryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, "queryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "query"}; - String[] pathParameters = {queryOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, + "queryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "query" }; + String[] pathParameters = { queryOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "query"); for (Entry header : sdkHeaders.entrySet()) { @@ -173,10 +314,7 @@ public ServiceCall query(QueryOptions queryOptions) { builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (queryOptions.collectionIds() != null) { - contentJson.add( - "collection_ids", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(queryOptions.collectionIds())); + contentJson.add("collection_ids", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.collectionIds())); } if (queryOptions.filter() != null) { contentJson.addProperty("filter", queryOptions.filter()); @@ -194,9 +332,7 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("count", queryOptions.count()); } if (queryOptions.xReturn() != null) { - contentJson.add( - "return", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.xReturn())); + contentJson.add("return", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.xReturn())); } if (queryOptions.offset() != null) { contentJson.addProperty("offset", queryOptions.offset()); @@ -211,58 +347,43 @@ public ServiceCall query(QueryOptions queryOptions) { contentJson.addProperty("spelling_suggestions", queryOptions.spellingSuggestions()); } if (queryOptions.tableResults() != null) { - contentJson.add( - "table_results", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(queryOptions.tableResults())); + contentJson.add("table_results", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.tableResults())); } if (queryOptions.suggestedRefinements() != null) { - contentJson.add( - "suggested_refinements", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(queryOptions.suggestedRefinements())); + contentJson.add("suggested_refinements", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.suggestedRefinements())); } if (queryOptions.passages() != null) { - contentJson.add( - "passages", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.passages())); + contentJson.add("passages", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(queryOptions.passages())); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get Autocomplete Suggestions. * - *

Returns completion query suggestions for the specified prefix. + * Returns completion query suggestions for the specified prefix. * - * @param getAutocompletionOptions the {@link GetAutocompletionOptions} containing the options for - * the call + * @param getAutocompletionOptions the {@link GetAutocompletionOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link Completions} */ - public ServiceCall getAutocompletion( - GetAutocompletionOptions getAutocompletionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getAutocompletionOptions, "getAutocompletionOptions cannot be null"); - String[] pathSegments = {"v2/projects", "autocompletion"}; - String[] pathParameters = {getAutocompletionOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getAutocompletion(GetAutocompletionOptions getAutocompletionOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getAutocompletionOptions, + "getAutocompletionOptions cannot be null"); + String[] pathSegments = { "v2/projects", "autocompletion" }; + String[] pathParameters = { getAutocompletionOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "getAutocompletion"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getAutocompletion"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); builder.query("prefix", getAutocompletionOptions.prefix()); if (getAutocompletionOptions.collectionIds() != null) { - builder.query( - "collection_ids", RequestUtils.join(getAutocompletionOptions.collectionIds(), ",")); + builder.query("collection_ids", RequestUtils.join(getAutocompletionOptions.collectionIds(), ",")); } if (getAutocompletionOptions.field() != null) { builder.query("field", getAutocompletionOptions.field()); @@ -271,28 +392,25 @@ public ServiceCall getAutocompletion( builder.query("count", String.valueOf(getAutocompletionOptions.count())); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Query system notices. * - *

Queries for notices (errors or warnings) that might have been generated by the system. - * Notices are generated when ingesting documents and performing relevance training. + * Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when + * ingesting documents and performing relevance training. * * @param queryNoticesOptions the {@link QueryNoticesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link QueryNoticesResponse} */ public ServiceCall queryNotices(QueryNoticesOptions queryNoticesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - queryNoticesOptions, "queryNoticesOptions cannot be null"); - String[] pathSegments = {"v2/projects", "notices"}; - String[] pathParameters = {queryNoticesOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(queryNoticesOptions, + "queryNoticesOptions cannot be null"); + String[] pathSegments = { "v2/projects", "notices" }; + String[] pathParameters = { queryNoticesOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "queryNotices"); for (Entry header : sdkHeaders.entrySet()) { @@ -315,27 +433,24 @@ public ServiceCall queryNotices(QueryNoticesOptions queryN builder.query("offset", String.valueOf(queryNoticesOptions.offset())); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List fields. * - *

Gets a list of the unique fields (and their types) stored in the the specified collections. + * Gets a list of the unique fields (and their types) stored in the the specified collections. * * @param listFieldsOptions the {@link ListFieldsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ListFieldsResponse} */ public ServiceCall listFields(ListFieldsOptions listFieldsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listFieldsOptions, "listFieldsOptions cannot be null"); - String[] pathSegments = {"v2/projects", "fields"}; - String[] pathParameters = {listFieldsOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(listFieldsOptions, + "listFieldsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "fields" }; + String[] pathParameters = { listFieldsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listFields"); for (Entry header : sdkHeaders.entrySet()) { @@ -346,90 +461,76 @@ public ServiceCall listFields(ListFieldsOptions listFieldsOp builder.query("collection_ids", RequestUtils.join(listFieldsOptions.collectionIds(), ",")); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Configuration settings for components. + * List component settings. * - *

Returns default configuration settings for components. + * Returns default configuration settings for components. * - * @param getComponentSettingsOptions the {@link GetComponentSettingsOptions} containing the - * options for the call + * @param getComponentSettingsOptions the {@link GetComponentSettingsOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link ComponentSettingsResponse} */ - public ServiceCall getComponentSettings( - GetComponentSettingsOptions getComponentSettingsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getComponentSettingsOptions, "getComponentSettingsOptions cannot be null"); - String[] pathSegments = {"v2/projects", "component_settings"}; - String[] pathParameters = {getComponentSettingsOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getComponentSettings(GetComponentSettingsOptions getComponentSettingsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getComponentSettingsOptions, + "getComponentSettingsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "component_settings" }; + String[] pathParameters = { getComponentSettingsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "getComponentSettings"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getComponentSettings"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Add a document. * - *

Add a document to a collection with optional metadata. + * Add a document to a collection with optional metadata. * - *

Returns immediately after the system has accepted the document for processing. + * Returns immediately after the system has accepted the document for processing. * - *

* The user must provide document content, metadata, or both. If the request is missing both - * document content and metadata, it is rejected. + * * The user must provide document content, metadata, or both. If the request is missing both document content and + * metadata, it is rejected. * - *

* The user can set the **Content-Type** parameter on the **file** part to indicate the media - * type of the document. If the **Content-Type** parameter is missing or is one of the generic - * media types (for example, `application/octet-stream`), then the service attempts to - * automatically detect the document's media type. + * * The user can set the **Content-Type** parameter on the **file** part to indicate the media type of the + * document. If the **Content-Type** parameter is missing or is one of the generic media types (for example, + * `application/octet-stream`), then the service attempts to automatically detect the document's media type. * - *

* The following field names are reserved and will be filtered out if present after - * normalization: `id`, `score`, `highlight`, and any field with the prefix of: `_`, `+`, or `-` + * * The following field names are reserved and will be filtered out if present after normalization: `id`, `score`, + * `highlight`, and any field with the prefix of: `_`, `+`, or `-` * - *

* Fields with empty name values after normalization are filtered out before indexing. + * * Fields with empty name values after normalization are filtered out before indexing. * - *

* Fields containing the following characters after normalization are filtered out before - * indexing: `#` and `,` + * * Fields containing the following characters after normalization are filtered out before indexing: `#` and `,` * - *

If the document is uploaded to a collection that has it's data shared with another - * collection, the **X-Watson-Discovery-Force** header must be set to `true`. + * If the document is uploaded to a collection that has it's data shared with another collection, the + * **X-Watson-Discovery-Force** header must be set to `true`. * - *

**Note:** Documents can be added with a specific **document_id** by using the + * **Note:** Documents can be added with a specific **document_id** by using the * **_/v2/projects/{project_id}/collections/{collection_id}/documents** method. * - *

**Note:** This operation only works on collections created to accept direct file uploads. It - * cannot be used to modify a collection that connects to an external source such as Microsoft - * SharePoint. + * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to + * modify a collection that connects to an external source such as Microsoft SharePoint. * * @param addDocumentOptions the {@link AddDocumentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall addDocument(AddDocumentOptions addDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - addDocumentOptions, "addDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); - String[] pathSegments = {"v2/projects", "collections", "documents"}; - String[] pathParameters = {addDocumentOptions.projectId(), addDocumentOptions.collectionId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(addDocumentOptions, + "addDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), "At least one of file or metadata must be supplied."); + String[] pathSegments = { "v2/projects", "collections", "documents" }; + String[] pathParameters = { addDocumentOptions.projectId(), addDocumentOptions.collectionId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "addDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -442,9 +543,7 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (addDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = - RequestUtils.inputStreamBody( - addDocumentOptions.file(), addDocumentOptions.fileContentType()); + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(addDocumentOptions.file(), addDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", addDocumentOptions.filename(), fileBody); } if (addDocumentOptions.metadata() != null) { @@ -452,49 +551,38 @@ public ServiceCall addDocument(AddDocumentOptions addDocumentO } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a document. * - *

Replace an existing document or add a document with a specified **document_id**. Starts - * ingesting a document with optional metadata. + * Replace an existing document or add a document with a specified **document_id**. Starts ingesting a document with + * optional metadata. * - *

If the document is uploaded to a collection that has it's data shared with another - * collection, the **X-Watson-Discovery-Force** header must be set to `true`. + * If the document is uploaded to a collection that has it's data shared with another collection, the + * **X-Watson-Discovery-Force** header must be set to `true`. * - *

**Note:** When uploading a new document with this method it automatically replaces any - * document stored with the same **document_id** if it exists. + * **Note:** When uploading a new document with this method it automatically replaces any document stored with the + * same **document_id** if it exists. * - *

**Note:** This operation only works on collections created to accept direct file uploads. It - * cannot be used to modify a collection that connects to an external source such as Microsoft - * SharePoint. + * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to + * modify a collection that connects to an external source such as Microsoft SharePoint. * - *

**Note:** If an uploaded document is segmented, all segments will be overwritten, even if - * the updated version of the document has fewer segments. + * **Note:** If an uploaded document is segmented, all segments will be overwritten, even if the updated version of + * the document has fewer segments. * - * @param updateDocumentOptions the {@link UpdateDocumentOptions} containing the options for the - * call + * @param updateDocumentOptions the {@link UpdateDocumentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DocumentAccepted} */ public ServiceCall updateDocument(UpdateDocumentOptions updateDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateDocumentOptions, "updateDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); - String[] pathSegments = {"v2/projects", "collections", "documents"}; - String[] pathParameters = { - updateDocumentOptions.projectId(), - updateDocumentOptions.collectionId(), - updateDocumentOptions.documentId() - }; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + com.ibm.cloud.sdk.core.util.Validator.notNull(updateDocumentOptions, + "updateDocumentOptions cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.isTrue((updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), "At least one of file or metadata must be supplied."); + String[] pathSegments = { "v2/projects", "collections", "documents" }; + String[] pathParameters = { updateDocumentOptions.projectId(), updateDocumentOptions.collectionId(), updateDocumentOptions.documentId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -507,9 +595,7 @@ public ServiceCall updateDocument(UpdateDocumentOptions update MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (updateDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = - RequestUtils.inputStreamBody( - updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", updateDocumentOptions.filename(), fileBody); } if (updateDocumentOptions.metadata() != null) { @@ -517,41 +603,31 @@ public ServiceCall updateDocument(UpdateDocumentOptions update } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete a document. * - *

If the given document ID is invalid, or if the document is not found, then the a success - * response is returned (HTTP status code `200`) with the status set to 'deleted'. + * If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP + * status code `200`) with the status set to 'deleted'. * - *

**Note:** This operation only works on collections created to accept direct file uploads. It - * cannot be used to modify a collection that connects to an external source such as Microsoft - * SharePoint. + * **Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to + * modify a collection that connects to an external source such as Microsoft SharePoint. * - *

**Note:** Segments of an uploaded document cannot be deleted individually. Delete all - * segments by deleting using the `parent_document_id` of a segment result. + * **Note:** Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using + * the `parent_document_id` of a segment result. * - * @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the - * call + * @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link DeleteDocumentResponse} */ - public ServiceCall deleteDocument( - DeleteDocumentOptions deleteDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteDocumentOptions, "deleteDocumentOptions cannot be null"); - String[] pathSegments = {"v2/projects", "collections", "documents"}; - String[] pathParameters = { - deleteDocumentOptions.projectId(), - deleteDocumentOptions.collectionId(), - deleteDocumentOptions.documentId() - }; - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall deleteDocument(DeleteDocumentOptions deleteDocumentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteDocumentOptions, + "deleteDocumentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "collections", "documents" }; + String[] pathParameters = { deleteDocumentOptions.projectId(), deleteDocumentOptions.collectionId(), deleteDocumentOptions.documentId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteDocument"); for (Entry header : sdkHeaders.entrySet()) { @@ -562,64 +638,52 @@ public ServiceCall deleteDocument( builder.header("X-Watson-Discovery-Force", deleteDocumentOptions.xWatsonDiscoveryForce()); } ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * List training queries. * - *

List the training queries for the specified project. + * List the training queries for the specified project. * - * @param listTrainingQueriesOptions the {@link ListTrainingQueriesOptions} containing the options - * for the call + * @param listTrainingQueriesOptions the {@link ListTrainingQueriesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuerySet} */ - public ServiceCall listTrainingQueries( - ListTrainingQueriesOptions listTrainingQueriesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listTrainingQueriesOptions, "listTrainingQueriesOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = {listTrainingQueriesOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall listTrainingQueries(ListTrainingQueriesOptions listTrainingQueriesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listTrainingQueriesOptions, + "listTrainingQueriesOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { listTrainingQueriesOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "listTrainingQueries"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listTrainingQueries"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Delete training queries. * - *

Removes all training queries for the specified project. + * Removes all training queries for the specified project. * - * @param deleteTrainingQueriesOptions the {@link DeleteTrainingQueriesOptions} containing the - * options for the call + * @param deleteTrainingQueriesOptions the {@link DeleteTrainingQueriesOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of Void */ - public ServiceCall deleteTrainingQueries( - DeleteTrainingQueriesOptions deleteTrainingQueriesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteTrainingQueriesOptions, "deleteTrainingQueriesOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = {deleteTrainingQueriesOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall deleteTrainingQueries(DeleteTrainingQueriesOptions deleteTrainingQueriesOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteTrainingQueriesOptions, + "deleteTrainingQueriesOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { deleteTrainingQueriesOptions.projectId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "deleteTrainingQueries"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteTrainingQueries"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } @@ -631,66 +695,49 @@ public ServiceCall deleteTrainingQueries( /** * Create training query. * - *

Add a query to the training data for this project. The query can contain a filter and - * natural language query. + * Add a query to the training data for this project. The query can contain a filter and natural language query. * - * @param createTrainingQueryOptions the {@link CreateTrainingQueryOptions} containing the options - * for the call + * @param createTrainingQueryOptions the {@link CreateTrainingQueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall createTrainingQuery( - CreateTrainingQueryOptions createTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createTrainingQueryOptions, "createTrainingQueryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = {createTrainingQueryOptions.projectId()}; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall createTrainingQuery(CreateTrainingQueryOptions createTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createTrainingQueryOptions, + "createTrainingQueryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { createTrainingQueryOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "createTrainingQuery"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.addProperty( - "natural_language_query", createTrainingQueryOptions.naturalLanguageQuery()); - contentJson.add( - "examples", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createTrainingQueryOptions.examples())); + contentJson.addProperty("natural_language_query", createTrainingQueryOptions.naturalLanguageQuery()); + contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createTrainingQueryOptions.examples())); if (createTrainingQueryOptions.filter() != null) { contentJson.addProperty("filter", createTrainingQueryOptions.filter()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Get a training data query. * - *

Get details for a specific training data query, including the query string and all examples. + * Get details for a specific training data query, including the query string and all examples. * - * @param getTrainingQueryOptions the {@link GetTrainingQueryOptions} containing the options for - * the call + * @param getTrainingQueryOptions the {@link GetTrainingQueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall getTrainingQuery( - GetTrainingQueryOptions getTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getTrainingQueryOptions, "getTrainingQueryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = { - getTrainingQueryOptions.projectId(), getTrainingQueryOptions.queryId() - }; - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall getTrainingQuery(GetTrainingQueryOptions getTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getTrainingQueryOptions, + "getTrainingQueryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { getTrainingQueryOptions.projectId(), getTrainingQueryOptions.queryId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { @@ -699,52 +746,363 @@ public ServiceCall getTrainingQuery( builder.header("Accept", "application/json"); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** * Update a training query. * - *

Updates an existing training query and it's examples. + * Updates an existing training query and it's examples. * - * @param updateTrainingQueryOptions the {@link UpdateTrainingQueryOptions} containing the options - * for the call + * @param updateTrainingQueryOptions the {@link UpdateTrainingQueryOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TrainingQuery} */ - public ServiceCall updateTrainingQuery( - UpdateTrainingQueryOptions updateTrainingQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateTrainingQueryOptions, "updateTrainingQueryOptions cannot be null"); - String[] pathSegments = {"v2/projects", "training_data/queries"}; - String[] pathParameters = { - updateTrainingQueryOptions.projectId(), updateTrainingQueryOptions.queryId() - }; - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + public ServiceCall updateTrainingQuery(UpdateTrainingQueryOptions updateTrainingQueryOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateTrainingQueryOptions, + "updateTrainingQueryOptions cannot be null"); + String[] pathSegments = { "v2/projects", "training_data/queries" }; + String[] pathParameters = { updateTrainingQueryOptions.projectId(), updateTrainingQueryOptions.queryId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v2", "updateTrainingQuery"); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateTrainingQuery"); for (Entry header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - contentJson.addProperty( - "natural_language_query", updateTrainingQueryOptions.naturalLanguageQuery()); - contentJson.add( - "examples", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateTrainingQueryOptions.examples())); + contentJson.addProperty("natural_language_query", updateTrainingQueryOptions.naturalLanguageQuery()); + contentJson.add("examples", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateTrainingQueryOptions.examples())); if (updateTrainingQueryOptions.filter() != null) { contentJson.addProperty("filter", updateTrainingQueryOptions.filter()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List Enrichments. + * + * List the enrichments available to this project. + * + * @param listEnrichmentsOptions the {@link ListEnrichmentsOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link Enrichments} + */ + public ServiceCall listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(listEnrichmentsOptions, + "listEnrichmentsOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { listEnrichmentsOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listEnrichments"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Create an enrichment. + * + * Create an enrichment for use with the specified project/. + * + * @param createEnrichmentOptions the {@link CreateEnrichmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link Enrichment} + */ + public ServiceCall createEnrichment(CreateEnrichmentOptions createEnrichmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createEnrichmentOptions, + "createEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { createEnrichmentOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createEnrichment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); + multipartBuilder.setType(MultipartBody.FORM); + multipartBuilder.addFormDataPart("enrichment", createEnrichmentOptions.enrichment().toString()); + if (createEnrichmentOptions.file() != null) { + okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody(createEnrichmentOptions.file(), "application/octet-stream"); + multipartBuilder.addFormDataPart("file", "filename", fileBody); + } + builder.body(multipartBuilder.build()); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get enrichment. + * + * Get details about a specific enrichment. + * + * @param getEnrichmentOptions the {@link GetEnrichmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link Enrichment} + */ + public ServiceCall getEnrichment(GetEnrichmentOptions getEnrichmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getEnrichmentOptions, + "getEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { getEnrichmentOptions.projectId(), getEnrichmentOptions.enrichmentId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getEnrichment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update an enrichment. + * + * Updates an existing enrichment's name and description. + * + * @param updateEnrichmentOptions the {@link UpdateEnrichmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link Enrichment} + */ + public ServiceCall updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateEnrichmentOptions, + "updateEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { updateEnrichmentOptions.projectId(), updateEnrichmentOptions.enrichmentId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateEnrichment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", updateEnrichmentOptions.name()); + if (updateEnrichmentOptions.description() != null) { + contentJson.addProperty("description", updateEnrichmentOptions.description()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete an enrichment. + * + * Deletes an existing enrichment from the specified project. + * + * **Note:** Only enrichments that have been manually created can be deleted. + * + * @param deleteEnrichmentOptions the {@link DeleteEnrichmentOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of Void + */ + public ServiceCall deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteEnrichmentOptions, + "deleteEnrichmentOptions cannot be null"); + String[] pathSegments = { "v2/projects", "enrichments" }; + String[] pathParameters = { deleteEnrichmentOptions.projectId(), deleteEnrichmentOptions.enrichmentId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteEnrichment"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * List projects. + * + * Lists existing projects for this instance. + * + * @param listProjectsOptions the {@link ListProjectsOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link ListProjectsResponse} + */ + public ServiceCall listProjects(ListProjectsOptions listProjectsOptions) { + String[] pathSegments = { "v2/projects" }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "listProjects"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listProjectsOptions != null) { + + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } + + /** + * List projects. + * + * Lists existing projects for this instance. + * + * @return a {@link ServiceCall} with a response type of {@link ListProjectsResponse} + */ + public ServiceCall listProjects() { + return listProjects(null); + } + + /** + * Create a Project. + * + * Create a new project for this instance. + * + * @param createProjectOptions the {@link CreateProjectOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} + */ + public ServiceCall createProject(CreateProjectOptions createProjectOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(createProjectOptions, + "createProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "createProject"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + contentJson.addProperty("name", createProjectOptions.name()); + contentJson.addProperty("type", createProjectOptions.type()); + if (createProjectOptions.defaultQueryParameters() != null) { + contentJson.add("default_query_parameters", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProjectOptions.defaultQueryParameters())); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Get project. + * + * Get details on the specified project. + * + * @param getProjectOptions the {@link GetProjectOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} + */ + public ServiceCall getProject(GetProjectOptions getProjectOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(getProjectOptions, + "getProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + String[] pathParameters = { getProjectOptions.projectId() }; + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "getProject"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Update a project. + * + * Update the specified project's name. + * + * @param updateProjectOptions the {@link UpdateProjectOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of {@link ProjectDetails} + */ + public ServiceCall updateProject(UpdateProjectOptions updateProjectOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(updateProjectOptions, + "updateProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + String[] pathParameters = { updateProjectOptions.projectId() }; + RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateProject"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + final JsonObject contentJson = new JsonObject(); + if (updateProjectOptions.name() != null) { + contentJson.addProperty("name", updateProjectOptions.name()); + } + builder.bodyJson(contentJson); + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * Delete a project. + * + * Deletes the specified project. + * + * **Important:** Deleting a project deletes everything that is part of the specified project, including all + * collections. + * + * @param deleteProjectOptions the {@link DeleteProjectOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of Void + */ + public ServiceCall deleteProject(DeleteProjectOptions deleteProjectOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteProjectOptions, + "deleteProjectOptions cannot be null"); + String[] pathSegments = { "v2/projects" }; + String[] pathParameters = { deleteProjectOptions.projectId() }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteProject"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * 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. + * + * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the call + * @return a {@link ServiceCall} with a response type of Void + */ + public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { + com.ibm.cloud.sdk.core.util.Validator.notNull(deleteUserDataOptions, + "deleteUserDataOptions cannot be null"); + String[] pathSegments = { "v2/user_data" }; + RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + builder.query("version", versionDate); + Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "deleteUserData"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.query("customer_id", deleteUserDataOptions.customerId()); + ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + } diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/AddDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/AddDocumentOptions.java index f0194ccd9fa..ced72b73724 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/AddDocumentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/AddDocumentOptions.java @@ -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. You may obtain a copy of the License at @@ -251,7 +251,9 @@ public String fileContentType() { * Gets the metadata. * *

The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are - * rejected. Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. + * rejected. + * + *

Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. * * @return the metadata */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionDetails.java new file mode 100644 index 00000000000..467981bdd0d --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionDetails.java @@ -0,0 +1,238 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** A collection for storing documents. */ +public class CollectionDetails extends GenericModel { + + @SerializedName("collection_id") + protected String collectionId; + + protected String name; + protected String description; + protected Date created; + protected String language; + protected List enrichments; + + /** Builder. */ + public static class Builder { + private String collectionId; + private String name; + private String description; + private Date created; + private String language; + private List enrichments; + + private Builder(CollectionDetails collectionDetails) { + this.collectionId = collectionDetails.collectionId; + this.name = collectionDetails.name; + this.description = collectionDetails.description; + this.created = collectionDetails.created; + this.language = collectionDetails.language; + this.enrichments = collectionDetails.enrichments; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + */ + public Builder(String name) { + this.name = name; + } + + /** + * Builds a CollectionDetails. + * + * @return the collectionDetails + */ + public CollectionDetails build() { + return new CollectionDetails(this); + } + + /** + * Adds an enrichments to enrichments. + * + * @param enrichments the new enrichments + * @return the CollectionDetails builder + */ + public Builder addEnrichments(CollectionEnrichment enrichments) { + com.ibm.cloud.sdk.core.util.Validator.notNull(enrichments, "enrichments cannot be null"); + if (this.enrichments == null) { + this.enrichments = new ArrayList(); + } + this.enrichments.add(enrichments); + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the CollectionDetails builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CollectionDetails builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CollectionDetails builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the created. + * + * @param created the created + * @return the CollectionDetails builder + */ + public Builder created(Date created) { + this.created = created; + return this; + } + + /** + * Set the language. + * + * @param language the language + * @return the CollectionDetails builder + */ + public Builder language(String language) { + this.language = language; + return this; + } + + /** + * Set the enrichments. Existing enrichments will be replaced. + * + * @param enrichments the enrichments + * @return the CollectionDetails builder + */ + public Builder enrichments(List enrichments) { + this.enrichments = enrichments; + return this; + } + } + + protected CollectionDetails(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); + collectionId = builder.collectionId; + name = builder.name; + description = builder.description; + created = builder.created; + language = builder.language; + enrichments = builder.enrichments; + } + + /** + * New builder. + * + * @return a CollectionDetails builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the collectionId. + * + *

The unique identifier of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } + + /** + * Gets the name. + * + *

The name of the collection. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + *

A description of the collection. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the created. + * + *

The date that the collection was created. + * + * @return the created + */ + public Date created() { + return created; + } + + /** + * Gets the language. + * + *

The language of the collection. + * + * @return the language + */ + public String language() { + return language; + } + + /** + * Gets the enrichments. + * + *

An array of enrichments that are applied to this collection. + * + * @return the enrichments + */ + public List enrichments() { + return enrichments; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionEnrichment.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionEnrichment.java new file mode 100644 index 00000000000..e87336b5db4 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CollectionEnrichment.java @@ -0,0 +1,123 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.ArrayList; +import java.util.List; + +/** An object describing an Enrichment for a collection. */ +public class CollectionEnrichment extends GenericModel { + + @SerializedName("enrichment_id") + protected String enrichmentId; + + protected List fields; + + /** Builder. */ + public static class Builder { + private String enrichmentId; + private List fields; + + private Builder(CollectionEnrichment collectionEnrichment) { + this.enrichmentId = collectionEnrichment.enrichmentId; + this.fields = collectionEnrichment.fields; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a CollectionEnrichment. + * + * @return the collectionEnrichment + */ + public CollectionEnrichment build() { + return new CollectionEnrichment(this); + } + + /** + * Adds an fields to fields. + * + * @param fields the new fields + * @return the CollectionEnrichment builder + */ + public Builder addFields(String fields) { + com.ibm.cloud.sdk.core.util.Validator.notNull(fields, "fields cannot be null"); + if (this.fields == null) { + this.fields = new ArrayList(); + } + this.fields.add(fields); + return this; + } + + /** + * Set the enrichmentId. + * + * @param enrichmentId the enrichmentId + * @return the CollectionEnrichment builder + */ + public Builder enrichmentId(String enrichmentId) { + this.enrichmentId = enrichmentId; + return this; + } + + /** + * Set the fields. Existing fields will be replaced. + * + * @param fields the fields + * @return the CollectionEnrichment builder + */ + public Builder fields(List fields) { + this.fields = fields; + return this; + } + } + + protected CollectionEnrichment(Builder builder) { + enrichmentId = builder.enrichmentId; + fields = builder.fields; + } + + /** + * New builder. + * + * @return a CollectionEnrichment builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the enrichmentId. + * + *

The unique identifier of this enrichment. + * + * @return the enrichmentId + */ + public String enrichmentId() { + return enrichmentId; + } + + /** + * Gets the fields. + * + *

An array of field names that the enrichment is applied to. + * + * @return the fields + */ + public List fields() { + return fields; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ComponentSettingsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ComponentSettingsResponse.java index 19e1d941170..5874bab2374 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ComponentSettingsResponse.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ComponentSettingsResponse.java @@ -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. You may obtain a copy of the License at @@ -16,7 +16,7 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; import java.util.List; -/** A response containing the default component settings. */ +/** The default component settings for this project. */ public class ComponentSettingsResponse extends GenericModel { @SerializedName("fields_shown") diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateCollectionOptions.java new file mode 100644 index 00000000000..85a39ed3907 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateCollectionOptions.java @@ -0,0 +1,226 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.ArrayList; +import java.util.List; + +/** The createCollection options. */ +public class CreateCollectionOptions extends GenericModel { + + protected String projectId; + protected String name; + protected String description; + protected String language; + protected List enrichments; + + /** Builder. */ + public static class Builder { + private String projectId; + private String name; + private String description; + private String language; + private List enrichments; + + private Builder(CreateCollectionOptions createCollectionOptions) { + this.projectId = createCollectionOptions.projectId; + this.name = createCollectionOptions.name; + this.description = createCollectionOptions.description; + this.language = createCollectionOptions.language; + this.enrichments = createCollectionOptions.enrichments; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param name the name + */ + public Builder(String projectId, String name) { + this.projectId = projectId; + this.name = name; + } + + /** + * Builds a CreateCollectionOptions. + * + * @return the createCollectionOptions + */ + public CreateCollectionOptions build() { + return new CreateCollectionOptions(this); + } + + /** + * Adds an enrichments to enrichments. + * + * @param enrichments the new enrichments + * @return the CreateCollectionOptions builder + */ + public Builder addEnrichments(CollectionEnrichment enrichments) { + com.ibm.cloud.sdk.core.util.Validator.notNull(enrichments, "enrichments cannot be null"); + if (this.enrichments == null) { + this.enrichments = new ArrayList(); + } + this.enrichments.add(enrichments); + return this; + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the CreateCollectionOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateCollectionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateCollectionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the language. + * + * @param language the language + * @return the CreateCollectionOptions builder + */ + public Builder language(String language) { + this.language = language; + return this; + } + + /** + * Set the enrichments. Existing enrichments will be replaced. + * + * @param enrichments the enrichments + * @return the CreateCollectionOptions builder + */ + public Builder enrichments(List enrichments) { + this.enrichments = enrichments; + return this; + } + + /** + * Set the collectionDetails. + * + * @param collectionDetails the collectionDetails + * @return the CreateCollectionOptions builder + */ + public Builder collectionDetails(CollectionDetails collectionDetails) { + this.name = collectionDetails.name(); + this.description = collectionDetails.description(); + this.language = collectionDetails.language(); + this.enrichments = collectionDetails.enrichments(); + return this; + } + } + + protected CreateCollectionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); + projectId = builder.projectId; + name = builder.name; + description = builder.description; + language = builder.language; + enrichments = builder.enrichments; + } + + /** + * New builder. + * + * @return a CreateCollectionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the name. + * + *

The name of the collection. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + *

A description of the collection. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the language. + * + *

The language of the collection. + * + * @return the language + */ + public String language() { + return language; + } + + /** + * Gets the enrichments. + * + *

An array of enrichments that are applied to this collection. + * + * @return the enrichments + */ + public List enrichments() { + return enrichments; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichment.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichment.java new file mode 100644 index 00000000000..8284d5b47c8 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichment.java @@ -0,0 +1,169 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Information about a specific enrichment. */ +public class CreateEnrichment extends GenericModel { + + /** The type of this enrichment. */ + public interface Type { + /** dictionary. */ + String DICTIONARY = "dictionary"; + /** regular_expression. */ + String REGULAR_EXPRESSION = "regular_expression"; + /** uima_annotator. */ + String UIMA_ANNOTATOR = "uima_annotator"; + /** rule_based. */ + String RULE_BASED = "rule_based"; + /** watson_knowledge_studio_model. */ + String WATSON_KNOWLEDGE_STUDIO_MODEL = "watson_knowledge_studio_model"; + } + + protected String name; + protected String description; + protected String type; + protected EnrichmentOptions options; + + /** Builder. */ + public static class Builder { + private String name; + private String description; + private String type; + private EnrichmentOptions options; + + private Builder(CreateEnrichment createEnrichment) { + this.name = createEnrichment.name; + this.description = createEnrichment.description; + this.type = createEnrichment.type; + this.options = createEnrichment.options; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a CreateEnrichment. + * + * @return the createEnrichment + */ + public CreateEnrichment build() { + return new CreateEnrichment(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateEnrichment builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the CreateEnrichment builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateEnrichment builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the options. + * + * @param options the options + * @return the CreateEnrichment builder + */ + public Builder options(EnrichmentOptions options) { + this.options = options; + return this; + } + } + + protected CreateEnrichment(Builder builder) { + name = builder.name; + description = builder.description; + type = builder.type; + options = builder.options; + } + + /** + * New builder. + * + * @return a CreateEnrichment builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + *

The human readable name for this enrichment. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + *

The description of this enrichment. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the type. + * + *

The type of this enrichment. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the options. + * + *

A object containing options for the current enrichment. + * + * @return the options + */ + public EnrichmentOptions options() { + return options; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichmentOptions.java new file mode 100644 index 00000000000..bcd5727f4a0 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateEnrichmentOptions.java @@ -0,0 +1,159 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; + +/** The createEnrichment options. */ +public class CreateEnrichmentOptions extends GenericModel { + + protected String projectId; + protected CreateEnrichment enrichment; + protected InputStream file; + + /** Builder. */ + public static class Builder { + private String projectId; + private CreateEnrichment enrichment; + private InputStream file; + + private Builder(CreateEnrichmentOptions createEnrichmentOptions) { + this.projectId = createEnrichmentOptions.projectId; + this.enrichment = createEnrichmentOptions.enrichment; + this.file = createEnrichmentOptions.file; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param enrichment the enrichment + */ + public Builder(String projectId, CreateEnrichment enrichment) { + this.projectId = projectId; + this.enrichment = enrichment; + } + + /** + * Builds a CreateEnrichmentOptions. + * + * @return the createEnrichmentOptions + */ + public CreateEnrichmentOptions build() { + return new CreateEnrichmentOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the CreateEnrichmentOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the enrichment. + * + * @param enrichment the enrichment + * @return the CreateEnrichmentOptions builder + */ + public Builder enrichment(CreateEnrichment enrichment) { + this.enrichment = enrichment; + return this; + } + + /** + * Set the file. + * + * @param file the file + * @return the CreateEnrichmentOptions builder + */ + public Builder file(InputStream file) { + this.file = file; + return this; + } + + /** + * Set the file. + * + * @param file the file + * @return the CreateEnrichmentOptions builder + * @throws FileNotFoundException if the file could not be found + */ + public Builder file(File file) throws FileNotFoundException { + this.file = new FileInputStream(file); + return this; + } + } + + protected CreateEnrichmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.enrichment, "enrichment cannot be null"); + projectId = builder.projectId; + enrichment = builder.enrichment; + file = builder.file; + } + + /** + * New builder. + * + * @return a CreateEnrichmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the enrichment. + * + *

Information about a specific enrichment. + * + * @return the enrichment + */ + public CreateEnrichment enrichment() { + return enrichment; + } + + /** + * Gets the file. + * + *

The enrichment file to upload. + * + * @return the file + */ + public InputStream file() { + return file; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateProjectOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateProjectOptions.java new file mode 100644 index 00000000000..af8456ea53b --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/CreateProjectOptions.java @@ -0,0 +1,154 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The createProject options. */ +public class CreateProjectOptions extends GenericModel { + + /** The project type of this project. */ + public interface Type { + /** document_retrieval. */ + String DOCUMENT_RETRIEVAL = "document_retrieval"; + /** answer_retrieval. */ + String ANSWER_RETRIEVAL = "answer_retrieval"; + /** content_mining. */ + String CONTENT_MINING = "content_mining"; + /** other. */ + String OTHER = "other"; + } + + protected String name; + protected String type; + protected DefaultQueryParams defaultQueryParameters; + + /** Builder. */ + public static class Builder { + private String name; + private String type; + private DefaultQueryParams defaultQueryParameters; + + private Builder(CreateProjectOptions createProjectOptions) { + this.name = createProjectOptions.name; + this.type = createProjectOptions.type; + this.defaultQueryParameters = createProjectOptions.defaultQueryParameters; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param name the name + * @param type the type + */ + public Builder(String name, String type) { + this.name = name; + this.type = type; + } + + /** + * Builds a CreateProjectOptions. + * + * @return the createProjectOptions + */ + public CreateProjectOptions build() { + return new CreateProjectOptions(this); + } + + /** + * Set the name. + * + * @param name the name + * @return the CreateProjectOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the type. + * + * @param type the type + * @return the CreateProjectOptions builder + */ + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * Set the defaultQueryParameters. + * + * @param defaultQueryParameters the defaultQueryParameters + * @return the CreateProjectOptions builder + */ + public Builder defaultQueryParameters(DefaultQueryParams defaultQueryParameters) { + this.defaultQueryParameters = defaultQueryParameters; + return this; + } + } + + protected CreateProjectOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, "type cannot be null"); + name = builder.name; + type = builder.type; + defaultQueryParameters = builder.defaultQueryParameters; + } + + /** + * New builder. + * + * @return a CreateProjectOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the name. + * + *

The human readable name of this project. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the type. + * + *

The project type of this project. + * + * @return the type + */ + public String type() { + return type; + } + + /** + * Gets the defaultQueryParameters. + * + *

Default query parameters for this project. + * + * @return the defaultQueryParameters + */ + public DefaultQueryParams defaultQueryParameters() { + return defaultQueryParameters; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParams.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParams.java new file mode 100644 index 00000000000..68a0104566b --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParams.java @@ -0,0 +1,358 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.ArrayList; +import java.util.List; + +/** Default query parameters for this project. */ +public class DefaultQueryParams extends GenericModel { + + @SerializedName("collection_ids") + protected List collectionIds; + + protected DefaultQueryParamsPassages passages; + + @SerializedName("table_results") + protected DefaultQueryParamsTableResults tableResults; + + protected String aggregation; + + @SerializedName("suggested_refinements") + protected DefaultQueryParamsSuggestedRefinements suggestedRefinements; + + @SerializedName("spelling_suggestions") + protected Boolean spellingSuggestions; + + protected Boolean highlight; + protected Long count; + protected String sort; + + @SerializedName("return") + protected List xReturn; + + /** Builder. */ + public static class Builder { + private List collectionIds; + private DefaultQueryParamsPassages passages; + private DefaultQueryParamsTableResults tableResults; + private String aggregation; + private DefaultQueryParamsSuggestedRefinements suggestedRefinements; + private Boolean spellingSuggestions; + private Boolean highlight; + private Long count; + private String sort; + private List xReturn; + + private Builder(DefaultQueryParams defaultQueryParams) { + this.collectionIds = defaultQueryParams.collectionIds; + this.passages = defaultQueryParams.passages; + this.tableResults = defaultQueryParams.tableResults; + this.aggregation = defaultQueryParams.aggregation; + this.suggestedRefinements = defaultQueryParams.suggestedRefinements; + this.spellingSuggestions = defaultQueryParams.spellingSuggestions; + this.highlight = defaultQueryParams.highlight; + this.count = defaultQueryParams.count; + this.sort = defaultQueryParams.sort; + this.xReturn = defaultQueryParams.xReturn; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a DefaultQueryParams. + * + * @return the defaultQueryParams + */ + public DefaultQueryParams build() { + return new DefaultQueryParams(this); + } + + /** + * Adds an collectionIds to collectionIds. + * + * @param collectionIds the new collectionIds + * @return the DefaultQueryParams builder + */ + public Builder addCollectionIds(String collectionIds) { + com.ibm.cloud.sdk.core.util.Validator.notNull(collectionIds, "collectionIds cannot be null"); + if (this.collectionIds == null) { + this.collectionIds = new ArrayList(); + } + this.collectionIds.add(collectionIds); + return this; + } + + /** + * Adds an xReturn to xReturn. + * + * @param xReturn the new xReturn + * @return the DefaultQueryParams builder + */ + public Builder addXReturn(String xReturn) { + com.ibm.cloud.sdk.core.util.Validator.notNull(xReturn, "xReturn cannot be null"); + if (this.xReturn == null) { + this.xReturn = new ArrayList(); + } + this.xReturn.add(xReturn); + return this; + } + + /** + * Set the collectionIds. Existing collectionIds will be replaced. + * + * @param collectionIds the collectionIds + * @return the DefaultQueryParams builder + */ + public Builder collectionIds(List collectionIds) { + this.collectionIds = collectionIds; + return this; + } + + /** + * Set the passages. + * + * @param passages the passages + * @return the DefaultQueryParams builder + */ + public Builder passages(DefaultQueryParamsPassages passages) { + this.passages = passages; + return this; + } + + /** + * Set the tableResults. + * + * @param tableResults the tableResults + * @return the DefaultQueryParams builder + */ + public Builder tableResults(DefaultQueryParamsTableResults tableResults) { + this.tableResults = tableResults; + return this; + } + + /** + * Set the aggregation. + * + * @param aggregation the aggregation + * @return the DefaultQueryParams builder + */ + public Builder aggregation(String aggregation) { + this.aggregation = aggregation; + return this; + } + + /** + * Set the suggestedRefinements. + * + * @param suggestedRefinements the suggestedRefinements + * @return the DefaultQueryParams builder + */ + public Builder suggestedRefinements( + DefaultQueryParamsSuggestedRefinements suggestedRefinements) { + this.suggestedRefinements = suggestedRefinements; + return this; + } + + /** + * Set the spellingSuggestions. + * + * @param spellingSuggestions the spellingSuggestions + * @return the DefaultQueryParams builder + */ + public Builder spellingSuggestions(Boolean spellingSuggestions) { + this.spellingSuggestions = spellingSuggestions; + return this; + } + + /** + * Set the highlight. + * + * @param highlight the highlight + * @return the DefaultQueryParams builder + */ + public Builder highlight(Boolean highlight) { + this.highlight = highlight; + return this; + } + + /** + * Set the count. + * + * @param count the count + * @return the DefaultQueryParams builder + */ + public Builder count(long count) { + this.count = count; + return this; + } + + /** + * Set the sort. + * + * @param sort the sort + * @return the DefaultQueryParams builder + */ + public Builder sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set the xReturn. Existing xReturn will be replaced. + * + * @param xReturn the xReturn + * @return the DefaultQueryParams builder + */ + public Builder xReturn(List xReturn) { + this.xReturn = xReturn; + return this; + } + } + + protected DefaultQueryParams(Builder builder) { + collectionIds = builder.collectionIds; + passages = builder.passages; + tableResults = builder.tableResults; + aggregation = builder.aggregation; + suggestedRefinements = builder.suggestedRefinements; + spellingSuggestions = builder.spellingSuggestions; + highlight = builder.highlight; + count = builder.count; + sort = builder.sort; + xReturn = builder.xReturn; + } + + /** + * New builder. + * + * @return a DefaultQueryParams builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the collectionIds. + * + *

An array of collection identifiers to query. If empty or omitted all collections in the + * project are queried. + * + * @return the collectionIds + */ + public List collectionIds() { + return collectionIds; + } + + /** + * Gets the passages. + * + *

Default settings configuration for passage search options. + * + * @return the passages + */ + public DefaultQueryParamsPassages passages() { + return passages; + } + + /** + * Gets the tableResults. + * + *

Default project query settings for table results. + * + * @return the tableResults + */ + public DefaultQueryParamsTableResults tableResults() { + return tableResults; + } + + /** + * Gets the aggregation. + * + *

A string representing the default aggregation query for the project. + * + * @return the aggregation + */ + public String aggregation() { + return aggregation; + } + + /** + * Gets the suggestedRefinements. + * + *

Object containing suggested refinement settings. + * + * @return the suggestedRefinements + */ + public DefaultQueryParamsSuggestedRefinements suggestedRefinements() { + return suggestedRefinements; + } + + /** + * Gets the spellingSuggestions. + * + *

When `true`, a spelling suggestions for the query are retuned by default. + * + * @return the spellingSuggestions + */ + public Boolean spellingSuggestions() { + return spellingSuggestions; + } + + /** + * Gets the highlight. + * + *

When `true`, a highlights for the query are retuned by default. + * + * @return the highlight + */ + public Boolean highlight() { + return highlight; + } + + /** + * Gets the count. + * + *

The number of document results returned by default. + * + * @return the count + */ + public Long count() { + return count; + } + + /** + * Gets the sort. + * + *

A comma separated list of document fields to sort results by default. + * + * @return the sort + */ + public String sort() { + return sort; + } + + /** + * Gets the xReturn. + * + *

An array of field names to return in document results if present by default. + * + * @return the xReturn + */ + public List xReturn() { + return xReturn; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsPassages.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsPassages.java new file mode 100644 index 00000000000..225d7af9484 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsPassages.java @@ -0,0 +1,231 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.ArrayList; +import java.util.List; + +/** Default settings configuration for passage search options. */ +public class DefaultQueryParamsPassages extends GenericModel { + + protected Boolean enabled; + protected Long count; + protected List fields; + protected Long characters; + + @SerializedName("per_document") + protected Boolean perDocument; + + @SerializedName("max_per_document") + protected Long maxPerDocument; + + /** Builder. */ + public static class Builder { + private Boolean enabled; + private Long count; + private List fields; + private Long characters; + private Boolean perDocument; + private Long maxPerDocument; + + private Builder(DefaultQueryParamsPassages defaultQueryParamsPassages) { + this.enabled = defaultQueryParamsPassages.enabled; + this.count = defaultQueryParamsPassages.count; + this.fields = defaultQueryParamsPassages.fields; + this.characters = defaultQueryParamsPassages.characters; + this.perDocument = defaultQueryParamsPassages.perDocument; + this.maxPerDocument = defaultQueryParamsPassages.maxPerDocument; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a DefaultQueryParamsPassages. + * + * @return the defaultQueryParamsPassages + */ + public DefaultQueryParamsPassages build() { + return new DefaultQueryParamsPassages(this); + } + + /** + * Adds an fields to fields. + * + * @param fields the new fields + * @return the DefaultQueryParamsPassages builder + */ + public Builder addFields(String fields) { + com.ibm.cloud.sdk.core.util.Validator.notNull(fields, "fields cannot be null"); + if (this.fields == null) { + this.fields = new ArrayList(); + } + this.fields.add(fields); + return this; + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the DefaultQueryParamsPassages builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the count. + * + * @param count the count + * @return the DefaultQueryParamsPassages builder + */ + public Builder count(long count) { + this.count = count; + return this; + } + + /** + * Set the fields. Existing fields will be replaced. + * + * @param fields the fields + * @return the DefaultQueryParamsPassages builder + */ + public Builder fields(List fields) { + this.fields = fields; + return this; + } + + /** + * Set the characters. + * + * @param characters the characters + * @return the DefaultQueryParamsPassages builder + */ + public Builder characters(long characters) { + this.characters = characters; + return this; + } + + /** + * Set the perDocument. + * + * @param perDocument the perDocument + * @return the DefaultQueryParamsPassages builder + */ + public Builder perDocument(Boolean perDocument) { + this.perDocument = perDocument; + return this; + } + + /** + * Set the maxPerDocument. + * + * @param maxPerDocument the maxPerDocument + * @return the DefaultQueryParamsPassages builder + */ + public Builder maxPerDocument(long maxPerDocument) { + this.maxPerDocument = maxPerDocument; + return this; + } + } + + protected DefaultQueryParamsPassages(Builder builder) { + enabled = builder.enabled; + count = builder.count; + fields = builder.fields; + characters = builder.characters; + perDocument = builder.perDocument; + maxPerDocument = builder.maxPerDocument; + } + + /** + * New builder. + * + * @return a DefaultQueryParamsPassages builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the enabled. + * + *

When `true`, a passage search is performed by default. + * + * @return the enabled + */ + public Boolean enabled() { + return enabled; + } + + /** + * Gets the count. + * + *

The number of passages to return. + * + * @return the count + */ + public Long count() { + return count; + } + + /** + * Gets the fields. + * + *

An array of field names to perfom the passage search on. + * + * @return the fields + */ + public List fields() { + return fields; + } + + /** + * Gets the characters. + * + *

The approximate number of characters that each returned passage will contain. + * + * @return the characters + */ + public Long characters() { + return characters; + } + + /** + * Gets the perDocument. + * + *

When `true` the number of passages that can be returned from a single document is restricted + * to the *max_per_document* value. + * + * @return the perDocument + */ + public Boolean perDocument() { + return perDocument; + } + + /** + * Gets the maxPerDocument. + * + *

The default maximum number of passages that can be taken from a single document as the + * result of a passage query. + * + * @return the maxPerDocument + */ + public Long maxPerDocument() { + return maxPerDocument; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsSuggestedRefinements.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsSuggestedRefinements.java new file mode 100644 index 00000000000..ad36a784d52 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsSuggestedRefinements.java @@ -0,0 +1,103 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Object containing suggested refinement settings. */ +public class DefaultQueryParamsSuggestedRefinements extends GenericModel { + + protected Boolean enabled; + protected Long count; + + /** Builder. */ + public static class Builder { + private Boolean enabled; + private Long count; + + private Builder(DefaultQueryParamsSuggestedRefinements defaultQueryParamsSuggestedRefinements) { + this.enabled = defaultQueryParamsSuggestedRefinements.enabled; + this.count = defaultQueryParamsSuggestedRefinements.count; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a DefaultQueryParamsSuggestedRefinements. + * + * @return the defaultQueryParamsSuggestedRefinements + */ + public DefaultQueryParamsSuggestedRefinements build() { + return new DefaultQueryParamsSuggestedRefinements(this); + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the DefaultQueryParamsSuggestedRefinements builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the count. + * + * @param count the count + * @return the DefaultQueryParamsSuggestedRefinements builder + */ + public Builder count(long count) { + this.count = count; + return this; + } + } + + protected DefaultQueryParamsSuggestedRefinements(Builder builder) { + enabled = builder.enabled; + count = builder.count; + } + + /** + * New builder. + * + * @return a DefaultQueryParamsSuggestedRefinements builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the enabled. + * + *

When `true`, a suggested refinements for the query are retuned by default. + * + * @return the enabled + */ + public Boolean enabled() { + return enabled; + } + + /** + * Gets the count. + * + *

The number of suggested refinements to return by default. + * + * @return the count + */ + public Long count() { + return count; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsTableResults.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsTableResults.java new file mode 100644 index 00000000000..bb2c683bd51 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DefaultQueryParamsTableResults.java @@ -0,0 +1,132 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Default project query settings for table results. */ +public class DefaultQueryParamsTableResults extends GenericModel { + + protected Boolean enabled; + protected Long count; + + @SerializedName("per_document") + protected Long perDocument; + + /** Builder. */ + public static class Builder { + private Boolean enabled; + private Long count; + private Long perDocument; + + private Builder(DefaultQueryParamsTableResults defaultQueryParamsTableResults) { + this.enabled = defaultQueryParamsTableResults.enabled; + this.count = defaultQueryParamsTableResults.count; + this.perDocument = defaultQueryParamsTableResults.perDocument; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a DefaultQueryParamsTableResults. + * + * @return the defaultQueryParamsTableResults + */ + public DefaultQueryParamsTableResults build() { + return new DefaultQueryParamsTableResults(this); + } + + /** + * Set the enabled. + * + * @param enabled the enabled + * @return the DefaultQueryParamsTableResults builder + */ + public Builder enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Set the count. + * + * @param count the count + * @return the DefaultQueryParamsTableResults builder + */ + public Builder count(long count) { + this.count = count; + return this; + } + + /** + * Set the perDocument. + * + * @param perDocument the perDocument + * @return the DefaultQueryParamsTableResults builder + */ + public Builder perDocument(long perDocument) { + this.perDocument = perDocument; + return this; + } + } + + protected DefaultQueryParamsTableResults(Builder builder) { + enabled = builder.enabled; + count = builder.count; + perDocument = builder.perDocument; + } + + /** + * New builder. + * + * @return a DefaultQueryParamsTableResults builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the enabled. + * + *

When `true`, a table results for the query are retuned by default. + * + * @return the enabled + */ + public Boolean enabled() { + return enabled; + } + + /** + * Gets the count. + * + *

The number of table results to return by default. + * + * @return the count + */ + public Long count() { + return count; + } + + /** + * Gets the perDocument. + * + *

The number of table results to include in each result document. + * + * @return the perDocument + */ + public Long perDocument() { + return perDocument; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteCollectionOptions.java new file mode 100644 index 00000000000..8fcc8578a3e --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteCollectionOptions.java @@ -0,0 +1,118 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The deleteCollection options. */ +public class DeleteCollectionOptions extends GenericModel { + + protected String projectId; + protected String collectionId; + + /** Builder. */ + public static class Builder { + private String projectId; + private String collectionId; + + private Builder(DeleteCollectionOptions deleteCollectionOptions) { + this.projectId = deleteCollectionOptions.projectId; + this.collectionId = deleteCollectionOptions.collectionId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param collectionId the collectionId + */ + public Builder(String projectId, String collectionId) { + this.projectId = projectId; + this.collectionId = collectionId; + } + + /** + * Builds a DeleteCollectionOptions. + * + * @return the deleteCollectionOptions + */ + public DeleteCollectionOptions build() { + return new DeleteCollectionOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the DeleteCollectionOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the DeleteCollectionOptions builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + } + + protected DeleteCollectionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.collectionId, "collectionId cannot be empty"); + projectId = builder.projectId; + collectionId = builder.collectionId; + } + + /** + * New builder. + * + * @return a DeleteCollectionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the collectionId. + * + *

The ID of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteEnrichmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteEnrichmentOptions.java new file mode 100644 index 00000000000..8f696a62f22 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteEnrichmentOptions.java @@ -0,0 +1,118 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The deleteEnrichment options. */ +public class DeleteEnrichmentOptions extends GenericModel { + + protected String projectId; + protected String enrichmentId; + + /** Builder. */ + public static class Builder { + private String projectId; + private String enrichmentId; + + private Builder(DeleteEnrichmentOptions deleteEnrichmentOptions) { + this.projectId = deleteEnrichmentOptions.projectId; + this.enrichmentId = deleteEnrichmentOptions.enrichmentId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param enrichmentId the enrichmentId + */ + public Builder(String projectId, String enrichmentId) { + this.projectId = projectId; + this.enrichmentId = enrichmentId; + } + + /** + * Builds a DeleteEnrichmentOptions. + * + * @return the deleteEnrichmentOptions + */ + public DeleteEnrichmentOptions build() { + return new DeleteEnrichmentOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the DeleteEnrichmentOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the enrichmentId. + * + * @param enrichmentId the enrichmentId + * @return the DeleteEnrichmentOptions builder + */ + public Builder enrichmentId(String enrichmentId) { + this.enrichmentId = enrichmentId; + return this; + } + } + + protected DeleteEnrichmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.enrichmentId, "enrichmentId cannot be empty"); + projectId = builder.projectId; + enrichmentId = builder.enrichmentId; + } + + /** + * New builder. + * + * @return a DeleteEnrichmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the enrichmentId. + * + *

The ID of the enrichment. + * + * @return the enrichmentId + */ + public String enrichmentId() { + return enrichmentId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteProjectOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteProjectOptions.java new file mode 100644 index 00000000000..8398b3eeac4 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteProjectOptions.java @@ -0,0 +1,88 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The deleteProject options. */ +public class DeleteProjectOptions extends GenericModel { + + protected String projectId; + + /** Builder. */ + public static class Builder { + private String projectId; + + private Builder(DeleteProjectOptions deleteProjectOptions) { + this.projectId = deleteProjectOptions.projectId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + */ + public Builder(String projectId) { + this.projectId = projectId; + } + + /** + * Builds a DeleteProjectOptions. + * + * @return the deleteProjectOptions + */ + public DeleteProjectOptions build() { + return new DeleteProjectOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the DeleteProjectOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + } + + protected DeleteProjectOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + projectId = builder.projectId; + } + + /** + * New builder. + * + * @return a DeleteProjectOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteUserDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteUserDataOptions.java new file mode 100644 index 00000000000..7205da4a880 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/DeleteUserDataOptions.java @@ -0,0 +1,87 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The deleteUserData options. */ +public class DeleteUserDataOptions extends GenericModel { + + protected String customerId; + + /** Builder. */ + public static class Builder { + private String customerId; + + private Builder(DeleteUserDataOptions deleteUserDataOptions) { + this.customerId = deleteUserDataOptions.customerId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param customerId the customerId + */ + public Builder(String customerId) { + this.customerId = customerId; + } + + /** + * Builds a DeleteUserDataOptions. + * + * @return the deleteUserDataOptions + */ + public DeleteUserDataOptions build() { + return new DeleteUserDataOptions(this); + } + + /** + * Set the customerId. + * + * @param customerId the customerId + * @return the DeleteUserDataOptions builder + */ + public Builder customerId(String customerId) { + this.customerId = customerId; + return this; + } + } + + protected DeleteUserDataOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, "customerId cannot be null"); + customerId = builder.customerId; + } + + /** + * New builder. + * + * @return a DeleteUserDataOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the customerId. + * + *

The customer ID for which all data is to be deleted. + * + * @return the customerId + */ + public String customerId() { + return customerId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/Enrichment.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/Enrichment.java new file mode 100644 index 00000000000..dd3052ea9c9 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/Enrichment.java @@ -0,0 +1,103 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Information about a specific enrichment. */ +public class Enrichment extends GenericModel { + + /** The type of this enrichment. */ + public interface Type { + /** part_of_speech. */ + String PART_OF_SPEECH = "part_of_speech"; + /** sentiment. */ + String SENTIMENT = "sentiment"; + /** natural_language_understanding. */ + String NATURAL_LANGUAGE_UNDERSTANDING = "natural_language_understanding"; + /** dictionary. */ + String DICTIONARY = "dictionary"; + /** regular_expression. */ + String REGULAR_EXPRESSION = "regular_expression"; + /** uima_annotator. */ + String UIMA_ANNOTATOR = "uima_annotator"; + /** rule_based. */ + String RULE_BASED = "rule_based"; + /** watson_knowledge_studio_model. */ + String WATSON_KNOWLEDGE_STUDIO_MODEL = "watson_knowledge_studio_model"; + } + + @SerializedName("enrichment_id") + protected String enrichmentId; + + protected String name; + protected String description; + protected String type; + protected EnrichmentOptions options; + + /** + * Gets the enrichmentId. + * + *

The unique identifier of this enrichment. + * + * @return the enrichmentId + */ + public String getEnrichmentId() { + return enrichmentId; + } + + /** + * Gets the name. + * + *

The human readable name for this enrichment. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * + *

The description of this enrichment. + * + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the type. + * + *

The type of this enrichment. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the options. + * + *

A object containing options for the current enrichment. + * + * @return the options + */ + public EnrichmentOptions getOptions() { + return options; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/EnrichmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/EnrichmentOptions.java new file mode 100644 index 00000000000..37c3ec7bb92 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/EnrichmentOptions.java @@ -0,0 +1,183 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.ArrayList; +import java.util.List; + +/** A object containing options for the current enrichment. */ +public class EnrichmentOptions extends GenericModel { + + protected List languages; + + @SerializedName("entity_type") + protected String entityType; + + @SerializedName("regular_expression") + protected String regularExpression; + + @SerializedName("result_field") + protected String resultField; + + /** Builder. */ + public static class Builder { + private List languages; + private String entityType; + private String regularExpression; + private String resultField; + + private Builder(EnrichmentOptions enrichmentOptions) { + this.languages = enrichmentOptions.languages; + this.entityType = enrichmentOptions.entityType; + this.regularExpression = enrichmentOptions.regularExpression; + this.resultField = enrichmentOptions.resultField; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Builds a EnrichmentOptions. + * + * @return the enrichmentOptions + */ + public EnrichmentOptions build() { + return new EnrichmentOptions(this); + } + + /** + * Adds an languages to languages. + * + * @param languages the new languages + * @return the EnrichmentOptions builder + */ + public Builder addLanguages(String languages) { + com.ibm.cloud.sdk.core.util.Validator.notNull(languages, "languages cannot be null"); + if (this.languages == null) { + this.languages = new ArrayList(); + } + this.languages.add(languages); + return this; + } + + /** + * Set the languages. Existing languages will be replaced. + * + * @param languages the languages + * @return the EnrichmentOptions builder + */ + public Builder languages(List languages) { + this.languages = languages; + return this; + } + + /** + * Set the entityType. + * + * @param entityType the entityType + * @return the EnrichmentOptions builder + */ + public Builder entityType(String entityType) { + this.entityType = entityType; + return this; + } + + /** + * Set the regularExpression. + * + * @param regularExpression the regularExpression + * @return the EnrichmentOptions builder + */ + public Builder regularExpression(String regularExpression) { + this.regularExpression = regularExpression; + return this; + } + + /** + * Set the resultField. + * + * @param resultField the resultField + * @return the EnrichmentOptions builder + */ + public Builder resultField(String resultField) { + this.resultField = resultField; + return this; + } + } + + protected EnrichmentOptions(Builder builder) { + languages = builder.languages; + entityType = builder.entityType; + regularExpression = builder.regularExpression; + resultField = builder.resultField; + } + + /** + * New builder. + * + * @return a EnrichmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the languages. + * + *

An array of supported languages for this enrichment. + * + * @return the languages + */ + public List languages() { + return languages; + } + + /** + * Gets the entityType. + * + *

The type of entity. Required when creating `dictionary` and `regular_expression` **type** + * enrichment. Not valid when creating any other type of enrichment. + * + * @return the entityType + */ + public String entityType() { + return entityType; + } + + /** + * Gets the 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. + * + * @return the regularExpression + */ + public String regularExpression() { + return regularExpression; + } + + /** + * Gets the 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. + * + * @return the resultField + */ + public String resultField() { + return resultField; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/Enrichments.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/Enrichments.java new file mode 100644 index 00000000000..6034de81760 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/Enrichments.java @@ -0,0 +1,33 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + +/** An object containing an array of enrichment definitions. */ +public class Enrichments extends GenericModel { + + protected List enrichments; + + /** + * Gets the enrichments. + * + *

An array of enrichment definitions. + * + * @return the enrichments + */ + public List getEnrichments() { + return enrichments; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetCollectionOptions.java new file mode 100644 index 00000000000..36916890396 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetCollectionOptions.java @@ -0,0 +1,118 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The getCollection options. */ +public class GetCollectionOptions extends GenericModel { + + protected String projectId; + protected String collectionId; + + /** Builder. */ + public static class Builder { + private String projectId; + private String collectionId; + + private Builder(GetCollectionOptions getCollectionOptions) { + this.projectId = getCollectionOptions.projectId; + this.collectionId = getCollectionOptions.collectionId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param collectionId the collectionId + */ + public Builder(String projectId, String collectionId) { + this.projectId = projectId; + this.collectionId = collectionId; + } + + /** + * Builds a GetCollectionOptions. + * + * @return the getCollectionOptions + */ + public GetCollectionOptions build() { + return new GetCollectionOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the GetCollectionOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the GetCollectionOptions builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + } + + protected GetCollectionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.collectionId, "collectionId cannot be empty"); + projectId = builder.projectId; + collectionId = builder.collectionId; + } + + /** + * New builder. + * + * @return a GetCollectionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the collectionId. + * + *

The ID of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetEnrichmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetEnrichmentOptions.java new file mode 100644 index 00000000000..0ccdcc08e49 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetEnrichmentOptions.java @@ -0,0 +1,118 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The getEnrichment options. */ +public class GetEnrichmentOptions extends GenericModel { + + protected String projectId; + protected String enrichmentId; + + /** Builder. */ + public static class Builder { + private String projectId; + private String enrichmentId; + + private Builder(GetEnrichmentOptions getEnrichmentOptions) { + this.projectId = getEnrichmentOptions.projectId; + this.enrichmentId = getEnrichmentOptions.enrichmentId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param enrichmentId the enrichmentId + */ + public Builder(String projectId, String enrichmentId) { + this.projectId = projectId; + this.enrichmentId = enrichmentId; + } + + /** + * Builds a GetEnrichmentOptions. + * + * @return the getEnrichmentOptions + */ + public GetEnrichmentOptions build() { + return new GetEnrichmentOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the GetEnrichmentOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the enrichmentId. + * + * @param enrichmentId the enrichmentId + * @return the GetEnrichmentOptions builder + */ + public Builder enrichmentId(String enrichmentId) { + this.enrichmentId = enrichmentId; + return this; + } + } + + protected GetEnrichmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.enrichmentId, "enrichmentId cannot be empty"); + projectId = builder.projectId; + enrichmentId = builder.enrichmentId; + } + + /** + * New builder. + * + * @return a GetEnrichmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the enrichmentId. + * + *

The ID of the enrichment. + * + * @return the enrichmentId + */ + public String enrichmentId() { + return enrichmentId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetProjectOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetProjectOptions.java new file mode 100644 index 00000000000..2c91d440177 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/GetProjectOptions.java @@ -0,0 +1,88 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The getProject options. */ +public class GetProjectOptions extends GenericModel { + + protected String projectId; + + /** Builder. */ + public static class Builder { + private String projectId; + + private Builder(GetProjectOptions getProjectOptions) { + this.projectId = getProjectOptions.projectId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + */ + public Builder(String projectId) { + this.projectId = projectId; + } + + /** + * Builds a GetProjectOptions. + * + * @return the getProjectOptions + */ + public GetProjectOptions build() { + return new GetProjectOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the GetProjectOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + } + + protected GetProjectOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + projectId = builder.projectId; + } + + /** + * New builder. + * + * @return a GetProjectOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListEnrichmentsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListEnrichmentsOptions.java new file mode 100644 index 00000000000..5621e154955 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListEnrichmentsOptions.java @@ -0,0 +1,88 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The listEnrichments options. */ +public class ListEnrichmentsOptions extends GenericModel { + + protected String projectId; + + /** Builder. */ + public static class Builder { + private String projectId; + + private Builder(ListEnrichmentsOptions listEnrichmentsOptions) { + this.projectId = listEnrichmentsOptions.projectId; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + */ + public Builder(String projectId) { + this.projectId = projectId; + } + + /** + * Builds a ListEnrichmentsOptions. + * + * @return the listEnrichmentsOptions + */ + public ListEnrichmentsOptions build() { + return new ListEnrichmentsOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the ListEnrichmentsOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + } + + protected ListEnrichmentsOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + projectId = builder.projectId; + } + + /** + * New builder. + * + * @return a ListEnrichmentsOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListProjectsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListProjectsOptions.java new file mode 100644 index 00000000000..32af19b7089 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListProjectsOptions.java @@ -0,0 +1,18 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The listProjects options. */ +public class ListProjectsOptions extends GenericModel {} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListProjectsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListProjectsResponse.java new file mode 100644 index 00000000000..583a476094e --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ListProjectsResponse.java @@ -0,0 +1,33 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + +/** A list of projects in this instance. */ +public class ListProjectsResponse extends GenericModel { + + protected List projects; + + /** + * Gets the projects. + * + *

An array of project details. + * + * @return the projects + */ + public List getProjects() { + return projects; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectDetails.java new file mode 100644 index 00000000000..7a8fad51e2c --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectDetails.java @@ -0,0 +1,113 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Detailed information about the specified project. */ +public class ProjectDetails extends GenericModel { + + /** The project type of this project. */ + public interface Type { + /** document_retrieval. */ + String DOCUMENT_RETRIEVAL = "document_retrieval"; + /** answer_retrieval. */ + String ANSWER_RETRIEVAL = "answer_retrieval"; + /** content_mining. */ + String CONTENT_MINING = "content_mining"; + /** other. */ + String OTHER = "other"; + } + + @SerializedName("project_id") + protected String projectId; + + protected String name; + protected String type; + + @SerializedName("relevancy_training_status") + protected ProjectListDetailsRelevancyTrainingStatus relevancyTrainingStatus; + + @SerializedName("collection_count") + protected Long collectionCount; + + @SerializedName("default_query_parameters") + protected DefaultQueryParams defaultQueryParameters; + + /** + * Gets the projectId. + * + *

The unique identifier of this project. + * + * @return the projectId + */ + public String getProjectId() { + return projectId; + } + + /** + * Gets the name. + * + *

The human readable name of this project. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the type. + * + *

The project type of this project. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the relevancyTrainingStatus. + * + *

Relevancy training status information for this project. + * + * @return the relevancyTrainingStatus + */ + public ProjectListDetailsRelevancyTrainingStatus getRelevancyTrainingStatus() { + return relevancyTrainingStatus; + } + + /** + * Gets the collectionCount. + * + *

The number of collections configured in this project. + * + * @return the collectionCount + */ + public Long getCollectionCount() { + return collectionCount; + } + + /** + * Gets the defaultQueryParameters. + * + *

Default query parameters for this project. + * + * @return the defaultQueryParameters + */ + public DefaultQueryParams getDefaultQueryParameters() { + return defaultQueryParameters; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectListDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectListDetails.java new file mode 100644 index 00000000000..85e038119ae --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectListDetails.java @@ -0,0 +1,99 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Details about a specific project. */ +public class ProjectListDetails extends GenericModel { + + /** The project type of this project. */ + public interface Type { + /** document_retrieval. */ + String DOCUMENT_RETRIEVAL = "document_retrieval"; + /** answer_retrieval. */ + String ANSWER_RETRIEVAL = "answer_retrieval"; + /** content_mining. */ + String CONTENT_MINING = "content_mining"; + /** other. */ + String OTHER = "other"; + } + + @SerializedName("project_id") + protected String projectId; + + protected String name; + protected String type; + + @SerializedName("relevancy_training_status") + protected ProjectListDetailsRelevancyTrainingStatus relevancyTrainingStatus; + + @SerializedName("collection_count") + protected Long collectionCount; + + /** + * Gets the projectId. + * + *

The unique identifier of this project. + * + * @return the projectId + */ + public String getProjectId() { + return projectId; + } + + /** + * Gets the name. + * + *

The human readable name of this project. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the type. + * + *

The project type of this project. + * + * @return the type + */ + public String getType() { + return type; + } + + /** + * Gets the relevancyTrainingStatus. + * + *

Relevancy training status information for this project. + * + * @return the relevancyTrainingStatus + */ + public ProjectListDetailsRelevancyTrainingStatus getRelevancyTrainingStatus() { + return relevancyTrainingStatus; + } + + /** + * Gets the collectionCount. + * + *

The number of collections configured in this project. + * + * @return the collectionCount + */ + public Long getCollectionCount() { + return collectionCount; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectListDetailsRelevancyTrainingStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectListDetailsRelevancyTrainingStatus.java new file mode 100644 index 00000000000..ae538244d51 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/ProjectListDetailsRelevancyTrainingStatus.java @@ -0,0 +1,142 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Relevancy training status information for this project. */ +public class ProjectListDetailsRelevancyTrainingStatus extends GenericModel { + + @SerializedName("data_updated") + protected String dataUpdated; + + @SerializedName("total_examples") + protected Long totalExamples; + + @SerializedName("sufficient_label_diversity") + protected Boolean sufficientLabelDiversity; + + protected Boolean processing; + + @SerializedName("minimum_examples_added") + protected Boolean minimumExamplesAdded; + + @SerializedName("successfully_trained") + protected String successfullyTrained; + + protected Boolean available; + protected Long notices; + + @SerializedName("minimum_queries_added") + protected Boolean minimumQueriesAdded; + + /** + * Gets the dataUpdated. + * + *

When the training data was updated. + * + * @return the dataUpdated + */ + public String getDataUpdated() { + return dataUpdated; + } + + /** + * Gets the totalExamples. + * + *

The total number of examples. + * + * @return the totalExamples + */ + public Long getTotalExamples() { + return totalExamples; + } + + /** + * Gets the sufficientLabelDiversity. + * + *

When `true`, sufficent label diversity is present to allow training for this project. + * + * @return the sufficientLabelDiversity + */ + public Boolean isSufficientLabelDiversity() { + return sufficientLabelDiversity; + } + + /** + * Gets the processing. + * + *

When `true`, the relevancy training is in processing. + * + * @return the processing + */ + public Boolean isProcessing() { + return processing; + } + + /** + * Gets the minimumExamplesAdded. + * + *

When `true`, the minimum number of examples required to train has been met. + * + * @return the minimumExamplesAdded + */ + public Boolean isMinimumExamplesAdded() { + return minimumExamplesAdded; + } + + /** + * Gets the successfullyTrained. + * + *

The time that the most recent successful training occured. + * + * @return the successfullyTrained + */ + public String getSuccessfullyTrained() { + return successfullyTrained; + } + + /** + * Gets the available. + * + *

When `true`, relevancy training is available when querying collections in the project. + * + * @return the available + */ + public Boolean isAvailable() { + return available; + } + + /** + * Gets the notices. + * + *

The number of notices generated during the relevancy training. + * + * @return the notices + */ + public Long getNotices() { + return notices; + } + + /** + * Gets the minimumQueriesAdded. + * + *

When `true`, the minimum number of queries required to train has been met. + * + * @return the minimumQueriesAdded + */ + public Boolean isMinimumQueriesAdded() { + return minimumQueriesAdded; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryAggregation.java index 972bd34e62c..6a5ab4f1e7f 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryAggregation.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryAggregation.java @@ -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. You may obtain a copy of the License at @@ -34,6 +34,7 @@ public class QueryAggregation extends GenericModel { discriminatorMapping.put("average", QueryCalculationAggregation.class); discriminatorMapping.put("unique_count", QueryCalculationAggregation.class); discriminatorMapping.put("top_hits", QueryTopHitsAggregation.class); + discriminatorMapping.put("group_by", QueryGroupByAggregation.class); } protected String type; diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryGroupByAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryGroupByAggregation.java new file mode 100644 index 00000000000..03f73f9cefa --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryGroupByAggregation.java @@ -0,0 +1,32 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import java.util.List; + +/** Returns the top values for the field specified. */ +public class QueryGroupByAggregation extends QueryAggregation { + + protected List results; + + /** + * Gets the results. + * + *

Array of top values for the field. + * + * @return the results + */ + public List getResults() { + return results; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryGroupByAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryGroupByAggregationResult.java new file mode 100644 index 00000000000..cd02777a573 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryGroupByAggregationResult.java @@ -0,0 +1,105 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + +/** Top value result for the term aggregation. */ +public class QueryGroupByAggregationResult extends GenericModel { + + protected String key; + + @SerializedName("matching_results") + protected Long matchingResults; + + protected Double relevancy; + + @SerializedName("total_matching_documents") + protected Long totalMatchingDocuments; + + @SerializedName("estimated_matching_documents") + protected Long estimatedMatchingDocuments; + + protected List aggregations; + + /** + * Gets the key. + * + *

Value of the field with a non-zero frequency in the document set. + * + * @return the key + */ + public String getKey() { + return key; + } + + /** + * Gets the matchingResults. + * + *

Number of documents containing the 'key'. + * + * @return the matchingResults + */ + public Long getMatchingResults() { + return matchingResults; + } + + /** + * Gets the relevancy. + * + *

The relevancy for this group. + * + * @return the relevancy + */ + public Double getRelevancy() { + return relevancy; + } + + /** + * Gets the totalMatchingDocuments. + * + *

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`. + * + * @return the totalMatchingDocuments + */ + public Long getTotalMatchingDocuments() { + return totalMatchingDocuments; + } + + /** + * Gets the estimatedMatchingDocuments. + * + *

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`. + * + * @return the estimatedMatchingDocuments + */ + public Long getEstimatedMatchingDocuments() { + return estimatedMatchingDocuments; + } + + /** + * Gets the aggregations. + * + *

An array of sub aggregations. + * + * @return the aggregations + */ + public List getAggregations() { + return aggregations; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargePassages.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargePassages.java index 193998b3f44..20664512912 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargePassages.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargePassages.java @@ -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. You may obtain a copy of the License at @@ -211,7 +211,7 @@ public List fields() { * Gets the 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`. + * total is not found. The maximum is `100`. * * @return the count */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargeSuggestedRefinements.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargeSuggestedRefinements.java index b74352e4c07..4bbcb1c2ab6 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargeSuggestedRefinements.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryLargeSuggestedRefinements.java @@ -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. You may obtain a copy of the License at @@ -93,8 +93,7 @@ public Boolean enabled() { /** * Gets the count. * - *

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`. * * @return the count */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryTermAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryTermAggregationResult.java index 515d23fc5b3..a7793635665 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryTermAggregationResult.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryTermAggregationResult.java @@ -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. You may obtain a copy of the License at @@ -24,6 +24,14 @@ public class QueryTermAggregationResult extends GenericModel { @SerializedName("matching_results") protected Long matchingResults; + protected Double relevancy; + + @SerializedName("total_matching_documents") + protected Long totalMatchingDocuments; + + @SerializedName("estimated_matching_documents") + protected Long estimatedMatchingDocuments; + protected List aggregations; /** @@ -48,6 +56,41 @@ public Long getMatchingResults() { return matchingResults; } + /** + * Gets the relevancy. + * + *

The relevancy for this term. + * + * @return the relevancy + */ + public Double getRelevancy() { + return relevancy; + } + + /** + * Gets the totalMatchingDocuments. + * + *

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`. + * + * @return the totalMatchingDocuments + */ + public Long getTotalMatchingDocuments() { + return totalMatchingDocuments; + } + + /** + * Gets the estimatedMatchingDocuments. + * + *

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`. + * + * @return the estimatedMatchingDocuments + */ + public Long getEstimatedMatchingDocuments() { + return estimatedMatchingDocuments; + } + /** * Gets the aggregations. * diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateCollectionOptions.java new file mode 100644 index 00000000000..521c10421e7 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateCollectionOptions.java @@ -0,0 +1,213 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.ArrayList; +import java.util.List; + +/** The updateCollection options. */ +public class UpdateCollectionOptions extends GenericModel { + + protected String projectId; + protected String collectionId; + protected String name; + protected String description; + protected List enrichments; + + /** Builder. */ + public static class Builder { + private String projectId; + private String collectionId; + private String name; + private String description; + private List enrichments; + + private Builder(UpdateCollectionOptions updateCollectionOptions) { + this.projectId = updateCollectionOptions.projectId; + this.collectionId = updateCollectionOptions.collectionId; + this.name = updateCollectionOptions.name; + this.description = updateCollectionOptions.description; + this.enrichments = updateCollectionOptions.enrichments; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param collectionId the collectionId + */ + public Builder(String projectId, String collectionId) { + this.projectId = projectId; + this.collectionId = collectionId; + } + + /** + * Builds a UpdateCollectionOptions. + * + * @return the updateCollectionOptions + */ + public UpdateCollectionOptions build() { + return new UpdateCollectionOptions(this); + } + + /** + * Adds an enrichments to enrichments. + * + * @param enrichments the new enrichments + * @return the UpdateCollectionOptions builder + */ + public Builder addEnrichments(CollectionEnrichment enrichments) { + com.ibm.cloud.sdk.core.util.Validator.notNull(enrichments, "enrichments cannot be null"); + if (this.enrichments == null) { + this.enrichments = new ArrayList(); + } + this.enrichments.add(enrichments); + return this; + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the UpdateCollectionOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the collectionId. + * + * @param collectionId the collectionId + * @return the UpdateCollectionOptions builder + */ + public Builder collectionId(String collectionId) { + this.collectionId = collectionId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateCollectionOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the UpdateCollectionOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + + /** + * Set the enrichments. Existing enrichments will be replaced. + * + * @param enrichments the enrichments + * @return the UpdateCollectionOptions builder + */ + public Builder enrichments(List enrichments) { + this.enrichments = enrichments; + return this; + } + } + + protected UpdateCollectionOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.collectionId, "collectionId cannot be empty"); + projectId = builder.projectId; + collectionId = builder.collectionId; + name = builder.name; + description = builder.description; + enrichments = builder.enrichments; + } + + /** + * New builder. + * + * @return a UpdateCollectionOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the collectionId. + * + *

The ID of the collection. + * + * @return the collectionId + */ + public String collectionId() { + return collectionId; + } + + /** + * Gets the name. + * + *

The name of the collection. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + *

A description of the collection. + * + * @return the description + */ + public String description() { + return description; + } + + /** + * Gets the enrichments. + * + *

An array of enrichments that are applied to this collection. + * + * @return the enrichments + */ + public List enrichments() { + return enrichments; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateDocumentOptions.java index be8764c273c..f245f7c95ff 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateDocumentOptions.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateDocumentOptions.java @@ -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. You may obtain a copy of the License at @@ -281,7 +281,9 @@ public String fileContentType() { * Gets the metadata. * *

The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are - * rejected. Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. + * rejected. + * + *

Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. * * @return the metadata */ diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateEnrichmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateEnrichmentOptions.java new file mode 100644 index 00000000000..1d3c8aa9b39 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateEnrichmentOptions.java @@ -0,0 +1,173 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The updateEnrichment options. */ +public class UpdateEnrichmentOptions extends GenericModel { + + protected String projectId; + protected String enrichmentId; + protected String name; + protected String description; + + /** Builder. */ + public static class Builder { + private String projectId; + private String enrichmentId; + private String name; + private String description; + + private Builder(UpdateEnrichmentOptions updateEnrichmentOptions) { + this.projectId = updateEnrichmentOptions.projectId; + this.enrichmentId = updateEnrichmentOptions.enrichmentId; + this.name = updateEnrichmentOptions.name; + this.description = updateEnrichmentOptions.description; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + * @param enrichmentId the enrichmentId + * @param name the name + */ + public Builder(String projectId, String enrichmentId, String name) { + this.projectId = projectId; + this.enrichmentId = enrichmentId; + this.name = name; + } + + /** + * Builds a UpdateEnrichmentOptions. + * + * @return the updateEnrichmentOptions + */ + public UpdateEnrichmentOptions build() { + return new UpdateEnrichmentOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the UpdateEnrichmentOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the enrichmentId. + * + * @param enrichmentId the enrichmentId + * @return the UpdateEnrichmentOptions builder + */ + public Builder enrichmentId(String enrichmentId) { + this.enrichmentId = enrichmentId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateEnrichmentOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + + /** + * Set the description. + * + * @param description the description + * @return the UpdateEnrichmentOptions builder + */ + public Builder description(String description) { + this.description = description; + return this; + } + } + + protected UpdateEnrichmentOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notEmpty( + builder.enrichmentId, "enrichmentId cannot be empty"); + com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); + projectId = builder.projectId; + enrichmentId = builder.enrichmentId; + name = builder.name; + description = builder.description; + } + + /** + * New builder. + * + * @return a UpdateEnrichmentOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the enrichmentId. + * + *

The ID of the enrichment. + * + * @return the enrichmentId + */ + public String enrichmentId() { + return enrichmentId; + } + + /** + * Gets the name. + * + *

A new name for the enrichment. + * + * @return the name + */ + public String name() { + return name; + } + + /** + * Gets the description. + * + *

A new description for the enrichment. + * + * @return the description + */ + public String description() { + return description; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateProjectOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateProjectOptions.java new file mode 100644 index 00000000000..495198b5631 --- /dev/null +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/model/UpdateProjectOptions.java @@ -0,0 +1,114 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.discovery.v2.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The updateProject options. */ +public class UpdateProjectOptions extends GenericModel { + + protected String projectId; + protected String name; + + /** Builder. */ + public static class Builder { + private String projectId; + private String name; + + private Builder(UpdateProjectOptions updateProjectOptions) { + this.projectId = updateProjectOptions.projectId; + this.name = updateProjectOptions.name; + } + + /** Instantiates a new builder. */ + public Builder() {} + + /** + * Instantiates a new builder with required properties. + * + * @param projectId the projectId + */ + public Builder(String projectId) { + this.projectId = projectId; + } + + /** + * Builds a UpdateProjectOptions. + * + * @return the updateProjectOptions + */ + public UpdateProjectOptions build() { + return new UpdateProjectOptions(this); + } + + /** + * Set the projectId. + * + * @param projectId the projectId + * @return the UpdateProjectOptions builder + */ + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * Set the name. + * + * @param name the name + * @return the UpdateProjectOptions builder + */ + public Builder name(String name) { + this.name = name; + return this; + } + } + + protected UpdateProjectOptions(Builder builder) { + com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.projectId, "projectId cannot be empty"); + projectId = builder.projectId; + name = builder.name; + } + + /** + * New builder. + * + * @return a UpdateProjectOptions builder + */ + public Builder newBuilder() { + return new Builder(this); + } + + /** + * Gets the projectId. + * + *

The ID of the project. This information can be found from the deploy page of the Discovery + * administrative tooling. + * + * @return the projectId + */ + public String projectId() { + return projectId; + } + + /** + * Gets the name. + * + *

The new name to give this project. + * + * @return the name + */ + public String name() { + return name; + } +} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v2/package-info.java b/discovery/src/main/java/com/ibm/watson/discovery/v2/package-info.java index f6e895a1be2..1b392cb7a09 100644 --- a/discovery/src/main/java/com/ibm/watson/discovery/v2/package-info.java +++ b/discovery/src/main/java/com/ibm/watson/discovery/v2/package-info.java @@ -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. You may obtain a copy of the License at @@ -10,5 +10,5 @@ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ -/** IBM Watson Discovery for IBM Cloud Pak for Data v2. */ +/** Discovery v2 v2. */ package com.ibm.watson.discovery.v2; diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java index e33e069fc9f..8d4ca78ac9c 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/LanguageTranslator.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -34,8 +34,10 @@ import com.ibm.watson.language_translator.v3.model.IdentifiableLanguages; import com.ibm.watson.language_translator.v3.model.IdentifiedLanguages; import com.ibm.watson.language_translator.v3.model.IdentifyOptions; +import com.ibm.watson.language_translator.v3.model.Languages; import com.ibm.watson.language_translator.v3.model.ListDocumentsOptions; import com.ibm.watson.language_translator.v3.model.ListIdentifiableLanguagesOptions; +import com.ibm.watson.language_translator.v3.model.ListLanguagesOptions; import com.ibm.watson.language_translator.v3.model.ListModelsOptions; import com.ibm.watson.language_translator.v3.model.TranslateDocumentOptions; import com.ibm.watson.language_translator.v3.model.TranslateOptions; @@ -49,7 +51,7 @@ /** * 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 + * 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. * @@ -61,7 +63,7 @@ public class LanguageTranslator extends BaseService { private static final String DEFAULT_SERVICE_NAME = "language_translator"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/language-translator/api"; + "https://api.us-south.language-translator.watson.cloud.ibm.com"; private String versionDate; @@ -118,12 +120,57 @@ public LanguageTranslator(String versionDate, String serviceName, Authenticator this.configureService(serviceName); } + /** + * 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`). + * + * @param listLanguagesOptions the {@link ListLanguagesOptions} containing the options for the + * call + * @return a {@link ServiceCall} with a response type of {@link Languages} + */ + public ServiceCall listLanguages(ListLanguagesOptions listLanguagesOptions) { + String[] pathSegments = {"v3/languages"}; + RequestBuilder builder = + RequestBuilder.get(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); + builder.query("version", versionDate); + Map sdkHeaders = + SdkCommon.getSdkHeaders("language_translator", "v3", "listLanguages"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listLanguagesOptions != null) {} + + ResponseConverter responseConverter = + ResponseConverterUtils.getValue( + new com.google.gson.reflect.TypeToken() {}.getType()); + return createServiceCall(builder.build(), responseConverter); + } + + /** + * 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`). + * + * @return a {@link ServiceCall} with a response type of {@link Languages} + */ + public ServiceCall listLanguages() { + return listLanguages(null); + } + /** * Translate. * - *

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. + *

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. * * @param translateOptions the {@link TranslateOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TranslationResult} @@ -281,19 +328,59 @@ public ServiceCall listModels() { /** * 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. + *

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"`. * * @param createModelOptions the {@link CreateModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TranslationModel} @@ -375,7 +462,7 @@ public ServiceCall deleteModel(DeleteModelOptions deleteModel * *

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`. + * training has a status of `available`. * * @param getModelOptions the {@link GetModelOptions} containing the options for the call * @return a {@link ServiceCall} with a response type of {@link TranslationModel} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java index ba97113205b..18f4976f7c5 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/CreateModelOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -151,10 +151,10 @@ public Builder newBuilder() { /** * Gets the 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. + *

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. * * @return the baseModelId */ @@ -165,10 +165,15 @@ public String baseModelId() { /** * Gets the 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. + *

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}`.*. * * @return the forcedGlossary */ @@ -179,9 +184,16 @@ public InputStream forcedGlossary() { /** * Gets the 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. + *

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}`.*. * * @return the parallelCorpus */ @@ -193,7 +205,8 @@ public InputStream parallelCorpus() { * Gets the 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. * * @return the name */ diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Language.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Language.java new file mode 100644 index 00000000000..35179eb4c0e --- /dev/null +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Language.java @@ -0,0 +1,147 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.language_translator.v3.model; + +import com.google.gson.annotations.SerializedName; +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** Response payload for languages. */ +public class Language extends GenericModel { + + protected String language; + + @SerializedName("language_name") + protected String languageName; + + @SerializedName("native_language_name") + protected String nativeLanguageName; + + @SerializedName("country_code") + protected String countryCode; + + @SerializedName("words_separated") + protected Boolean wordsSeparated; + + protected String direction; + + @SerializedName("supported_as_source") + protected Boolean supportedAsSource; + + @SerializedName("supported_as_target") + protected Boolean supportedAsTarget; + + protected Boolean identifiable; + + /** + * Gets the language. + * + *

The language code for the language (for example, `af`). + * + * @return the language + */ + public String getLanguage() { + return language; + } + + /** + * Gets the languageName. + * + *

The name of the language in English (for example, `Afrikaans`). + * + * @return the languageName + */ + public String getLanguageName() { + return languageName; + } + + /** + * Gets the nativeLanguageName. + * + *

The native name of the language (for example, `Afrikaans`). + * + * @return the nativeLanguageName + */ + public String getNativeLanguageName() { + return nativeLanguageName; + } + + /** + * Gets the countryCode. + * + *

The country code for the language (for example, `ZA` for South Africa). + * + * @return the countryCode + */ + public String getCountryCode() { + return countryCode; + } + + /** + * Gets the wordsSeparated. + * + *

Indicates whether words of the language are separated by whitespace: `true` if the words are + * separated; `false` otherwise. + * + * @return the wordsSeparated + */ + public Boolean isWordsSeparated() { + return wordsSeparated; + } + + /** + * Gets the direction. + * + *

Indicates the direction of the language: `right_to_left` or `left_to_right`. + * + * @return the direction + */ + public String getDirection() { + return direction; + } + + /** + * Gets the supportedAsSource. + * + *

Indicates whether the language can be used as the source for translation: `true` if the + * language can be used as the source; `false` otherwise. + * + * @return the supportedAsSource + */ + public Boolean isSupportedAsSource() { + return supportedAsSource; + } + + /** + * Gets the supportedAsTarget. + * + *

Indicates whether the language can be used as the target for translation: `true` if the + * language can be used as the target; `false` otherwise. + * + * @return the supportedAsTarget + */ + public Boolean isSupportedAsTarget() { + return supportedAsTarget; + } + + /** + * Gets the identifiable. + * + *

Indicates whether the language supports automatic detection: `true` if the language can be + * detected automatically; `false` otherwise. + * + * @return the identifiable + */ + public Boolean isIdentifiable() { + return identifiable; + } +} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Languages.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Languages.java new file mode 100644 index 00000000000..6ade695c71d --- /dev/null +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/Languages.java @@ -0,0 +1,33 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.language_translator.v3.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; +import java.util.List; + +/** The response type for listing supported languages. */ +public class Languages extends GenericModel { + + protected List languages; + + /** + * Gets the languages. + * + *

An array of supported languages with information about each language. + * + * @return the languages + */ + public List getLanguages() { + return languages; + } +} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java index 72fbe09c02c..7351da5a66a 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListDocumentsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listDocuments options. */ -public class ListDocumentsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListDocumentsOptions listDocumentsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListDocumentsOptions. - * - * @return the listDocumentsOptions - */ - public ListDocumentsOptions build() { - return new ListDocumentsOptions(this); - } - } - - private ListDocumentsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListDocumentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListDocumentsOptions extends GenericModel {} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java index c748206cc00..6135492d374 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListIdentifiableLanguagesOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listIdentifiableLanguages options. */ -public class ListIdentifiableLanguagesOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListIdentifiableLanguagesOptions listIdentifiableLanguagesOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListIdentifiableLanguagesOptions. - * - * @return the listIdentifiableLanguagesOptions - */ - public ListIdentifiableLanguagesOptions build() { - return new ListIdentifiableLanguagesOptions(this); - } - } - - private ListIdentifiableLanguagesOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListIdentifiableLanguagesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListIdentifiableLanguagesOptions extends GenericModel {} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java new file mode 100644 index 00000000000..0ff8689f8bb --- /dev/null +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListLanguagesOptions.java @@ -0,0 +1,18 @@ +/* + * (C) Copyright IBM 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. + */ +package com.ibm.watson.language_translator.v3.model; + +import com.ibm.cloud.sdk.core.service.model.GenericModel; + +/** The listLanguages options. */ +public class ListLanguagesOptions extends GenericModel {} diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java index ab31f9339ac..74a2f4db1d1 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -119,10 +119,10 @@ public String target() { /** * Gets the xDefault. * - *

If the default parameter isn't specified, the service will return all models (default and - * non-default) for each language pair. To return only default models, set this to `true`. To - * return only non-default models, set this to `false`. There is exactly one default model per - * language pair, the IBM provided base model. + *

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. * * @return the xDefault */ diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java index a7d607e1d37..3acf2a3e71a 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateDocumentOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -226,10 +226,10 @@ public String fileContentType() { /** * Gets the 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. + *

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. * * @return the modelId */ @@ -240,7 +240,9 @@ public String modelId() { /** * Gets the source. * - *

Language code that specifies the language of the source document. + *

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. * * @return the source */ diff --git a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java index 7daf739e250..18dc983ec13 100644 --- a/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java +++ b/language-translator/src/main/java/com/ibm/watson/language_translator/v3/model/TranslateOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -139,7 +139,7 @@ public Builder newBuilder() { /** * Gets the text. * - *

Input text in UTF-8 encoding. Multiple entries will result in multiple translations in the + *

Input text in UTF-8 encoding. Multiple entries result in multiple translations in the * response. * * @return the text @@ -151,10 +151,10 @@ public List text() { /** * Gets the 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. + *

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. * * @return the modelId */ @@ -165,7 +165,9 @@ public String modelId() { /** * Gets the source. * - *

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. * * @return the source */ diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java index 130adfcd98f..0ec7ea3c08c 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/NaturalLanguageClassifier.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -50,7 +50,7 @@ public class NaturalLanguageClassifier extends BaseService { private static final String DEFAULT_SERVICE_NAME = "natural_language_classifier"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/natural-language-classifier/api"; + "https://api.us-south.natural-language-classifier.watson.cloud.ibm.com"; /** Constructs a new `NaturalLanguageClassifier` client using the DEFAULT_SERVICE_NAME. */ public NaturalLanguageClassifier() { diff --git a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java index a24aed424d3..48327ae5557 100644 --- a/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java +++ b/natural-language-classifier/src/main/java/com/ibm/watson/natural_language_classifier/v1/model/ListClassifiersOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listClassifiers options. */ -public class ListClassifiersOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListClassifiersOptions listClassifiersOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListClassifiersOptions. - * - * @return the listClassifiersOptions - */ - public ListClassifiersOptions build() { - return new ListClassifiersOptions(this); - } - } - - private ListClassifiersOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListClassifiersOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListClassifiersOptions extends GenericModel {} diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java index 2f9f930438f..3a85a2dc121 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/NaturalLanguageUnderstanding.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -47,10 +47,10 @@ */ public class NaturalLanguageUnderstanding extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "natural_language_understanding"; + private static final String DEFAULT_SERVICE_NAME = "natural-language-understanding"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/natural-language-understanding/api"; + "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com"; private String versionDate; @@ -113,8 +113,7 @@ public NaturalLanguageUnderstanding( * Analyze text. * *

Analyzes text, HTML, or a public webpage for the following features: - Categories - Concepts - * - Emotion - Entities - Keywords - Metadata - Relations - Semantic roles - Sentiment - Syntax - * (Experimental). + * - Emotion - Entities - Keywords - Metadata - Relations - Semantic roles - Sentiment - Syntax. * *

If a language for the input text is not specified with the `language` parameter, the service * [automatically detects the diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java index cabdfd5fce0..90a22300b1b 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/AnalyzeOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -256,10 +256,9 @@ public String url() { /** * Gets the clean. * - *

Set this to `false` to disable webpage cleaning. To learn more about webpage cleaning, see - * the [Analyzing - * webpages](https://cloud.ibm.com/docs/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). * * @return the clean */ @@ -308,10 +307,9 @@ public Boolean returnAnalyzedText() { * Gets the 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). * * @return the language */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java index 19f75c08a0b..d60e82ab479 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -24,13 +24,13 @@ public class CategoriesOptions extends GenericModel { protected Boolean explanation; protected Long limit; - @Deprecated protected String model; + protected String model; /** Builder. */ public static class Builder { private Boolean explanation; private Long limit; - @Deprecated private String model; + private String model; private Builder(CategoriesOptions categoriesOptions) { this.explanation = categoriesOptions.explanation; @@ -77,8 +77,6 @@ public Builder limit(long limit) { * * @param model the model * @return the CategoriesOptions builder - * @deprecated the model parameter is no longer supported by the Natural Language Understanding - * service and will be removed in the next major release */ public Builder model(String model) { this.model = model; @@ -137,8 +135,6 @@ public Long limit() { * categories models will no longer be accessible in Knowledge Studio on 17 December 2019. * * @return the model - * @deprecated the model parameter is no longer supported by the Natural Language Understanding - * service and will be removed in the next major release */ public String model() { return model; diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java index 0f535976d9d..03dee62c9c4 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/CategoriesResult.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -24,10 +24,9 @@ public class CategoriesResult extends GenericModel { /** * Gets the label. * - *

The path to the category through the 5-level taxonomy hierarchy. For the complete list of - * categories, see the [Categories - * hierarchy](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy) - * documentation. + *

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). * * @return the label */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java index e99fe12ba3f..7ff9acf2b6d 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/EntitiesOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,8 +15,8 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * 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, diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java index 18390240d7c..3a7b13f8952 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Features.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -237,8 +237,8 @@ public EmotionOptions emotion() { /** * Gets the entities. * - *

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, @@ -280,8 +280,8 @@ public MetadataOptions metadata() { * Gets the 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 + * 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, diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java index ff111c2f348..0b18313874c 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listModels options. */ -public class ListModelsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListModelsOptions listModelsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListModelsOptions. - * - * @return the listModelsOptions - */ - public ListModelsOptions build() { - return new ListModelsOptions(this); - } - } - - private ListModelsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListModelsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListModelsOptions extends GenericModel {} diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java index 2895610936b..57f8c5cec74 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/MetadataOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -18,34 +18,4 @@ * 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 class MetadataOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(MetadataOptions metadataOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a MetadataOptions. - * - * @return the metadataOptions - */ - public MetadataOptions build() { - return new MetadataOptions(this); - } - } - - private MetadataOptions(Builder builder) {} - - /** - * New builder. - * - * @return a MetadataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class MetadataOptions extends GenericModel {} diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java index 167ab2ca975..f10aaf336fc 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/Model.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -19,6 +19,22 @@ /** Model. */ public class Model extends GenericModel { + /** When the status is `available`, the model is ready to use. */ + public interface Status { + /** starting. */ + String STARTING = "starting"; + /** training. */ + String TRAINING = "training"; + /** deploying. */ + String DEPLOYING = "deploying"; + /** available. */ + String AVAILABLE = "available"; + /** error. */ + String ERROR = "error"; + /** deleted. */ + String DELETED = "deleted"; + } + protected String status; @SerializedName("model_id") @@ -65,7 +81,7 @@ public String getModelId() { /** * Gets the language. * - *

ISO 639-1 code indicating the language of the model. + *

ISO 639-1 code that indicates the language of the model. * * @return the language */ diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java index c674fd647e5..2082b5daff7 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/RelationsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -16,8 +16,8 @@ /** * Recognizes when two entities are related and identifies the type of relation. For example, an - * `awardedTo` relation might connect the entities "Nobel Prize" and "Albert Einstein". See - * [Relation + * `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, diff --git a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java index ebaaf9d0ced..5977a46f317 100644 --- a/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java +++ b/natural-language-understanding/src/main/java/com/ibm/watson/natural_language_understanding/v1/model/TokenResult.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -20,8 +20,8 @@ public class TokenResult extends GenericModel { /** - * The part of speech of the token. For descriptions of the values, see [Universal Dependencies - * POS tags](https://universaldependencies.org/u/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 interface PartOfSpeech { /** ADJ. */ @@ -82,8 +82,8 @@ public String getText() { /** * Gets the partOfSpeech. * - *

The part of speech of the token. For descriptions of the values, see [Universal Dependencies - * POS tags](https://universaldependencies.org/u/pos/). + *

The part of speech of the token. For more information about the values, see [Universal + * Dependencies POS tags](https://universaldependencies.org/u/pos/). * * @return the partOfSpeech */ diff --git a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java index 2d1ffdeaefa..01a2c40bc49 100644 --- a/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java +++ b/personality-insights/src/main/java/com/ibm/watson/personality_insights/v3/PersonalityInsights.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -53,7 +53,7 @@ public class PersonalityInsights extends BaseService { private static final String DEFAULT_SERVICE_NAME = "personality_insights"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/personality-insights/api"; + "https://api.us-south.personality-insights.watson.cloud.ibm.com"; private String versionDate; diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java index cec94a03cf3..60f98381955 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/SpeechToText.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -82,22 +82,17 @@ import com.ibm.watson.speech_to_text.v1.model.UpgradeLanguageModelOptions; import com.ibm.watson.speech_to_text.v1.model.Word; import com.ibm.watson.speech_to_text.v1.model.Words; -import com.ibm.watson.speech_to_text.v1.websocket.RecognizeCallback; -import com.ibm.watson.speech_to_text.v1.websocket.SpeechToTextWebSocketListener; import java.util.Map; import java.util.Map.Entry; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.WebSocket; +import okhttp3.MultipartBody; /** - * 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 languages, the service supports - * two sampling rates, broadband and narrowband. It returns all JSON response content in the UTF-8 - * character set. + * 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) interfaces. It also supports a WebSocket interface that @@ -122,7 +117,7 @@ public class SpeechToText extends BaseService { private static final String DEFAULT_SERVICE_NAME = "speech_to_text"; private static final String DEFAULT_SERVICE_URL = - "https://stream.watsonplatform.net/speech-to-text/api"; + "https://api.us-south.speech-to-text.watson.cloud.ibm.com"; /** Constructs a new `SpeechToText` client using the DEFAULT_SERVICE_NAME. */ public SpeechToText() { @@ -166,7 +161,9 @@ public SpeechToText(String serviceName, Authenticator authenticator) { * 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. + * includes the name of the 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). @@ -195,7 +192,9 @@ public ServiceCall listModels(ListModelsOptions listModelsOptions) * 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. + * includes the name of the 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). @@ -415,67 +414,12 @@ public ServiceCall recognize(RecognizeOptions recogniz return createServiceCall(builder.build(), responseConverter); } - /** - * Sends audio and returns transcription results for recognition requests over a WebSocket - * connection. Requests and responses are enabled over a single TCP connection that abstracts much - * of the complexity of the request to offer efficient implementation, low latency, high - * throughput, and an asynchronous response. By default, only final results are returned for any - * request; to enable interim results, set the interimResults parameter to true. - * - *

The service imposes a data size limit of 100 MB per utterance (per recognition request). You - * can send multiple utterances over a single WebSocket connection. The service automatically - * detects the endianness of the incoming audio and, for audio that includes multiple channels, - * downmixes the audio to one-channel mono during transcoding. (For the audio/l16 format, you can - * specify the endianness.) - * - * @param recognizeOptions the recognize options - * @param callback the {@link RecognizeCallback} instance where results will be sent - * @return the {@link WebSocket} - */ - public WebSocket recognizeUsingWebSocket( - RecognizeOptions recognizeOptions, RecognizeCallback callback) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - recognizeOptions, "recognizeOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(recognizeOptions.audio(), "audio cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); - - HttpUrl.Builder urlBuilder = HttpUrl.parse(getServiceUrl() + "/v1/recognize").newBuilder(); - - if (recognizeOptions.model() != null) { - urlBuilder.addQueryParameter("model", recognizeOptions.model()); - } - if (recognizeOptions.customizationId() != null) { - urlBuilder.addQueryParameter("customization_id", recognizeOptions.customizationId()); - } - if (recognizeOptions.languageCustomizationId() != null) { - urlBuilder.addQueryParameter( - "language_customization_id", recognizeOptions.languageCustomizationId()); - } - if (recognizeOptions.acousticCustomizationId() != null) { - urlBuilder.addQueryParameter( - "acoustic_customization_id", recognizeOptions.acousticCustomizationId()); - } - if (recognizeOptions.baseModelVersion() != null) { - urlBuilder.addQueryParameter("base_model_version", recognizeOptions.baseModelVersion()); - } - - String url = urlBuilder.toString().replace("https://", "wss://"); - Request.Builder builder = new Request.Builder().url(url); - - setAuthentication(builder); - setDefaultHeaders(builder); - - OkHttpClient client = configureHttpClient(); - return client.newWebSocket( - builder.build(), new SpeechToTextWebSocketListener(recognizeOptions, callback)); - } - /** * Register a callback. * *

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 the callback URL. The service passes a random + * requests. The service 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. * @@ -486,9 +430,9 @@ public WebSocket recognizeUsingWebSocket( * *

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 + * the service within five seconds, it does 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 white-listed, the service responds to the initial registration request with response + * 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 @@ -535,7 +479,7 @@ public ServiceCall registerCallback( /** * Unregister a callback. * - *

Unregisters a callback URL that was previously white-listed with a **Register a callback** + *

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. * @@ -1302,7 +1246,12 @@ public ServiceCall addCorpus(AddCorpusOptions addCorpusOptions) { if (addCorpusOptions.allowOverwrite() != null) { builder.query("allow_overwrite", String.valueOf(addCorpusOptions.allowOverwrite())); } - builder.body(RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain")); + MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); + multipartBuilder.setType(MultipartBody.FORM); + okhttp3.RequestBody corpusFileBody = + RequestUtils.inputStreamBody(addCorpusOptions.corpusFile(), "text/plain"); + multipartBuilder.addFormDataPart("corpus_file", "filename", corpusFileBody); + builder.body(multipartBuilder.build()); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } @@ -2404,10 +2353,14 @@ public ServiceCall deleteAudio(DeleteAudioOptions deleteAudioOptions) { * 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. + * 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/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java index 98d61bce423..b5cc8c58088 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CheckJobsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The checkJobs options. */ -public class CheckJobsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(CheckJobsOptions checkJobsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a CheckJobsOptions. - * - * @return the checkJobsOptions - */ - public CheckJobsOptions build() { - return new CheckJobsOptions(this); - } - } - - private CheckJobsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a CheckJobsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class CheckJobsOptions extends GenericModel {} diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java index 6130558ec25..fde9b87e5ec 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/CreateJobOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -34,6 +34,10 @@ public interface Model { String DE_DE_BROADBANDMODEL = "de-DE_BroadbandModel"; /** de-DE_NarrowbandModel. */ String DE_DE_NARROWBANDMODEL = "de-DE_NarrowbandModel"; + /** en-AU_BroadbandModel. */ + String EN_AU_BROADBANDMODEL = "en-AU_BroadbandModel"; + /** en-AU_NarrowbandModel. */ + String EN_AU_NARROWBANDMODEL = "en-AU_NarrowbandModel"; /** en-GB_BroadbandModel. */ String EN_GB_BROADBANDMODEL = "en-GB_BroadbandModel"; /** en-GB_NarrowbandModel. */ @@ -699,7 +703,7 @@ public String model() { * Gets the 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 + * 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. * @@ -987,10 +991,8 @@ public Boolean smartFormatting() { * 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). diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java index 7cf0978ce7c..2700295744c 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/GetModelOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -28,6 +28,10 @@ public interface ModelId { String DE_DE_BROADBANDMODEL = "de-DE_BroadbandModel"; /** de-DE_NarrowbandModel. */ String DE_DE_NARROWBANDMODEL = "de-DE_NarrowbandModel"; + /** en-AU_BroadbandModel. */ + String EN_AU_BROADBANDMODEL = "en-AU_BroadbandModel"; + /** en-AU_NarrowbandModel. */ + String EN_AU_NARROWBANDMODEL = "en-AU_NarrowbandModel"; /** en-GB_BroadbandModel. */ String EN_GB_BROADBANDMODEL = "en-GB_BroadbandModel"; /** en-GB_NarrowbandModel. */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java index 4ad2a5afd9c..eca148e3b03 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListAcousticModelsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -17,6 +17,49 @@ /** The listAcousticModels options. */ public class ListAcousticModelsOptions extends GenericModel { + /** + * The identifier of the language for which custom language or custom acoustic models are to 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. + */ + public interface Language { + /** ar-AR. */ + String AR_AR = "ar-AR"; + /** de-DE. */ + String DE_DE = "de-DE"; + /** en-GB. */ + String EN_GB = "en-GB"; + /** en-US. */ + String EN_US = "en-US"; + /** es-AR. */ + String ES_AR = "es-AR"; + /** es-ES. */ + String ES_ES = "es-ES"; + /** es-CL. */ + String ES_CL = "es-CL"; + /** es-CO. */ + String ES_CO = "es-CO"; + /** es-MX. */ + String ES_MX = "es-MX"; + /** es-PE. */ + String ES_PE = "es-PE"; + /** fr-FR. */ + String FR_FR = "fr-FR"; + /** it-IT. */ + String IT_IT = "it-IT"; + /** ja-JP. */ + String JA_JP = "ja-JP"; + /** ko-KR. */ + String KO_KR = "ko-KR"; + /** nl-NL. */ + String NL_NL = "nl-NL"; + /** pt-BR. */ + String PT_BR = "pt-BR"; + /** zh-CN. */ + String ZH_CN = "zh-CN"; + } + protected String language; /** Builder. */ @@ -68,8 +111,9 @@ public Builder newBuilder() { * Gets the 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. + * 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. * * @return the language */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java index 7a1cf970478..3d1973ebc1e 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListLanguageModelsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -17,6 +17,49 @@ /** The listLanguageModels options. */ public class ListLanguageModelsOptions extends GenericModel { + /** + * The identifier of the language for which custom language or custom acoustic models are to 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. + */ + public interface Language { + /** ar-AR. */ + String AR_AR = "ar-AR"; + /** de-DE. */ + String DE_DE = "de-DE"; + /** en-GB. */ + String EN_GB = "en-GB"; + /** en-US. */ + String EN_US = "en-US"; + /** es-AR. */ + String ES_AR = "es-AR"; + /** es-ES. */ + String ES_ES = "es-ES"; + /** es-CL. */ + String ES_CL = "es-CL"; + /** es-CO. */ + String ES_CO = "es-CO"; + /** es-MX. */ + String ES_MX = "es-MX"; + /** es-PE. */ + String ES_PE = "es-PE"; + /** fr-FR. */ + String FR_FR = "fr-FR"; + /** it-IT. */ + String IT_IT = "it-IT"; + /** ja-JP. */ + String JA_JP = "ja-JP"; + /** ko-KR. */ + String KO_KR = "ko-KR"; + /** nl-NL. */ + String NL_NL = "nl-NL"; + /** pt-BR. */ + String PT_BR = "pt-BR"; + /** zh-CN. */ + String ZH_CN = "zh-CN"; + } + protected String language; /** Builder. */ @@ -68,8 +111,9 @@ public Builder newBuilder() { * Gets the 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. + * 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. * * @return the language */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java index bc8e43bf79d..386903130ba 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/ListModelsOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listModels options. */ -public class ListModelsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListModelsOptions listModelsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListModelsOptions. - * - * @return the listModelsOptions - */ - public ListModelsOptions build() { - return new ListModelsOptions(this); - } - } - - private ListModelsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListModelsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListModelsOptions extends GenericModel {} diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java index 14e0643e78d..141d9727e61 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RecognizeOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -12,7 +12,6 @@ */ package com.ibm.watson.speech_to_text.v1.model; -import com.google.gson.annotations.SerializedName; import com.ibm.cloud.sdk.core.service.model.GenericModel; import java.io.File; import java.io.FileInputStream; @@ -35,6 +34,10 @@ public interface Model { String DE_DE_BROADBANDMODEL = "de-DE_BroadbandModel"; /** de-DE_NarrowbandModel. */ String DE_DE_NARROWBANDMODEL = "de-DE_NarrowbandModel"; + /** en-AU_BroadbandModel. */ + String EN_AU_BROADBANDMODEL = "en-AU_BroadbandModel"; + /** en-AU_NarrowbandModel. */ + String EN_AU_NARROWBANDMODEL = "en-AU_NarrowbandModel"; /** en-GB_BroadbandModel. */ String EN_GB_BROADBANDMODEL = "en-GB_BroadbandModel"; /** en-GB_NarrowbandModel. */ @@ -99,11 +102,8 @@ public interface Model { String ZH_CN_NARROWBANDMODEL = "zh-CN_NarrowbandModel"; } - protected transient InputStream audio; - - @SerializedName("content-type") + protected InputStream audio; protected String contentType; - protected String model; protected String languageCustomizationId; protected String acousticCustomizationId; @@ -123,9 +123,6 @@ public interface Model { protected String grammarName; protected Boolean redaction; protected Boolean audioMetrics; - private Boolean interimResults; - private Boolean processingMetrics; - private Float processingMetricsInterval; protected Double endOfPhraseSilenceTime; protected Boolean splitTranscriptAtPhraseEnd; protected Float speechDetectorSensitivity; @@ -154,9 +151,6 @@ public static class Builder { private String grammarName; private Boolean redaction; private Boolean audioMetrics; - private Boolean interimResults; - private Boolean processingMetrics; - private Float processingMetricsInterval; private Double endOfPhraseSilenceTime; private Boolean splitTranscriptAtPhraseEnd; private Float speechDetectorSensitivity; @@ -184,9 +178,6 @@ private Builder(RecognizeOptions recognizeOptions) { this.grammarName = recognizeOptions.grammarName; this.redaction = recognizeOptions.redaction; this.audioMetrics = recognizeOptions.audioMetrics; - this.interimResults = recognizeOptions.interimResults; - this.processingMetrics = recognizeOptions.processingMetrics; - this.processingMetricsInterval = recognizeOptions.processingMetricsInterval; this.endOfPhraseSilenceTime = recognizeOptions.endOfPhraseSilenceTime; this.splitTranscriptAtPhraseEnd = recognizeOptions.splitTranscriptAtPhraseEnd; this.speechDetectorSensitivity = recognizeOptions.speechDetectorSensitivity; @@ -460,45 +451,6 @@ public Builder audioMetrics(Boolean audioMetrics) { return this; } - /** - * Set the interimResults. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param interimResults the interimResults - * @return the interimResults - */ - public Builder interimResults(Boolean interimResults) { - this.interimResults = interimResults; - return this; - } - - /** - * Set the processingMetrics. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param processingMetrics the processingMetrics - * @return the processingMetrics - */ - public Builder processingMetrics(Boolean processingMetrics) { - this.processingMetrics = processingMetrics; - return this; - } - - /** - * Set the processingMetricsInterval. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @param processingMetricsInterval the processingMetricsInterval - * @return the processingMetricsInterval - */ - public Builder processingMetricsInterval(Float processingMetricsInterval) { - this.processingMetricsInterval = processingMetricsInterval; - return this; - } - /** * Set the endOfPhraseSilenceTime. * @@ -579,9 +531,6 @@ protected RecognizeOptions(Builder builder) { grammarName = builder.grammarName; redaction = builder.redaction; audioMetrics = builder.audioMetrics; - interimResults = builder.interimResults; - processingMetrics = builder.processingMetrics; - processingMetricsInterval = builder.processingMetricsInterval; endOfPhraseSilenceTime = builder.endOfPhraseSilenceTime; splitTranscriptAtPhraseEnd = builder.splitTranscriptAtPhraseEnd; speechDetectorSensitivity = builder.speechDetectorSensitivity; @@ -854,10 +803,8 @@ public Boolean smartFormatting() { * 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). @@ -937,61 +884,6 @@ public Boolean audioMetrics() { return audioMetrics; } - /** - * Gets the interimResults. - * - *

If `true`, the service returns interim results as a stream of `SpeechRecognitionResults` - * objects. By default, the service returns a single `SpeechRecognitionResults` object with final - * results only. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the interimResults - */ - public Boolean interimResults() { - return interimResults; - } - - /** - * Gets the processingMetrics. - * - *

If `true`, requests processing metrics about the service's transcription of the input audio. - * The service returns processing metrics at the interval specified by the - * `processing_metrics_interval` parameter. It also returns processing metrics for transcription - * events, for example, for final and interim results. By default, the service returns no - * processing metrics. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the processingMetrics - */ - public Boolean processingMetrics() { - return processingMetrics; - } - - /** - * Gets the processingMetricsInterval. - * - *

Specifies the interval in real wall-clock seconds at which the service is to return - * processing metrics. The parameter is ignored unless the `processing_metrics` parameter is set - * to `true`. - * - *

The parameter accepts a minimum value of 0.1 seconds. The level of precision is not - * restricted, so you can specify values such as 0.25 and 0.125. - * - *

The service does not impose a maximum value. If you want to receive processing metrics only - * for transcription events instead of at periodic intervals, set the value to a large number. If - * the value is larger than the duration of the audio, the service returns processing metrics only - * for transcription events. - * - *

NOTE: This parameter only works for the `recognizeUsingWebSocket` method. - * - * @return the processingMetricsInterval - */ - public Float processingMetricsInterval() { - return processingMetricsInterval; - } - /** * Gets the endOfPhraseSilenceTime. * diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java index dcdfb77a50b..3613b13c361 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterCallbackOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -93,7 +93,7 @@ public Builder newBuilder() { /** * Gets the callbackUrl. * - *

An HTTP or HTTPS URL to which callback notifications are to be sent. To be white-listed, the + *

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. diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java index 61c3a1c9534..b8875963227 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/RegisterStatus.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -18,8 +18,8 @@ public class RegisterStatus extends GenericModel { /** - * 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. + * The current status of the job: * `created`: The service successfully allowlisted the callback + * URL as a result of the call. * `already created`: The URL was already allowlisted. */ public interface Status { /** created. */ @@ -34,8 +34,8 @@ public interface Status { /** * Gets the status. * - *

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. + *

The current status of the job: * `created`: The service successfully allowlisted the + * callback URL as a result of the call. * `already created`: The URL was already allowlisted. * * @return the status */ diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java index da4516574c9..5ee36370d52 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SpeechRecognitionAlternative.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -21,10 +21,10 @@ public class SpeechRecognitionAlternative extends GenericModel { protected String transcript; protected Double confidence; - protected List timestamps; + protected List timestamps; @SerializedName("word_confidence") - protected List wordConfidence; + protected List wordConfidence; /** * Gets the transcript. @@ -60,7 +60,7 @@ public Double getConfidence() { * * @return the timestamps */ - public List getTimestamps() { + public List getTimestamps() { return timestamps; } @@ -74,7 +74,7 @@ public List getTimestamps() { * * @return the wordConfidence */ - public List getWordConfidence() { + public List getWordConfidence() { return wordConfidence; } } diff --git a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java index eb0e93bb9d7..bcf14ba1ada 100644 --- a/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java +++ b/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/SupportedFeatures.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -41,6 +41,11 @@ public Boolean isCustomLanguageModel() { * *

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. + * * @return the speakerLabels */ public Boolean isSpeakerLabels() { diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java index cdfa92243a9..33601247dac 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/TextToSpeech.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -43,33 +43,28 @@ import com.ibm.watson.text_to_speech.v1.model.VoiceModels; import com.ibm.watson.text_to_speech.v1.model.Voices; import com.ibm.watson.text_to_speech.v1.model.Words; -import com.ibm.watson.text_to_speech.v1.websocket.SynthesizeCallback; -import com.ibm.watson.text_to_speech.v1.websocket.TextToSpeechWebSocketListener; import java.io.InputStream; import java.util.Map; import java.util.Map.Entry; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.WebSocket; /** - * 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. It also supports a WebSocket interface that provides both plain text and SSML - * input, including the SSML <mark> element and word timings. SSML is an XML-based markup - * language that provides text annotation for speech-synthesis applications. + * (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 <mark> element + * and word timings. * - *

The service also offers a customization interface. You can use the interface to define - * sounds-like or phonetic translations for words. A sounds-like translation consists of one or more - * words that, when combined, sound like the word. A phonetic translation is based on the SSML - * phoneme format for representing a word. You can specify a phonetic translation in standard - * International Phonetic Alphabet (IPA) representation or in the proprietary IBM Symbolic Phonetic - * Representation (SPR). The Arabic, Chinese, Dutch, and Korean languages support only IPA. + *

The service offers a customization interface that you can use to define sounds-like or + * phonetic translations for words. A sounds-like translation consists of one or more words that, + * when combined, sound like the word. A phonetic translation is based on the SSML phoneme format + * for representing a word. You can specify a phonetic translation in standard International + * Phonetic Alphabet (IPA) representation or in the proprietary IBM Symbolic Phonetic Representation + * (SPR). The Arabic, Chinese, Dutch, and Korean languages support only IPA. * * @version v1 * @see Text to Speech @@ -79,7 +74,7 @@ public class TextToSpeech extends BaseService { private static final String DEFAULT_SERVICE_NAME = "text_to_speech"; private static final String DEFAULT_SERVICE_URL = - "https://stream.watsonplatform.net/text-to-speech/api"; + "https://api.us-south.text-to-speech.watson.cloud.ibm.com"; /** Constructs a new `TextToSpeech` client using the DEFAULT_SERVICE_NAME. */ public TextToSpeech() { @@ -123,8 +118,9 @@ public TextToSpeech(String serviceName, Authenticator authenticator) { * 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. + * language, gender, and other 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). @@ -153,8 +149,9 @@ public ServiceCall listVoices(ListVoicesOptions listVoicesOptions) { * 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. + * language, gender, and other 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). @@ -287,53 +284,6 @@ public ServiceCall synthesize(SynthesizeOptions synthesizeOptions) return createServiceCall(builder.build(), responseConverter); } - /** - * Synthesize audio. - * - *

Synthesizes text to audio that is spoken in the specified voice. The service bases its - * understanding of the language for the input text on the specified voice. Use a voice that - * matches the language of the input text. - * - *

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for - * the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service - * returns the synthesized audio stream as an array of bytes. - * - *

### Audio formats (accept types) - * - *

For more information about specifying an audio format, including additional details about - * some of the formats, see [Audio - * formats](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-audioFormats#audioFormats). - * - * @param synthesizeOptions the {@link SynthesizeOptions} containing the options for the call - * @param callback the {@link SynthesizeCallback} callback - * @return a {@link WebSocket} instance - */ - public WebSocket synthesizeUsingWebSocket( - SynthesizeOptions synthesizeOptions, SynthesizeCallback callback) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - synthesizeOptions, "synthesizeOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(callback, "callback cannot be null"); - - HttpUrl.Builder urlBuilder = HttpUrl.parse(getServiceUrl() + "/v1/synthesize").newBuilder(); - - if (synthesizeOptions.voice() != null) { - urlBuilder.addQueryParameter("voice", synthesizeOptions.voice()); - } - if (synthesizeOptions.customizationId() != null) { - urlBuilder.addQueryParameter("customization_id", synthesizeOptions.customizationId()); - } - - String url = urlBuilder.toString().replace("https://", "wss://"); - Request.Builder builder = new Request.Builder().url(url); - - setAuthentication(builder); - setDefaultHeaders(builder); - - OkHttpClient client = configureHttpClient(); - return client.newWebSocket( - builder.build(), new TextToSpeechWebSocketListener(synthesizeOptions, callback)); - } - /** * Get pronunciation. * @@ -819,10 +769,12 @@ public ServiceCall deleteWord(DeleteWordOptions deleteWordOptions) { * 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. + * 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. * - *

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/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java index 4223e846edb..825075a9537 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetPronunciationOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -34,6 +34,10 @@ public interface Voice { String DE_DE_DIETERV3VOICE = "de-DE_DieterV3Voice"; /** de-DE_ErikaV3Voice. */ String DE_DE_ERIKAV3VOICE = "de-DE_ErikaV3Voice"; + /** en-GB_CharlotteV3Voice. */ + String EN_GB_CHARLOTTEV3VOICE = "en-GB_CharlotteV3Voice"; + /** en-GB_JamesV3Voice. */ + String EN_GB_JAMESV3VOICE = "en-GB_JamesV3Voice"; /** en-GB_KateVoice. */ String EN_GB_KATEVOICE = "en-GB_KateVoice"; /** en-GB_KateV3Voice. */ @@ -74,6 +78,8 @@ public interface Voice { String ES_US_SOFIAVOICE = "es-US_SofiaVoice"; /** es-US_SofiaV3Voice. */ String ES_US_SOFIAV3VOICE = "es-US_SofiaV3Voice"; + /** fr-FR_NicolasV3Voice. */ + String FR_FR_NICOLASV3VOICE = "fr-FR_NicolasV3Voice"; /** fr-FR_ReneeVoice. */ String FR_FR_RENEEVOICE = "fr-FR_ReneeVoice"; /** fr-FR_ReneeV3Voice. */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java index 12445af84f6..91ee67ed0c1 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/GetVoiceOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -31,6 +31,10 @@ public interface Voice { String DE_DE_DIETERV3VOICE = "de-DE_DieterV3Voice"; /** de-DE_ErikaV3Voice. */ String DE_DE_ERIKAV3VOICE = "de-DE_ErikaV3Voice"; + /** en-GB_CharlotteV3Voice. */ + String EN_GB_CHARLOTTEV3VOICE = "en-GB_CharlotteV3Voice"; + /** en-GB_JamesV3Voice. */ + String EN_GB_JAMESV3VOICE = "en-GB_JamesV3Voice"; /** en-GB_KateVoice. */ String EN_GB_KATEVOICE = "en-GB_KateVoice"; /** en-GB_KateV3Voice. */ @@ -71,6 +75,8 @@ public interface Voice { String ES_US_SOFIAVOICE = "es-US_SofiaVoice"; /** es-US_SofiaV3Voice. */ String ES_US_SOFIAV3VOICE = "es-US_SofiaV3Voice"; + /** fr-FR_NicolasV3Voice. */ + String FR_FR_NICOLASV3VOICE = "fr-FR_NicolasV3Voice"; /** fr-FR_ReneeVoice. */ String FR_FR_RENEEVOICE = "fr-FR_ReneeVoice"; /** fr-FR_ReneeV3Voice. */ diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java index 27518578077..d9a7628c706 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/ListVoicesOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listVoices options. */ -public class ListVoicesOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListVoicesOptions listVoicesOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListVoicesOptions. - * - * @return the listVoicesOptions - */ - public ListVoicesOptions build() { - return new ListVoicesOptions(this); - } - } - - private ListVoicesOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListVoicesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListVoicesOptions extends GenericModel {} diff --git a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java index 358b1dc7e3d..9b7c15f1512 100644 --- a/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java +++ b/text-to-speech/src/main/java/com/ibm/watson/text_to_speech/v1/model/SynthesizeOptions.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -13,7 +13,6 @@ package com.ibm.watson.text_to_speech.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; /** The synthesize options. */ public class SynthesizeOptions extends GenericModel { @@ -32,6 +31,10 @@ public interface Voice { String DE_DE_DIETERV3VOICE = "de-DE_DieterV3Voice"; /** de-DE_ErikaV3Voice. */ String DE_DE_ERIKAV3VOICE = "de-DE_ErikaV3Voice"; + /** en-GB_CharlotteV3Voice. */ + String EN_GB_CHARLOTTEV3VOICE = "en-GB_CharlotteV3Voice"; + /** en-GB_JamesV3Voice. */ + String EN_GB_JAMESV3VOICE = "en-GB_JamesV3Voice"; /** en-GB_KateVoice. */ String EN_GB_KATEVOICE = "en-GB_KateVoice"; /** en-GB_KateV3Voice. */ @@ -72,6 +75,8 @@ public interface Voice { String ES_US_SOFIAVOICE = "es-US_SofiaVoice"; /** es-US_SofiaV3Voice. */ String ES_US_SOFIAV3VOICE = "es-US_SofiaV3Voice"; + /** fr-FR_NicolasV3Voice. */ + String FR_FR_NICOLASV3VOICE = "fr-FR_NicolasV3Voice"; /** fr-FR_ReneeVoice. */ String FR_FR_RENEEVOICE = "fr-FR_ReneeVoice"; /** fr-FR_ReneeV3Voice. */ @@ -108,7 +113,6 @@ public interface Voice { protected String accept; protected String voice; protected String customizationId; - protected List timings; /** Builder. */ public static class Builder { @@ -116,14 +120,12 @@ public static class Builder { private String accept; private String voice; private String customizationId; - private List timings; private Builder(SynthesizeOptions synthesizeOptions) { this.text = synthesizeOptions.text; this.accept = synthesizeOptions.accept; this.voice = synthesizeOptions.voice; this.customizationId = synthesizeOptions.customizationId; - this.timings = synthesizeOptions.timings; } /** Instantiates a new builder. */ @@ -190,17 +192,6 @@ public Builder customizationId(String customizationId) { this.customizationId = customizationId; return this; } - - /** - * Set the timings. - * - * @param timings the timings - * @return the SynthesizeOptions builder - */ - public Builder timings(List timings) { - this.timings = timings; - return this; - } } protected SynthesizeOptions(Builder builder) { @@ -209,7 +200,6 @@ protected SynthesizeOptions(Builder builder) { accept = builder.accept; voice = builder.voice; customizationId = builder.customizationId; - timings = builder.timings; } /** @@ -269,21 +259,4 @@ public String voice() { public String customizationId() { return customizationId; } - - /** - * Gets the timings. - * - *

An array that specifies whether the service is to return word timing information for all - * strings of the input text. Specify `words` as the element of the array to request word timing - * information. The service returns the start and end time of each word of the input. Specify an - * empty array or omit the parameter to receive no word timing information. Not supported for - * Japanese input text. - * - *

NOTE: This parameter only works for the `synthesizeUsingWebSocket` method. - * - * @return the timings - */ - public List getTimings() { - return timings; - } } diff --git a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java index b1243d4d7f9..8b0a744e4eb 100644 --- a/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java +++ b/tone-analyzer/src/main/java/com/ibm/watson/tone_analyzer/v3/ToneAnalyzer.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -49,7 +49,7 @@ public class ToneAnalyzer extends BaseService { private static final String DEFAULT_SERVICE_NAME = "tone_analyzer"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/tone-analyzer/api"; + "https://api.us-south.tone-analyzer.watson.cloud.ibm.com"; private String versionDate; diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java index 4c20feedcf8..cdf493ed924 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v3/VisualRecognition.java @@ -1,5 +1,5 @@ /* - * (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. You may obtain a copy of the License at @@ -47,10 +47,10 @@ */ public class VisualRecognition extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "visual_recognition"; + private static final String DEFAULT_SERVICE_NAME = "watson_vision_combined"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/visual-recognition/api"; + "https://api.us-south.visual-recognition.watson.cloud.ibm.com"; private String versionDate; @@ -154,11 +154,14 @@ public ServiceCall classify(ClassifyOptions classifyOptions) { multipartBuilder.addFormDataPart("threshold", String.valueOf(classifyOptions.threshold())); } if (classifyOptions.owners() != null) { - multipartBuilder.addFormDataPart("owners", RequestUtils.join(classifyOptions.owners(), ",")); + for (String item : classifyOptions.owners()) { + multipartBuilder.addFormDataPart("owners", item); + } } if (classifyOptions.classifierIds() != null) { - multipartBuilder.addFormDataPart( - "classifier_ids", RequestUtils.join(classifyOptions.classifierIds(), ",")); + for (String item : classifyOptions.classifierIds()) { + multipartBuilder.addFormDataPart("classifier_ids", item); + } } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = @@ -221,18 +224,16 @@ public ServiceCall createClassifier(CreateClassifierOptions createCl String partName = String.format("%s_positive_examples", entry.getKey()); okhttp3.RequestBody part = RequestUtils.inputStreamBody(entry.getValue(), "application/octet-stream"); - multipartBuilder.addFormDataPart(partName, entry.getKey() + ".zip", part); + multipartBuilder.addFormDataPart(partName, entry.getKey(), part); } if (createClassifierOptions.negativeExamples() != null) { okhttp3.RequestBody negativeExamplesBody = RequestUtils.inputStreamBody( createClassifierOptions.negativeExamples(), "application/octet-stream"); - String negativeExamplesFilename = createClassifierOptions.negativeExamplesFilename(); - if (!negativeExamplesFilename.contains(".")) { - negativeExamplesFilename += ".zip"; - } multipartBuilder.addFormDataPart( - "negative_examples", negativeExamplesFilename, negativeExamplesBody); + "negative_examples", + createClassifierOptions.negativeExamplesFilename(), + negativeExamplesBody); } builder.body(multipartBuilder.build()); ResponseConverter responseConverter = @@ -315,8 +316,8 @@ public ServiceCall getClassifier(GetClassifierOptions getClassifierO * *

Update a custom classifier by adding new positive or negative classes or by adding new * images to existing classes. You must supply at least one set of positive or negative examples. - * For details, see [Updating custom classifiers] (https://cloud.ibm.com/docs/visual-recognition - * ?topic=visual-recognition-customizing#updating-custom-classifiers). + * For details, see [Updating custom + * classifiers](https://cloud.ibm.com/docs/visual-recognition?topic=visual-recognition-customizing#updating-custom-classifiers). * *

Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image file names, * and classifier and class names). The service assumes UTF-8 encoding if it encounters non-ASCII diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java index 9d79ca7d0cd..6e51cb6c7f4 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/VisualRecognition.java @@ -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. You may obtain a copy of the License at @@ -64,16 +64,16 @@ * detects objects based on a set of images with training data. * * @version v4 - * @see Visual + * @see Visual * Recognition */ public class VisualRecognition extends BaseService { - private static final String DEFAULT_SERVICE_NAME = "visual_recognition"; + private static final String DEFAULT_SERVICE_NAME = "watson_vision_combined"; private static final String DEFAULT_SERVICE_URL = - "https://gateway.watsonplatform.net/visual-recognition/api"; + "https://api.us-south.visual-recognition.watson.cloud.ibm.com"; private String versionDate; @@ -157,10 +157,12 @@ public ServiceCall analyze(AnalyzeOptions analyzeOptions) { builder.header("Accept", "application/json"); MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); - multipartBuilder.addFormDataPart( - "collection_ids", RequestUtils.join(analyzeOptions.collectionIds(), ",")); - multipartBuilder.addFormDataPart("features", RequestUtils.join(analyzeOptions.features(), ",")); - + for (String item : analyzeOptions.collectionIds()) { + multipartBuilder.addFormDataPart("collection_ids", item); + } + for (String item : analyzeOptions.features()) { + multipartBuilder.addFormDataPart("features", item); + } if (analyzeOptions.imagesFile() != null) { for (FileWithMetadata item : analyzeOptions.imagesFile()) { okhttp3.RequestBody itemBody = @@ -212,13 +214,11 @@ public ServiceCall createCollection(CreateCollectionOptions createCo } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); - if (createCollectionOptions != null) { - if (createCollectionOptions.name() != null) { - contentJson.addProperty("name", createCollectionOptions.name()); - } - if (createCollectionOptions.description() != null) { - contentJson.addProperty("description", createCollectionOptions.description()); - } + if (createCollectionOptions.name() != null) { + contentJson.addProperty("name", createCollectionOptions.name()); + } + if (createCollectionOptions.description() != null) { + contentJson.addProperty("description", createCollectionOptions.description()); } builder.bodyJson(contentJson); ResponseConverter responseConverter = diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ImageDetails.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ImageDetails.java index 60ba72fcb8e..a4659812e98 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ImageDetails.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ImageDetails.java @@ -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. You may obtain a copy of the License at @@ -90,6 +90,8 @@ public ImageDimensions getDimensions() { /** * Gets the errors. * + *

Details about the errors. + * * @return the errors */ public List getErrors() { diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java index bd1c284500c..5026a11d24f 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/ListCollectionsOptions.java @@ -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. You may obtain a copy of the License at @@ -15,34 +15,4 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** The listCollections options. */ -public class ListCollectionsOptions extends GenericModel { - - /** Builder. */ - public static class Builder { - - private Builder(ListCollectionsOptions listCollectionsOptions) {} - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListCollectionsOptions. - * - * @return the listCollectionsOptions - */ - public ListCollectionsOptions build() { - return new ListCollectionsOptions(this); - } - } - - private ListCollectionsOptions(Builder builder) {} - - /** - * New builder. - * - * @return a ListCollectionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } -} +public class ListCollectionsOptions extends GenericModel {} diff --git a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java index ef2ec2f19c5..d840ab66ddc 100644 --- a/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java +++ b/visual-recognition/src/main/java/com/ibm/watson/visual_recognition/v4/model/UpdateObjectMetadata.java @@ -37,11 +37,9 @@ public Builder() {} * Instantiates a new builder with required properties. * * @param object the object - * @param count the count */ - public Builder(String object, Long count) { + public Builder(String object) { this.object = object; - this.count = count; } /** @@ -78,7 +76,6 @@ public Builder count(long count) { protected UpdateObjectMetadata(Builder builder) { com.ibm.cloud.sdk.core.util.Validator.notNull(builder.object, "object cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.count, "count cannot be null"); object = builder.object; count = builder.count; }