Skip to content

Commit aaf9b77

Browse files
jeff-arnapaparazzi0329
authored andcommitted
feat(assistantv2): add new assistant, environment, and skills lifecycle 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.
1 parent d2aebb9 commit aaf9b77

File tree

135 files changed

+7148
-374
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+7148
-374
lines changed

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

Lines changed: 544 additions & 5 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020.
2+
* (C) Copyright IBM Corp. 2023.
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
@@ -19,6 +19,8 @@ public class AgentAvailabilityMessage extends GenericModel {
1919

2020
protected String message;
2121

22+
protected AgentAvailabilityMessage() {}
23+
2224
/**
2325
* Gets the message.
2426
*
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2023.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
package com.ibm.watson.assistant.v2.model;
14+
15+
import com.google.gson.annotations.SerializedName;
16+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
17+
import java.util.List;
18+
19+
/** Assistant. */
20+
public class Assistant extends GenericModel {
21+
22+
@SerializedName("assistant_id")
23+
protected String assistantId;
24+
25+
protected String name;
26+
protected String description;
27+
protected String language;
28+
29+
@SerializedName("assistant_skills")
30+
protected List<AssistantSkill> assistantSkills;
31+
32+
@SerializedName("assistant_environments")
33+
protected List<EnvironmentReference> assistantEnvironments;
34+
35+
/** Builder. */
36+
public static class Builder {
37+
private String name;
38+
private String description;
39+
private String language;
40+
41+
/**
42+
* Instantiates a new Builder from an existing Assistant instance.
43+
*
44+
* @param assistant the instance to initialize the Builder with
45+
*/
46+
private Builder(Assistant assistant) {
47+
this.name = assistant.name;
48+
this.description = assistant.description;
49+
this.language = assistant.language;
50+
}
51+
52+
/** Instantiates a new builder. */
53+
public Builder() {}
54+
55+
/**
56+
* Instantiates a new builder with required properties.
57+
*
58+
* @param language the language
59+
*/
60+
public Builder(String language) {
61+
this.language = language;
62+
}
63+
64+
/**
65+
* Builds a Assistant.
66+
*
67+
* @return the new Assistant instance
68+
*/
69+
public Assistant build() {
70+
return new Assistant(this);
71+
}
72+
73+
/**
74+
* Set the name.
75+
*
76+
* @param name the name
77+
* @return the Assistant builder
78+
*/
79+
public Builder name(String name) {
80+
this.name = name;
81+
return this;
82+
}
83+
84+
/**
85+
* Set the description.
86+
*
87+
* @param description the description
88+
* @return the Assistant builder
89+
*/
90+
public Builder description(String description) {
91+
this.description = description;
92+
return this;
93+
}
94+
95+
/**
96+
* Set the language.
97+
*
98+
* @param language the language
99+
* @return the Assistant builder
100+
*/
101+
public Builder language(String language) {
102+
this.language = language;
103+
return this;
104+
}
105+
}
106+
107+
protected Assistant() {}
108+
109+
protected Assistant(Builder builder) {
110+
com.ibm.cloud.sdk.core.util.Validator.notNull(builder.language, "language cannot be null");
111+
name = builder.name;
112+
description = builder.description;
113+
language = builder.language;
114+
}
115+
116+
/**
117+
* New builder.
118+
*
119+
* @return a Assistant builder
120+
*/
121+
public Builder newBuilder() {
122+
return new Builder(this);
123+
}
124+
125+
/**
126+
* Gets the assistantId.
127+
*
128+
* <p>The unique identifier of the assistant.
129+
*
130+
* @return the assistantId
131+
*/
132+
public String assistantId() {
133+
return assistantId;
134+
}
135+
136+
/**
137+
* Gets the name.
138+
*
139+
* <p>The name of the assistant. This string cannot contain carriage return, newline, or tab
140+
* characters.
141+
*
142+
* @return the name
143+
*/
144+
public String name() {
145+
return name;
146+
}
147+
148+
/**
149+
* Gets the description.
150+
*
151+
* <p>The description of the assistant. This string cannot contain carriage return, newline, or
152+
* tab characters.
153+
*
154+
* @return the description
155+
*/
156+
public String description() {
157+
return description;
158+
}
159+
160+
/**
161+
* Gets the language.
162+
*
163+
* <p>The language of the assistant.
164+
*
165+
* @return the language
166+
*/
167+
public String language() {
168+
return language;
169+
}
170+
171+
/**
172+
* Gets the assistantSkills.
173+
*
174+
* <p>An array of skill references identifying the skills associated with the assistant.
175+
*
176+
* @return the assistantSkills
177+
*/
178+
public List<AssistantSkill> assistantSkills() {
179+
return assistantSkills;
180+
}
181+
182+
/**
183+
* Gets the assistantEnvironments.
184+
*
185+
* <p>An array of objects describing the environments defined for the assistant.
186+
*
187+
* @return the assistantEnvironments
188+
*/
189+
public List<EnvironmentReference> assistantEnvironments() {
190+
return assistantEnvironments;
191+
}
192+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2023.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
package com.ibm.watson.assistant.v2.model;
14+
15+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
16+
import java.util.List;
17+
18+
/** AssistantCollection. */
19+
public class AssistantCollection extends GenericModel {
20+
21+
protected List<AssistantData> assistants;
22+
protected Pagination pagination;
23+
24+
protected AssistantCollection() {}
25+
26+
/**
27+
* Gets the assistants.
28+
*
29+
* <p>An array of objects describing the assistants associated with the instance.
30+
*
31+
* @return the assistants
32+
*/
33+
public List<AssistantData> getAssistants() {
34+
return assistants;
35+
}
36+
37+
/**
38+
* Gets the pagination.
39+
*
40+
* <p>The pagination data for the returned objects. For more information about using pagination,
41+
* see [Pagination](#pagination).
42+
*
43+
* @return the pagination
44+
*/
45+
public Pagination getPagination() {
46+
return pagination;
47+
}
48+
}

0 commit comments

Comments
 (0)