Skip to content

Commit

Permalink
feat(wa-v2): support for private variables
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Multiple class name changes and Log class property type
changes
  • Loading branch information
apaparazzi0329 committed Feb 26, 2024
1 parent 8e9f831 commit 89f2209
Show file tree
Hide file tree
Showing 34 changed files with 3,027 additions and 418 deletions.
20 changes: 10 additions & 10 deletions assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
import com.ibm.watson.assistant.v2.model.ListReleasesOptions;
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;
import com.ibm.watson.assistant.v2.model.MessageStatelessOptions;
import com.ibm.watson.assistant.v2.model.Release;
import com.ibm.watson.assistant.v2.model.ReleaseCollection;
import com.ibm.watson.assistant.v2.model.SessionResponse;
import com.ibm.watson.assistant.v2.model.Skill;
import com.ibm.watson.assistant.v2.model.SkillsAsyncRequestStatus;
import com.ibm.watson.assistant.v2.model.SkillsExport;
import com.ibm.watson.assistant.v2.model.StatefulMessageResponse;
import com.ibm.watson.assistant.v2.model.StatelessMessageResponse;
import com.ibm.watson.assistant.v2.model.UpdateEnvironmentOptions;
import com.ibm.watson.assistant.v2.model.UpdateSkillOptions;
import com.ibm.watson.common.SdkCommon;
Expand Down Expand Up @@ -385,9 +385,9 @@ public ServiceCall<Void> deleteSession(DeleteSessionOptions deleteSessionOptions
* context data) stored by watsonx Assistant for the duration of the session.
*
* @param messageOptions the {@link MessageOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link MessageResponse}
* @return a {@link ServiceCall} with a result of type {@link StatefulMessageResponse}
*/
public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
public ServiceCall<StatefulMessageResponse> message(MessageOptions messageOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(messageOptions, "messageOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("assistant_id", messageOptions.assistantId());
Expand Down Expand Up @@ -419,9 +419,9 @@ public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
contentJson.addProperty("user_id", messageOptions.userId());
}
builder.bodyJson(contentJson);
ResponseConverter<MessageResponse> responseConverter =
ResponseConverter<StatefulMessageResponse> responseConverter =
ResponseConverterUtils.getValue(
new com.google.gson.reflect.TypeToken<MessageResponse>() {}.getType());
new com.google.gson.reflect.TypeToken<StatefulMessageResponse>() {}.getType());
return createServiceCall(builder.build(), responseConverter);
}

Expand All @@ -433,9 +433,9 @@ public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
*
* @param messageStatelessOptions the {@link MessageStatelessOptions} containing the options for
* the call
* @return a {@link ServiceCall} with a result of type {@link MessageResponseStateless}
* @return a {@link ServiceCall} with a result of type {@link StatelessMessageResponse}
*/
public ServiceCall<MessageResponseStateless> messageStateless(
public ServiceCall<StatelessMessageResponse> messageStateless(
MessageStatelessOptions messageStatelessOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(
messageStatelessOptions, "messageStatelessOptions cannot be null");
Expand Down Expand Up @@ -469,9 +469,9 @@ public ServiceCall<MessageResponseStateless> messageStateless(
contentJson.addProperty("user_id", messageStatelessOptions.userId());
}
builder.bodyJson(contentJson);
ResponseConverter<MessageResponseStateless> responseConverter =
ResponseConverter<StatelessMessageResponse> responseConverter =
ResponseConverterUtils.getValue(
new com.google.gson.reflect.TypeToken<MessageResponseStateless>() {}.getType());
new com.google.gson.reflect.TypeToken<StatelessMessageResponse>() {}.getType());
return createServiceCall(builder.build(), responseConverter);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020, 2023.
* (C) Copyright IBM Corp. 2024.
*
* 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,8 +21,8 @@ public class Log extends GenericModel {
@SerializedName("log_id")
protected String logId;

protected MessageRequest request;
protected MessageResponse response;
protected LogRequest request;
protected LogResponse response;

@SerializedName("assistant_id")
protected String assistantId;
Expand Down Expand Up @@ -62,22 +62,22 @@ public String getLogId() {
/**
* Gets the request.
*
* <p>A stateful message request formatted for the Watson Assistant service.
* <p>A message request formatted for the watsonx Assistant service.
*
* @return the request
*/
public MessageRequest getRequest() {
public LogRequest getRequest() {
return request;
}

/**
* Gets the response.
*
* <p>A response from the Watson Assistant service.
* <p>A response from the watsonx Assistant service.
*
* @return the response
*/
public MessageResponse getResponse() {
public LogResponse getResponse() {
return response;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020, 2023.
* (C) Copyright IBM Corp. 2024.
*
* 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 @@ -15,103 +15,25 @@
import com.google.gson.annotations.SerializedName;
import com.ibm.cloud.sdk.core.service.model.GenericModel;

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

protected MessageInput input;
protected LogRequestInput input;
protected MessageContext context;

@SerializedName("user_id")
protected String userId;

/** Builder. */
public static class Builder {
private MessageInput input;
private MessageContext context;
private String userId;

/**
* Instantiates a new Builder from an existing MessageRequest instance.
*
* @param messageRequest the instance to initialize the Builder with
*/
private Builder(MessageRequest messageRequest) {
this.input = messageRequest.input;
this.context = messageRequest.context;
this.userId = messageRequest.userId;
}

/** Instantiates a new builder. */
public Builder() {}

/**
* Builds a MessageRequest.
*
* @return the new MessageRequest instance
*/
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;
}

/**
* Set the userId.
*
* @param userId the userId
* @return the MessageRequest builder
*/
public Builder userId(String userId) {
this.userId = userId;
return this;
}
}

protected MessageRequest() {}

protected MessageRequest(Builder builder) {
input = builder.input;
context = builder.context;
userId = builder.userId;
}

/**
* New builder.
*
* @return a MessageRequest builder
*/
public Builder newBuilder() {
return new Builder(this);
}
protected LogRequest() {}

/**
* Gets the input.
*
* <p>An input object that includes the input text.
* <p>An input object that includes the input text. All private data is masked or removed.
*
* @return the input
*/
public MessageInput input() {
public LogRequestInput getInput() {
return input;
}

Expand All @@ -127,7 +49,7 @@ public MessageInput input() {
*
* @return the context
*/
public MessageContext context() {
public MessageContext getContext() {
return context;
}

Expand All @@ -146,7 +68,7 @@ public MessageContext context() {
*
* @return the userId
*/
public String userId() {
public String getUserId() {
return userId;
}
}
Loading

0 comments on commit 89f2209

Please sign in to comment.