Skip to content

Commit

Permalink
feat(assistantv2): add several new functions
Browse files Browse the repository at this point in the history
BREAKING CHANGE: removing and changing of classes
  • Loading branch information
apaparazzi0329 committed Mar 17, 2023
1 parent f32894a commit 0f5dff8
Show file tree
Hide file tree
Showing 59 changed files with 2,589 additions and 203 deletions.
1,176 changes: 1,087 additions & 89 deletions src/IBM.Watson.Assistant.v2/AssistantService.cs

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions src/IBM.Watson.Assistant.v2/IAssistantService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2019, 2022.
* (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.
Expand All @@ -24,7 +24,10 @@ namespace IBM.Watson.Assistant.v2
{
public partial interface IAssistantService
{
DetailedResponse<SessionResponse> CreateSession(string assistantId);
DetailedResponse<AssistantData> CreateAssistant(string language = null, string name = null, string description = null);
DetailedResponse<AssistantCollection> ListAssistants(long? pageLimit = null, bool? includeCount = null, string sort = null, string cursor = null, bool? includeAudit = null);
DetailedResponse<object> DeleteAssistant(string assistantId);
DetailedResponse<SessionResponse> CreateSession(string assistantId, RequestAnalytics analytics = null);
DetailedResponse<object> DeleteSession(string assistantId, string sessionId);
DetailedResponse<MessageResponse> Message(string assistantId, string sessionId, MessageInput input = null, MessageContext context = null, string userId = null);
DetailedResponse<MessageResponseStateless> MessageStateless(string assistantId, MessageInputStateless input = null, MessageContextStateless context = null, string userId = null);
Expand All @@ -33,8 +36,16 @@ public partial interface IAssistantService
DetailedResponse<object> DeleteUserData(string customerId);
DetailedResponse<EnvironmentCollection> ListEnvironments(string assistantId, long? pageLimit = null, bool? includeCount = null, string sort = null, string cursor = null, bool? includeAudit = null);
DetailedResponse<Environment> GetEnvironment(string assistantId, string environmentId, bool? includeAudit = null);
DetailedResponse<Environment> UpdateEnvironment(string assistantId, string environmentId, string name = null, string description = null, long? sessionTimeout = null, List<EnvironmentSkill> skillReferences = null);
DetailedResponse<Release> CreateRelease(string assistantId, string description = null);
DetailedResponse<ReleaseCollection> ListReleases(string assistantId, long? pageLimit = null, bool? includeCount = null, string sort = null, string cursor = null, bool? includeAudit = null);
DetailedResponse<Release> GetRelease(string assistantId, string release, bool? includeAudit = null);
DetailedResponse<object> DeleteRelease(string assistantId, string release);
DetailedResponse<Environment> DeployRelease(string assistantId, string release, string environmentId, bool? includeAudit = null);
DetailedResponse<Skill> GetSkill(string assistantId, string skillId);
DetailedResponse<Skill> UpdateSkill(string assistantId, string skillId, string name = null, string description = null, Dictionary<string, object> workspace = null, Dictionary<string, object> dialogSettings = null, SearchSettings searchSettings = null);
DetailedResponse<SkillsExport> ExportSkills(string assistantId, bool? includeAudit = null);
DetailedResponse<SkillsAsyncRequestStatus> ImportSkills(string assistantId, List<SkillImport> assistantSkills, AssistantState assistantState, bool? includeAudit = null);
DetailedResponse<SkillsAsyncRequestStatus> ImportSkillsStatus(string assistantId);
}
}
41 changes: 41 additions & 0 deletions src/IBM.Watson.Assistant.v2/Model/AssistantCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* (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.
*
*/

using System.Collections.Generic;
using Newtonsoft.Json;

namespace IBM.Watson.Assistant.v2.Model
{
/// <summary>
/// AssistantCollection.
/// </summary>
public class AssistantCollection
{
/// <summary>
/// An array of objects describing the assistants associated with the instance.
/// </summary>
[JsonProperty("assistants", NullValueHandling = NullValueHandling.Ignore)]
public List<AssistantData> Assistants { get; set; }
/// <summary>
/// The pagination data for the returned objects. For more information about using pagination, see
/// [Pagination](#pagination).
/// </summary>
[JsonProperty("pagination", NullValueHandling = NullValueHandling.Ignore)]
public Pagination Pagination { get; set; }
}

}
60 changes: 60 additions & 0 deletions src/IBM.Watson.Assistant.v2/Model/AssistantData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* (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.
*
*/

using System.Collections.Generic;
using Newtonsoft.Json;

namespace IBM.Watson.Assistant.v2.Model
{
/// <summary>
/// AssistantData.
/// </summary>
public class AssistantData
{
/// <summary>
/// The unique identifier of the assistant.
/// </summary>
[JsonProperty("assistant_id", NullValueHandling = NullValueHandling.Ignore)]
public virtual string AssistantId { get; private set; }
/// <summary>
/// The name of the assistant. This string cannot contain carriage return, newline, or tab characters.
/// </summary>
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; }
/// <summary>
/// The description of the assistant. This string cannot contain carriage return, newline, or tab characters.
/// </summary>
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
public string Description { get; set; }
/// <summary>
/// The language of the assistant.
/// </summary>
[JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)]
public string Language { get; set; }
/// <summary>
/// An array of skill references identifying the skills associated with the assistant.
/// </summary>
[JsonProperty("assistant_skills", NullValueHandling = NullValueHandling.Ignore)]
public virtual List<AssistantSkill> AssistantSkills { get; private set; }
/// <summary>
/// An array of objects describing the environments defined for the assistant.
/// </summary>
[JsonProperty("assistant_environments", NullValueHandling = NullValueHandling.Ignore)]
public virtual List<EnvironmentReference> AssistantEnvironments { get; private set; }
}

}
60 changes: 60 additions & 0 deletions src/IBM.Watson.Assistant.v2/Model/AssistantSkill.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* (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.
*
*/

using Newtonsoft.Json;

namespace IBM.Watson.Assistant.v2.Model
{
/// <summary>
/// AssistantSkill.
/// </summary>
public class AssistantSkill
{
/// <summary>
/// The type of the skill.
/// </summary>
public class TypeEnumValue
{
/// <summary>
/// Constant DIALOG for dialog
/// </summary>
public const string DIALOG = "dialog";
/// <summary>
/// Constant ACTION for action
/// </summary>
public const string ACTION = "action";
/// <summary>
/// Constant SEARCH for search
/// </summary>
public const string SEARCH = "search";

}

/// <summary>
/// The type of the skill.
/// Constants for possible values can be found using AssistantSkill.TypeEnumValue
/// </summary>
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
public string Type { get; set; }
/// <summary>
/// The skill ID of the skill.
/// </summary>
[JsonProperty("skill_id", NullValueHandling = NullValueHandling.Ignore)]
public string SkillId { get; set; }
}

}
39 changes: 39 additions & 0 deletions src/IBM.Watson.Assistant.v2/Model/AssistantState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* (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.
*
*/

using Newtonsoft.Json;

namespace IBM.Watson.Assistant.v2.Model
{
/// <summary>
/// Status information about the skills for the assistant. Included in responses only if **status**=`Available`.
/// </summary>
public class AssistantState
{
/// <summary>
/// Whether the action skill is disabled in the draft environment.
/// </summary>
[JsonProperty("action_disabled", NullValueHandling = NullValueHandling.Ignore)]
public bool? ActionDisabled { get; set; }
/// <summary>
/// Whether the dialog skill is disabled in the draft environment.
/// </summary>
[JsonProperty("dialog_disabled", NullValueHandling = NullValueHandling.Ignore)]
public bool? DialogDisabled { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2022.
* (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.
Expand All @@ -22,7 +22,7 @@ namespace IBM.Watson.Assistant.v2.Model
/// <summary>
/// The search skill orchestration settings for the environment.
/// </summary>
public class EnvironmentOrchestration
public class BaseEnvironmentOrchestration
{
/// <summary>
/// Whether assistants deployed to the environment fall back to a search skill when responding to messages that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2022.
* (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.
Expand All @@ -22,7 +22,7 @@ namespace IBM.Watson.Assistant.v2.Model
/// <summary>
/// An object describing the release that is currently deployed in the environment.
/// </summary>
public class EnvironmentReleaseReference
public class BaseEnvironmentReleaseReference
{
/// <summary>
/// The name of the deployed release.
Expand Down
5 changes: 4 additions & 1 deletion src/IBM.Watson.Assistant.v2/Model/DialogSuggestion.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2018, 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.
Expand Down Expand Up @@ -34,6 +34,9 @@ public class DialogSuggestion
/// <summary>
/// An object defining the message input to be sent to the assistant if the user selects the corresponding
/// disambiguation option.
///
/// **Note:** This entire message input object must be included in the request body of the next message sent to
/// the assistant. Do not modify or remove any of the included properties.
/// </summary>
[JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)]
public DialogSuggestionValue Value { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/IBM.Watson.Assistant.v2/Model/DialogSuggestionValue.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2018, 2019.
* (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.
Expand All @@ -22,6 +22,9 @@ namespace IBM.Watson.Assistant.v2.Model
/// <summary>
/// An object defining the message input to be sent to the assistant if the user selects the corresponding
/// disambiguation option.
///
/// **Note:** This entire message input object must be included in the request body of the next message sent to the
/// assistant. Do not modify or remove any of the included properties.
/// </summary>
public class DialogSuggestionValue
{
Expand Down
20 changes: 7 additions & 13 deletions src/IBM.Watson.Assistant.v2/Model/Environment.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2022.
* (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.
Expand Down Expand Up @@ -37,12 +37,6 @@ public class Environment
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
public string Description { get; set; }
/// <summary>
/// The language of the environment. An environment is always created with the same language as the assistant it
/// is associated with.
/// </summary>
[JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)]
public string Language { get; set; }
/// <summary>
/// The assistant ID of the assistant the environment is associated with.
/// </summary>
[JsonProperty("assistant_id", NullValueHandling = NullValueHandling.Ignore)]
Expand All @@ -62,27 +56,27 @@ public class Environment
/// An object describing the release that is currently deployed in the environment.
/// </summary>
[JsonProperty("release_reference", NullValueHandling = NullValueHandling.Ignore)]
public EnvironmentReleaseReference ReleaseReference { get; set; }
public virtual BaseEnvironmentReleaseReference ReleaseReference { get; private set; }
/// <summary>
/// The search skill orchestration settings for the environment.
/// </summary>
[JsonProperty("orchestration", NullValueHandling = NullValueHandling.Ignore)]
public EnvironmentOrchestration Orchestration { get; set; }
public virtual BaseEnvironmentOrchestration Orchestration { get; private set; }
/// <summary>
/// The session inactivity timeout setting for the environment.
/// The session inactivity timeout setting for the environment (in seconds).
/// </summary>
[JsonProperty("session_timeout", NullValueHandling = NullValueHandling.Ignore)]
public long? SessionTimeout { get; set; }
/// <summary>
/// An array of objects describing the integrations that exist in the environment.
/// </summary>
[JsonProperty("integration_references", NullValueHandling = NullValueHandling.Ignore)]
public List<IntegrationReference> IntegrationReferences { get; set; }
public virtual List<IntegrationReference> IntegrationReferences { get; private set; }
/// <summary>
/// An array of objects describing the skills (such as actions and dialog) that exist in the environment.
/// An array of objects identifying the skills (such as action and dialog) that exist in the environment.
/// </summary>
[JsonProperty("skill_references", NullValueHandling = NullValueHandling.Ignore)]
public List<SkillReference> SkillReferences { get; set; }
public List<EnvironmentSkill> SkillReferences { get; set; }
/// <summary>
/// The timestamp for creation of the object.
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions src/IBM.Watson.Assistant.v2/Model/EnvironmentCollection.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2022.
* (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.
Expand Down Expand Up @@ -31,7 +31,8 @@ public class EnvironmentCollection
[JsonProperty("environments", NullValueHandling = NullValueHandling.Ignore)]
public List<Environment> Environments { get; set; }
/// <summary>
/// The pagination data for the returned objects.
/// The pagination data for the returned objects. For more information about using pagination, see
/// [Pagination](#pagination).
/// </summary>
[JsonProperty("pagination", NullValueHandling = NullValueHandling.Ignore)]
public Pagination Pagination { get; set; }
Expand Down
Loading

0 comments on commit 0f5dff8

Please sign in to comment.