Skip to content

Commit 89f2209

Browse files
feat(wa-v2): support for private variables
BREAKING CHANGE: Multiple class name changes and Log class property type changes
1 parent 8e9f831 commit 89f2209

34 files changed

+3027
-418
lines changed

assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
import com.ibm.watson.assistant.v2.model.ListReleasesOptions;
5252
import com.ibm.watson.assistant.v2.model.LogCollection;
5353
import com.ibm.watson.assistant.v2.model.MessageOptions;
54-
import com.ibm.watson.assistant.v2.model.MessageResponse;
55-
import com.ibm.watson.assistant.v2.model.MessageResponseStateless;
5654
import com.ibm.watson.assistant.v2.model.MessageStatelessOptions;
5755
import com.ibm.watson.assistant.v2.model.Release;
5856
import com.ibm.watson.assistant.v2.model.ReleaseCollection;
5957
import com.ibm.watson.assistant.v2.model.SessionResponse;
6058
import com.ibm.watson.assistant.v2.model.Skill;
6159
import com.ibm.watson.assistant.v2.model.SkillsAsyncRequestStatus;
6260
import com.ibm.watson.assistant.v2.model.SkillsExport;
61+
import com.ibm.watson.assistant.v2.model.StatefulMessageResponse;
62+
import com.ibm.watson.assistant.v2.model.StatelessMessageResponse;
6363
import com.ibm.watson.assistant.v2.model.UpdateEnvironmentOptions;
6464
import com.ibm.watson.assistant.v2.model.UpdateSkillOptions;
6565
import com.ibm.watson.common.SdkCommon;
@@ -385,9 +385,9 @@ public ServiceCall<Void> deleteSession(DeleteSessionOptions deleteSessionOptions
385385
* context data) stored by watsonx Assistant for the duration of the session.
386386
*
387387
* @param messageOptions the {@link MessageOptions} containing the options for the call
388-
* @return a {@link ServiceCall} with a result of type {@link MessageResponse}
388+
* @return a {@link ServiceCall} with a result of type {@link StatefulMessageResponse}
389389
*/
390-
public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
390+
public ServiceCall<StatefulMessageResponse> message(MessageOptions messageOptions) {
391391
com.ibm.cloud.sdk.core.util.Validator.notNull(messageOptions, "messageOptions cannot be null");
392392
Map<String, String> pathParamsMap = new HashMap<String, String>();
393393
pathParamsMap.put("assistant_id", messageOptions.assistantId());
@@ -419,9 +419,9 @@ public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
419419
contentJson.addProperty("user_id", messageOptions.userId());
420420
}
421421
builder.bodyJson(contentJson);
422-
ResponseConverter<MessageResponse> responseConverter =
422+
ResponseConverter<StatefulMessageResponse> responseConverter =
423423
ResponseConverterUtils.getValue(
424-
new com.google.gson.reflect.TypeToken<MessageResponse>() {}.getType());
424+
new com.google.gson.reflect.TypeToken<StatefulMessageResponse>() {}.getType());
425425
return createServiceCall(builder.build(), responseConverter);
426426
}
427427

@@ -433,9 +433,9 @@ public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
433433
*
434434
* @param messageStatelessOptions the {@link MessageStatelessOptions} containing the options for
435435
* the call
436-
* @return a {@link ServiceCall} with a result of type {@link MessageResponseStateless}
436+
* @return a {@link ServiceCall} with a result of type {@link StatelessMessageResponse}
437437
*/
438-
public ServiceCall<MessageResponseStateless> messageStateless(
438+
public ServiceCall<StatelessMessageResponse> messageStateless(
439439
MessageStatelessOptions messageStatelessOptions) {
440440
com.ibm.cloud.sdk.core.util.Validator.notNull(
441441
messageStatelessOptions, "messageStatelessOptions cannot be null");
@@ -469,9 +469,9 @@ public ServiceCall<MessageResponseStateless> messageStateless(
469469
contentJson.addProperty("user_id", messageStatelessOptions.userId());
470470
}
471471
builder.bodyJson(contentJson);
472-
ResponseConverter<MessageResponseStateless> responseConverter =
472+
ResponseConverter<StatelessMessageResponse> responseConverter =
473473
ResponseConverterUtils.getValue(
474-
new com.google.gson.reflect.TypeToken<MessageResponseStateless>() {}.getType());
474+
new com.google.gson.reflect.TypeToken<StatelessMessageResponse>() {}.getType());
475475
return createServiceCall(builder.build(), responseConverter);
476476
}
477477

assistant/src/main/java/com/ibm/watson/assistant/v2/model/Log.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2023.
2+
* (C) Copyright IBM Corp. 2024.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -21,8 +21,8 @@ public class Log extends GenericModel {
2121
@SerializedName("log_id")
2222
protected String logId;
2323

24-
protected MessageRequest request;
25-
protected MessageResponse response;
24+
protected LogRequest request;
25+
protected LogResponse response;
2626

2727
@SerializedName("assistant_id")
2828
protected String assistantId;
@@ -62,22 +62,22 @@ public String getLogId() {
6262
/**
6363
* Gets the request.
6464
*
65-
* <p>A stateful message request formatted for the Watson Assistant service.
65+
* <p>A message request formatted for the watsonx Assistant service.
6666
*
6767
* @return the request
6868
*/
69-
public MessageRequest getRequest() {
69+
public LogRequest getRequest() {
7070
return request;
7171
}
7272

7373
/**
7474
* Gets the response.
7575
*
76-
* <p>A response from the Watson Assistant service.
76+
* <p>A response from the watsonx Assistant service.
7777
*
7878
* @return the response
7979
*/
80-
public MessageResponse getResponse() {
80+
public LogResponse getResponse() {
8181
return response;
8282
}
8383

assistant/src/main/java/com/ibm/watson/assistant/v2/model/MessageRequest.java renamed to assistant/src/main/java/com/ibm/watson/assistant/v2/model/LogRequest.java

Lines changed: 9 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2023.
2+
* (C) Copyright IBM Corp. 2024.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -15,103 +15,25 @@
1515
import com.google.gson.annotations.SerializedName;
1616
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1717

18-
/** A stateful message request formatted for the Watson Assistant service. */
19-
public class MessageRequest extends GenericModel {
18+
/** A message request formatted for the watsonx Assistant service. */
19+
public class LogRequest extends GenericModel {
2020

21-
protected MessageInput input;
21+
protected LogRequestInput input;
2222
protected MessageContext context;
2323

2424
@SerializedName("user_id")
2525
protected String userId;
2626

27-
/** Builder. */
28-
public static class Builder {
29-
private MessageInput input;
30-
private MessageContext context;
31-
private String userId;
32-
33-
/**
34-
* Instantiates a new Builder from an existing MessageRequest instance.
35-
*
36-
* @param messageRequest the instance to initialize the Builder with
37-
*/
38-
private Builder(MessageRequest messageRequest) {
39-
this.input = messageRequest.input;
40-
this.context = messageRequest.context;
41-
this.userId = messageRequest.userId;
42-
}
43-
44-
/** Instantiates a new builder. */
45-
public Builder() {}
46-
47-
/**
48-
* Builds a MessageRequest.
49-
*
50-
* @return the new MessageRequest instance
51-
*/
52-
public MessageRequest build() {
53-
return new MessageRequest(this);
54-
}
55-
56-
/**
57-
* Set the input.
58-
*
59-
* @param input the input
60-
* @return the MessageRequest builder
61-
*/
62-
public Builder input(MessageInput input) {
63-
this.input = input;
64-
return this;
65-
}
66-
67-
/**
68-
* Set the context.
69-
*
70-
* @param context the context
71-
* @return the MessageRequest builder
72-
*/
73-
public Builder context(MessageContext context) {
74-
this.context = context;
75-
return this;
76-
}
77-
78-
/**
79-
* Set the userId.
80-
*
81-
* @param userId the userId
82-
* @return the MessageRequest builder
83-
*/
84-
public Builder userId(String userId) {
85-
this.userId = userId;
86-
return this;
87-
}
88-
}
89-
90-
protected MessageRequest() {}
91-
92-
protected MessageRequest(Builder builder) {
93-
input = builder.input;
94-
context = builder.context;
95-
userId = builder.userId;
96-
}
97-
98-
/**
99-
* New builder.
100-
*
101-
* @return a MessageRequest builder
102-
*/
103-
public Builder newBuilder() {
104-
return new Builder(this);
105-
}
27+
protected LogRequest() {}
10628

10729
/**
10830
* Gets the input.
10931
*
110-
* <p>An input object that includes the input text.
32+
* <p>An input object that includes the input text. All private data is masked or removed.
11133
*
11234
* @return the input
11335
*/
114-
public MessageInput input() {
36+
public LogRequestInput getInput() {
11537
return input;
11638
}
11739

@@ -127,7 +49,7 @@ public MessageInput input() {
12749
*
12850
* @return the context
12951
*/
130-
public MessageContext context() {
52+
public MessageContext getContext() {
13153
return context;
13254
}
13355

@@ -146,7 +68,7 @@ public MessageContext context() {
14668
*
14769
* @return the userId
14870
*/
149-
public String userId() {
71+
public String getUserId() {
15072
return userId;
15173
}
15274
}

0 commit comments

Comments
 (0)