|
37 | 37 | import com.ibm.watson.developer_cloud.assistant.v1.model.Entity; |
38 | 38 | import com.ibm.watson.developer_cloud.assistant.v1.model.EntityCollection; |
39 | 39 | import com.ibm.watson.developer_cloud.assistant.v1.model.EntityExport; |
| 40 | +import com.ibm.watson.developer_cloud.assistant.v1.model.EntityMentionCollection; |
40 | 41 | import com.ibm.watson.developer_cloud.assistant.v1.model.Example; |
41 | 42 | import com.ibm.watson.developer_cloud.assistant.v1.model.ExampleCollection; |
42 | 43 | import com.ibm.watson.developer_cloud.assistant.v1.model.GetCounterexampleOptions; |
|
57 | 58 | import com.ibm.watson.developer_cloud.assistant.v1.model.ListExamplesOptions; |
58 | 59 | import com.ibm.watson.developer_cloud.assistant.v1.model.ListIntentsOptions; |
59 | 60 | import com.ibm.watson.developer_cloud.assistant.v1.model.ListLogsOptions; |
| 61 | +import com.ibm.watson.developer_cloud.assistant.v1.model.ListMentionsOptions; |
60 | 62 | import com.ibm.watson.developer_cloud.assistant.v1.model.ListSynonymsOptions; |
61 | 63 | import com.ibm.watson.developer_cloud.assistant.v1.model.ListValuesOptions; |
62 | 64 | import com.ibm.watson.developer_cloud.assistant.v1.model.ListWorkspacesOptions; |
@@ -235,6 +237,9 @@ public ServiceCall<Workspace> createWorkspace(CreateWorkspaceOptions createWorks |
235 | 237 | if (createWorkspaceOptions.learningOptOut() != null) { |
236 | 238 | contentJson.addProperty("learning_opt_out", createWorkspaceOptions.learningOptOut()); |
237 | 239 | } |
| 240 | + if (createWorkspaceOptions.systemSettings() != null) { |
| 241 | + contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(createWorkspaceOptions.systemSettings())); |
| 242 | + } |
238 | 243 | builder.bodyJson(contentJson); |
239 | 244 | } |
240 | 245 | return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class)); |
@@ -397,6 +402,9 @@ public ServiceCall<Workspace> updateWorkspace(UpdateWorkspaceOptions updateWorks |
397 | 402 | if (updateWorkspaceOptions.learningOptOut() != null) { |
398 | 403 | contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut()); |
399 | 404 | } |
| 405 | + if (updateWorkspaceOptions.systemSettings() != null) { |
| 406 | + contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings())); |
| 407 | + } |
400 | 408 | builder.bodyJson(contentJson); |
401 | 409 | return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class)); |
402 | 410 | } |
@@ -567,6 +575,9 @@ public ServiceCall<Example> createExample(CreateExampleOptions createExampleOpti |
567 | 575 | builder.query(VERSION, versionDate); |
568 | 576 | final JsonObject contentJson = new JsonObject(); |
569 | 577 | contentJson.addProperty("text", createExampleOptions.text()); |
| 578 | + if (createExampleOptions.mentions() != null) { |
| 579 | + contentJson.add("mentions", GsonSingleton.getGson().toJsonTree(createExampleOptions.mentions())); |
| 580 | + } |
570 | 581 | builder.bodyJson(contentJson); |
571 | 582 | return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Example.class)); |
572 | 583 | } |
@@ -618,7 +629,7 @@ public ServiceCall<Example> getExample(GetExampleOptions getExampleOptions) { |
618 | 629 | /** |
619 | 630 | * List user input examples. |
620 | 631 | * |
621 | | - * List the user input examples for an intent. |
| 632 | + * List the user input examples for an intent, optionally including contextual entity mentions. |
622 | 633 | * |
623 | 634 | * This operation is limited to 2500 requests per 30 minutes. For more information, see **Rate limiting**. |
624 | 635 | * |
@@ -672,6 +683,9 @@ public ServiceCall<Example> updateExample(UpdateExampleOptions updateExampleOpti |
672 | 683 | if (updateExampleOptions.newText() != null) { |
673 | 684 | contentJson.addProperty("text", updateExampleOptions.newText()); |
674 | 685 | } |
| 686 | + if (updateExampleOptions.newMentions() != null) { |
| 687 | + contentJson.add("mentions", GsonSingleton.getGson().toJsonTree(updateExampleOptions.newMentions())); |
| 688 | + } |
675 | 689 | builder.bodyJson(contentJson); |
676 | 690 | return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Example.class)); |
677 | 691 | } |
@@ -962,6 +976,33 @@ public ServiceCall<Entity> updateEntity(UpdateEntityOptions updateEntityOptions) |
962 | 976 | return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Entity.class)); |
963 | 977 | } |
964 | 978 |
|
| 979 | + /** |
| 980 | + * List entity mentions. |
| 981 | + * |
| 982 | + * List mentions for a contextual entity. An entity mention is an occurrence of a contextual entity in the context of |
| 983 | + * an intent user input example. |
| 984 | + * |
| 985 | + * This operation is limited to 200 requests per 30 minutes. For more information, see **Rate limiting**. |
| 986 | + * |
| 987 | + * @param listMentionsOptions the {@link ListMentionsOptions} containing the options for the call |
| 988 | + * @return a {@link ServiceCall} with a response type of {@link EntityMentionCollection} |
| 989 | + */ |
| 990 | + public ServiceCall<EntityMentionCollection> listMentions(ListMentionsOptions listMentionsOptions) { |
| 991 | + Validator.notNull(listMentionsOptions, "listMentionsOptions cannot be null"); |
| 992 | + String[] pathSegments = { "v1/workspaces", "entities", "mentions" }; |
| 993 | + String[] pathParameters = { listMentionsOptions.workspaceId(), listMentionsOptions.entity() }; |
| 994 | + RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, |
| 995 | + pathParameters)); |
| 996 | + builder.query(VERSION, versionDate); |
| 997 | + if (listMentionsOptions.export() != null) { |
| 998 | + builder.query("export", String.valueOf(listMentionsOptions.export())); |
| 999 | + } |
| 1000 | + if (listMentionsOptions.includeAudit() != null) { |
| 1001 | + builder.query("include_audit", String.valueOf(listMentionsOptions.includeAudit())); |
| 1002 | + } |
| 1003 | + return createServiceCall(builder.build(), ResponseConverterUtils.getObject(EntityMentionCollection.class)); |
| 1004 | + } |
| 1005 | + |
965 | 1006 | /** |
966 | 1007 | * Add entity value. |
967 | 1008 | * |
@@ -1319,6 +1360,9 @@ public ServiceCall<DialogNode> createDialogNode(CreateDialogNodeOptions createDi |
1319 | 1360 | if (createDialogNodeOptions.digressOutSlots() != null) { |
1320 | 1361 | contentJson.addProperty("digress_out_slots", createDialogNodeOptions.digressOutSlots()); |
1321 | 1362 | } |
| 1363 | + if (createDialogNodeOptions.userLabel() != null) { |
| 1364 | + contentJson.addProperty("user_label", createDialogNodeOptions.userLabel()); |
| 1365 | + } |
1322 | 1366 | builder.bodyJson(contentJson); |
1323 | 1367 | return createServiceCall(builder.build(), ResponseConverterUtils.getObject(DialogNode.class)); |
1324 | 1368 | } |
@@ -1437,6 +1481,9 @@ public ServiceCall<DialogNode> updateDialogNode(UpdateDialogNodeOptions updateDi |
1437 | 1481 | if (updateDialogNodeOptions.newVariable() != null) { |
1438 | 1482 | contentJson.addProperty("variable", updateDialogNodeOptions.newVariable()); |
1439 | 1483 | } |
| 1484 | + if (updateDialogNodeOptions.newUserLabel() != null) { |
| 1485 | + contentJson.addProperty("user_label", updateDialogNodeOptions.newUserLabel()); |
| 1486 | + } |
1440 | 1487 | if (updateDialogNodeOptions.newMetadata() != null) { |
1441 | 1488 | contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateDialogNodeOptions.newMetadata())); |
1442 | 1489 | } |
|
0 commit comments