Skip to content

Commit

Permalink
feat(assistant): generated code
Browse files Browse the repository at this point in the history
chore(assistant): manual changes
  • Loading branch information
germanattanasio committed Feb 24, 2020
1 parent 2d93247 commit 10108d9
Show file tree
Hide file tree
Showing 145 changed files with 3,040 additions and 182 deletions.
10 changes: 9 additions & 1 deletion assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Installation

##### Maven

```xml
<dependency>
<groupId>com.ibm.watson</groupId>
Expand All @@ -12,14 +13,17 @@
```

##### Gradle

```gradle
'com.ibm.watson:assistant:8.2.1'
```

## Usage

Use the [Assistant][assistant] service to identify intents, entities, and conduct conversations.

### Using Assistant v1

```java
// make sure to use the Assistant v1 import!
import com.ibm.watson.assistant.v1.Assistant;
Expand All @@ -37,6 +41,7 @@ System.out.println(response);
```

Maintaining context across messages:

```java
// make sure to use the Assistant v1 import!
import com.ibm.watson.assistant.v1.Assistant;
Expand Down Expand Up @@ -71,6 +76,7 @@ System.out.println(response);
---

### Using Assistant v2

```java
// make sure to use the Assistant v2 import!
import com.ibm.watson.assistant.v2.Assistant;
Expand All @@ -92,6 +98,7 @@ System.out.println(messageResponse);
```

Maintaining context across messages:

```java
// make sure to use the Assistant v2 import!
import com.ibm.watson.assistant.v2.Assistant;
Expand Down Expand Up @@ -127,4 +134,5 @@ messageResponse = service.message(messageOptions).execute().getResult();

System.out.println(messageResponse);
```
[assistant]: https://cloud.ibm.com/docs/services/assistant?topic=assistant-index

[assistant]: https://cloud.ibm.com/docs/assistant?topic=assistant-index
65 changes: 61 additions & 4 deletions assistant/src/main/java/com/ibm/watson/assistant/v1/Assistant.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -95,7 +95,7 @@
* The Assistant v1 API provides authoring methods your application can use to create or update a workspace.
*
* @version v1
* @see <a href="https://cloud.ibm.com/docs/services/assistant/">Assistant</a>
* @see <a href="https://cloud.ibm.com/docs/assistant/">Assistant</a>
*/
public class Assistant extends BaseService {

Expand Down Expand Up @@ -163,7 +163,7 @@ public Assistant(String versionDate, String serviceName, Authenticator authentic
*
* **Important:** This method has been superseded by the new v2 runtime API. The v2 API offers significant advantages,
* including ease of deployment, automatic state management, versioning, and search capabilities. For more
* information, see the [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-api-overview).
* information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-api-overview).
*
* There is no rate limit for this operation.
*
Expand Down Expand Up @@ -289,6 +289,9 @@ public ServiceCall<Workspace> createWorkspace(CreateWorkspaceOptions createWorks
}
builder.header("Accept", "application/json");
if (createWorkspaceOptions != null) {
if (createWorkspaceOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createWorkspaceOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (createWorkspaceOptions.name() != null) {
contentJson.addProperty("name", createWorkspaceOptions.name());
Expand Down Expand Up @@ -418,6 +421,9 @@ public ServiceCall<Workspace> updateWorkspace(UpdateWorkspaceOptions updateWorks
if (updateWorkspaceOptions.append() != null) {
builder.query("append", String.valueOf(updateWorkspaceOptions.append()));
}
if (updateWorkspaceOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateWorkspaceOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateWorkspaceOptions.name() != null) {
contentJson.addProperty("name", updateWorkspaceOptions.name());
Expand Down Expand Up @@ -565,6 +571,9 @@ public ServiceCall<Intent> createIntent(CreateIntentOptions createIntentOptions)
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createIntentOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createIntentOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("intent", createIntentOptions.intent());
if (createIntentOptions.description() != null) {
Expand Down Expand Up @@ -644,6 +653,12 @@ public ServiceCall<Intent> updateIntent(UpdateIntentOptions updateIntentOptions)
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateIntentOptions.append() != null) {
builder.query("append", String.valueOf(updateIntentOptions.append()));
}
if (updateIntentOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateIntentOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateIntentOptions.newIntent() != null) {
contentJson.addProperty("intent", updateIntentOptions.newIntent());
Expand Down Expand Up @@ -757,6 +772,9 @@ public ServiceCall<Example> createExample(CreateExampleOptions createExampleOpti
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createExampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createExampleOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", createExampleOptions.text());
if (createExampleOptions.mentions() != null) {
Expand Down Expand Up @@ -829,6 +847,9 @@ public ServiceCall<Example> updateExample(UpdateExampleOptions updateExampleOpti
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateExampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateExampleOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateExampleOptions.newText() != null) {
contentJson.addProperty("text", updateExampleOptions.newText());
Expand Down Expand Up @@ -941,6 +962,9 @@ public ServiceCall<Counterexample> createCounterexample(CreateCounterexampleOpti
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createCounterexampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createCounterexampleOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("text", createCounterexampleOptions.text());
builder.bodyJson(contentJson);
Expand Down Expand Up @@ -1008,6 +1032,9 @@ public ServiceCall<Counterexample> updateCounterexample(UpdateCounterexampleOpti
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateCounterexampleOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateCounterexampleOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateCounterexampleOptions.newText() != null) {
contentJson.addProperty("text", updateCounterexampleOptions.newText());
Expand Down Expand Up @@ -1118,6 +1145,9 @@ public ServiceCall<Entity> createEntity(CreateEntityOptions createEntityOptions)
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createEntityOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createEntityOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("entity", createEntityOptions.entity());
if (createEntityOptions.description() != null) {
Expand Down Expand Up @@ -1204,6 +1234,12 @@ public ServiceCall<Entity> updateEntity(UpdateEntityOptions updateEntityOptions)
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateEntityOptions.append() != null) {
builder.query("append", String.valueOf(updateEntityOptions.append()));
}
if (updateEntityOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateEntityOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateEntityOptions.newEntity() != null) {
contentJson.addProperty("entity", updateEntityOptions.newEntity());
Expand Down Expand Up @@ -1363,6 +1399,9 @@ public ServiceCall<Value> createValue(CreateValueOptions createValueOptions) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createValueOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createValueOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("value", createValueOptions.value());
if (createValueOptions.metadata() != null) {
Expand Down Expand Up @@ -1450,6 +1489,12 @@ public ServiceCall<Value> updateValue(UpdateValueOptions updateValueOptions) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateValueOptions.append() != null) {
builder.query("append", String.valueOf(updateValueOptions.append()));
}
if (updateValueOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateValueOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateValueOptions.newValue() != null) {
contentJson.addProperty("value", updateValueOptions.newValue());
Expand Down Expand Up @@ -1574,6 +1619,9 @@ public ServiceCall<Synonym> createSynonym(CreateSynonymOptions createSynonymOpti
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createSynonymOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createSynonymOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("synonym", createSynonymOptions.synonym());
builder.bodyJson(contentJson);
Expand Down Expand Up @@ -1643,6 +1691,9 @@ public ServiceCall<Synonym> updateSynonym(UpdateSynonymOptions updateSynonymOpti
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateSynonymOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateSynonymOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateSynonymOptions.newSynonym() != null) {
contentJson.addProperty("synonym", updateSynonymOptions.newSynonym());
Expand Down Expand Up @@ -1750,6 +1801,9 @@ public ServiceCall<DialogNode> createDialogNode(CreateDialogNodeOptions createDi
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (createDialogNodeOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(createDialogNodeOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("dialog_node", createDialogNodeOptions.dialogNode());
if (createDialogNodeOptions.description() != null) {
Expand Down Expand Up @@ -1876,6 +1930,9 @@ public ServiceCall<DialogNode> updateDialogNode(UpdateDialogNodeOptions updateDi
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateDialogNodeOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(updateDialogNodeOptions.includeAudit()));
}
final JsonObject contentJson = new JsonObject();
if (updateDialogNodeOptions.newDialogNode() != null) {
contentJson.addProperty("dialog_node", updateDialogNodeOptions.newDialogNode());
Expand Down Expand Up @@ -2062,7 +2119,7 @@ public ServiceCall<LogCollection> listAllLogs(ListAllLogsOptions listAllLogsOpti
*
* 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/services/assistant?topic=assistant-information-security#information-security).
* 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**.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,17 +21,20 @@ public class CreateCounterexampleOptions extends GenericModel {

protected String workspaceId;
protected String text;
protected Boolean includeAudit;

/**
* Builder.
*/
public static class Builder {
private String workspaceId;
private String text;
private Boolean includeAudit;

private Builder(CreateCounterexampleOptions createCounterexampleOptions) {
this.workspaceId = createCounterexampleOptions.workspaceId;
this.text = createCounterexampleOptions.text;
this.includeAudit = createCounterexampleOptions.includeAudit;
}

/**
Expand Down Expand Up @@ -82,6 +85,17 @@ public Builder text(String text) {
return this;
}

/**
* Set the includeAudit.
*
* @param includeAudit the includeAudit
* @return the CreateCounterexampleOptions builder
*/
public Builder includeAudit(Boolean includeAudit) {
this.includeAudit = includeAudit;
return this;
}

/**
* Set the counterexample.
*
Expand All @@ -101,6 +115,7 @@ protected CreateCounterexampleOptions(Builder builder) {
"text cannot be null");
workspaceId = builder.workspaceId;
text = builder.text;
includeAudit = builder.includeAudit;
}

/**
Expand Down Expand Up @@ -135,4 +150,15 @@ public String workspaceId() {
public String text() {
return text;
}

/**
* Gets the includeAudit.
*
* Whether to include the audit properties (`created` and `updated` timestamps) in the response.
*
* @return the includeAudit
*/
public Boolean includeAudit() {
return includeAudit;
}
}
Loading

0 comments on commit 10108d9

Please sign in to comment.