Skip to content

Commit

Permalink
feat(assistantv2): add new assistant, environment, and skills lifecyc…
Browse files Browse the repository at this point in the history
…le methods

these allow greater control over actions and v2 assistants using the api and sdk

BREAKING CHANGE: 'createSession' param replaced with 'requestAnalytics' param. 'language' property
removed from 'Environment' model. method name changes in environment and release models.
  • Loading branch information
jeff-arn authored and apaparazzi0329 committed Mar 15, 2023
1 parent d2aebb9 commit aaf9b77
Show file tree
Hide file tree
Showing 135 changed files with 7,148 additions and 374 deletions.
549 changes: 544 additions & 5 deletions assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2020.
* (C) Copyright IBM Corp. 2023.
*
* 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 @@ -19,6 +19,8 @@ public class AgentAvailabilityMessage extends GenericModel {

protected String message;

protected AgentAvailabilityMessage() {}

/**
* Gets the message.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
/*
* (C) Copyright IBM Corp. 2023.
*
* 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;
import java.util.List;

/** Assistant. */
public class Assistant extends GenericModel {

@SerializedName("assistant_id")
protected String assistantId;

protected String name;
protected String description;
protected String language;

@SerializedName("assistant_skills")
protected List<AssistantSkill> assistantSkills;

@SerializedName("assistant_environments")
protected List<EnvironmentReference> assistantEnvironments;

/** Builder. */
public static class Builder {
private String name;
private String description;
private String language;

/**
* Instantiates a new Builder from an existing Assistant instance.
*
* @param assistant the instance to initialize the Builder with
*/
private Builder(Assistant assistant) {
this.name = assistant.name;
this.description = assistant.description;
this.language = assistant.language;
}

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

/**
* Instantiates a new builder with required properties.
*
* @param language the language
*/
public Builder(String language) {
this.language = language;
}

/**
* Builds a Assistant.
*
* @return the new Assistant instance
*/
public Assistant build() {
return new Assistant(this);
}

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

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

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

protected Assistant() {}

protected Assistant(Builder builder) {
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.language, "language cannot be null");
name = builder.name;
description = builder.description;
language = builder.language;
}

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

/**
* Gets the assistantId.
*
* <p>The unique identifier of the assistant.
*
* @return the assistantId
*/
public String assistantId() {
return assistantId;
}

/**
* Gets the name.
*
* <p>The name of the assistant. This string cannot contain carriage return, newline, or tab
* characters.
*
* @return the name
*/
public String name() {
return name;
}

/**
* Gets the description.
*
* <p>The description of the assistant. This string cannot contain carriage return, newline, or
* tab characters.
*
* @return the description
*/
public String description() {
return description;
}

/**
* Gets the language.
*
* <p>The language of the assistant.
*
* @return the language
*/
public String language() {
return language;
}

/**
* Gets the assistantSkills.
*
* <p>An array of skill references identifying the skills associated with the assistant.
*
* @return the assistantSkills
*/
public List<AssistantSkill> assistantSkills() {
return assistantSkills;
}

/**
* Gets the assistantEnvironments.
*
* <p>An array of objects describing the environments defined for the assistant.
*
* @return the assistantEnvironments
*/
public List<EnvironmentReference> assistantEnvironments() {
return assistantEnvironments;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* (C) Copyright IBM Corp. 2023.
*
* 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;

/** AssistantCollection. */
public class AssistantCollection extends GenericModel {

protected List<AssistantData> assistants;
protected Pagination pagination;

protected AssistantCollection() {}

/**
* Gets the assistants.
*
* <p>An array of objects describing the assistants associated with the instance.
*
* @return the assistants
*/
public List<AssistantData> getAssistants() {
return assistants;
}

/**
* Gets the pagination.
*
* <p>The pagination data for the returned objects. For more information about using pagination,
* see [Pagination](#pagination).
*
* @return the pagination
*/
public Pagination getPagination() {
return pagination;
}
}

0 comments on commit aaf9b77

Please sign in to comment.