diff --git a/Scripts/Services/Assistant/V1/AssistantService.cs b/Scripts/Services/Assistant/V1/AssistantService.cs index f545ef3cb..2b61558fb 100644 --- a/Scripts/Services/Assistant/V1/AssistantService.cs +++ b/Scripts/Services/Assistant/V1/AssistantService.cs @@ -72,6 +72,7 @@ public AssistantService(string versionDate) : this(versionDate, ConfigBasedAuthe public AssistantService(string versionDate, Authenticator authenticator) : base(versionDate, authenticator, serviceId) { Authenticator = authenticator; + if (string.IsNullOrEmpty(versionDate)) { throw new ArgumentNullException("A versionDate (format `yyyy-mm-dd`) is required to create an instance of AssistantService"); @@ -81,7 +82,6 @@ public AssistantService(string versionDate, Authenticator authenticator) : base( VersionDate = versionDate; } - if (string.IsNullOrEmpty(GetServiceUrl())) { SetServiceUrl(defaultServiceUrl); @@ -96,7 +96,7 @@ public AssistantService(string versionDate, Authenticator authenticator) : base( /// **Important:** This method has been superseded by the new v2 runtime API. The v2 API offers significant /// advantages, including ease of deployment, automatic state management, versioning, and search capabilities. /// For more information, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-api-overview). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-api-overview). /// /// There is no rate limit for this operation. /// @@ -171,6 +171,7 @@ public bool Message(Callback callback, string workspaceId, Mess Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/message", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -259,6 +260,7 @@ public bool ListWorkspaces(Callback callback, long? pageLim Connector.URL = GetServiceUrl() + "/v1/workspaces"; Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -312,8 +314,10 @@ private void OnListWorkspacesResponse(RESTConnector.Request req, RESTConnector.R /// An array of objects defining input examples that have been marked as /// irrelevant input. (optional) /// (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Workspace - public bool CreateWorkspace(Callback callback, string name = null, string description = null, string language = null, Dictionary metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List intents = null, List entities = null, List dialogNodes = null, List counterexamples = null, List webhooks = null) + public bool CreateWorkspace(Callback callback, string name = null, string description = null, string language = null, Dictionary metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List intents = null, List entities = null, List dialogNodes = null, List counterexamples = null, List webhooks = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateWorkspace`"); @@ -338,6 +342,10 @@ public bool CreateWorkspace(Callback callback, string name = null, st } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -370,6 +378,7 @@ public bool CreateWorkspace(Callback callback, string name = null, st Connector.URL = GetServiceUrl() + "/v1/workspaces"; Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -460,6 +469,7 @@ public bool GetWorkspace(Callback callback, string workspaceId, bool? Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -514,15 +524,17 @@ private void OnGetWorkspaceResponse(RESTConnector.Request req, RESTConnector.Res /// An array of objects defining input examples that have been marked as /// irrelevant input. (optional) /// (optional) - /// Whether the new data is to be appended to the existing data in the workspace. If + /// Whether the new data is to be appended to the existing data in the object. If /// **append**=`false`, elements included in the new data completely replace the corresponding existing - /// elements, including all subelements. For example, if the new data includes **entities** and + /// elements, including all subelements. For example, if the new data for a workspace includes **entities** and /// **append**=`false`, all existing entities in the workspace are discarded and replaced with the new entities. /// /// If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in /// the new data collide with existing elements, the update request fails. (optional, default to false) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Workspace - public bool UpdateWorkspace(Callback callback, string workspaceId, string name = null, string description = null, string language = null, Dictionary metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List intents = null, List entities = null, List dialogNodes = null, List counterexamples = null, bool? append = null, List webhooks = null) + public bool UpdateWorkspace(Callback callback, string workspaceId, string name = null, string description = null, string language = null, Dictionary metadata = null, bool? learningOptOut = null, WorkspaceSystemSettings systemSettings = null, List intents = null, List entities = null, List dialogNodes = null, List counterexamples = null, List webhooks = null, bool? append = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateWorkspace`"); @@ -553,6 +565,10 @@ public bool UpdateWorkspace(Callback callback, string workspaceId, st { req.Parameters["append"] = (bool)append ? "true" : "false"; } + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -585,6 +601,7 @@ public bool UpdateWorkspace(Callback callback, string workspaceId, st Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -654,6 +671,7 @@ public bool DeleteWorkspace(Callback callback, string workspaceId) Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -753,6 +771,7 @@ public bool ListIntents(Callback callback, string workspaceId, Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -798,8 +817,10 @@ private void OnListIntentsResponse(RESTConnector.Request req, RESTConnector.Resp /// The description of the intent. This string cannot contain carriage return, /// newline, or tab characters. (optional) /// An array of user input examples for the intent. (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Intent - public bool CreateIntent(Callback callback, string workspaceId, string intent, string description = null, List examples = null) + public bool CreateIntent(Callback callback, string workspaceId, string intent, string description = null, List examples = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateIntent`"); @@ -828,6 +849,10 @@ public bool CreateIntent(Callback callback, string workspaceId, string i } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -844,6 +869,7 @@ public bool CreateIntent(Callback callback, string workspaceId, string i Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -930,6 +956,7 @@ public bool GetIntent(Callback callback, string workspaceId, string inte Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -977,8 +1004,17 @@ private void OnGetIntentResponse(RESTConnector.Request req, RESTConnector.Respon /// The description of the intent. This string cannot contain carriage return, /// newline, or tab characters. (optional) /// An array of user input examples for the intent. (optional) + /// Whether the new data is to be appended to the existing data in the object. If + /// **append**=`false`, elements included in the new data completely replace the corresponding existing + /// elements, including all subelements. For example, if the new data for the intent includes **examples** and + /// **append**=`false`, all existing examples for the intent are discarded and replaced with the new examples. + /// + /// If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in + /// the new data collide with existing elements, the update request fails. (optional, default to false) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Intent - public bool UpdateIntent(Callback callback, string workspaceId, string intent, string newIntent = null, string newDescription = null, List newExamples = null) + public bool UpdateIntent(Callback callback, string workspaceId, string intent, string newIntent = null, string newDescription = null, List newExamples = null, bool? append = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateIntent`"); @@ -1007,6 +1043,14 @@ public bool UpdateIntent(Callback callback, string workspaceId, string i } req.Parameters["version"] = VersionDate; + if (append != null) + { + req.Parameters["append"] = (bool)append ? "true" : "false"; + } + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -1023,6 +1067,7 @@ public bool UpdateIntent(Callback callback, string workspaceId, string i Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1095,6 +1140,7 @@ public bool DeleteIntent(Callback callback, string workspaceId, string i Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1189,6 +1235,7 @@ public bool ListExamples(Callback callback, string workspaceI Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}/examples", workspaceId, intent); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1233,8 +1280,10 @@ private void OnListExamplesResponse(RESTConnector.Request req, RESTConnector.Res /// - It cannot contain carriage return, newline, or tab characters. /// - It cannot consist of only whitespace characters. /// An array of contextual entity mentions. (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Example - public bool CreateExample(Callback callback, string workspaceId, string intent, string text, List mentions = null) + public bool CreateExample(Callback callback, string workspaceId, string intent, string text, List mentions = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateExample`"); @@ -1265,6 +1314,10 @@ public bool CreateExample(Callback callback, string workspaceId, string } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -1279,6 +1332,7 @@ public bool CreateExample(Callback callback, string workspaceId, string Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}/examples", workspaceId, intent); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1360,6 +1414,7 @@ public bool GetExample(Callback callback, string workspaceId, string in Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1406,8 +1461,10 @@ private void OnGetExampleResponse(RESTConnector.Request req, RESTConnector.Respo /// - It cannot contain carriage return, newline, or tab characters. /// - It cannot consist of only whitespace characters. (optional) /// An array of contextual entity mentions. (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Example - public bool UpdateExample(Callback callback, string workspaceId, string intent, string text, string newText = null, List newMentions = null) + public bool UpdateExample(Callback callback, string workspaceId, string intent, string text, string newText = null, List newMentions = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateExample`"); @@ -1438,6 +1495,10 @@ public bool UpdateExample(Callback callback, string workspaceId, string } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -1452,6 +1513,7 @@ public bool UpdateExample(Callback callback, string workspaceId, string Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1527,6 +1589,7 @@ public bool DeleteExample(Callback callback, string workspaceId, string Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1619,6 +1682,7 @@ public bool ListCounterexamples(Callback callback, str Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/counterexamples", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1663,8 +1727,10 @@ private void OnListCounterexamplesResponse(RESTConnector.Request req, RESTConnec /// following restrictions: /// - It cannot contain carriage return, newline, or tab characters. /// - It cannot consist of only whitespace characters. + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Counterexample - public bool CreateCounterexample(Callback callback, string workspaceId, string text) + public bool CreateCounterexample(Callback callback, string workspaceId, string text, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateCounterexample`"); @@ -1693,6 +1759,10 @@ public bool CreateCounterexample(Callback callback, string works } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -1705,6 +1775,7 @@ public bool CreateCounterexample(Callback callback, string works Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/counterexamples", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1784,6 +1855,7 @@ public bool GetCounterexample(Callback callback, string workspac Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1828,8 +1900,10 @@ private void OnGetCounterexampleResponse(RESTConnector.Request req, RESTConnecto /// following restrictions: /// - It cannot contain carriage return, newline, or tab characters. /// - It cannot consist of only whitespace characters. (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Counterexample - public bool UpdateCounterexample(Callback callback, string workspaceId, string text, string newText = null) + public bool UpdateCounterexample(Callback callback, string workspaceId, string text, string newText = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateCounterexample`"); @@ -1858,6 +1932,10 @@ public bool UpdateCounterexample(Callback callback, string works } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -1870,6 +1948,7 @@ public bool UpdateCounterexample(Callback callback, string works Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -1943,6 +2022,7 @@ public bool DeleteCounterexample(Callback callback, string workspaceId, Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2042,6 +2122,7 @@ public bool ListEntities(Callback callback, string workspaceId Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2090,8 +2171,10 @@ private void OnListEntitiesResponse(RESTConnector.Request req, RESTConnector.Res /// Any metadata related to the entity. (optional) /// Whether to use fuzzy matching for the entity. (optional) /// An array of objects describing the entity values. (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Entity - public bool CreateEntity(Callback callback, string workspaceId, string entity, string description = null, Dictionary metadata = null, bool? fuzzyMatch = null, List values = null) + public bool CreateEntity(Callback callback, string workspaceId, string entity, string description = null, Dictionary metadata = null, bool? fuzzyMatch = null, List values = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateEntity`"); @@ -2120,6 +2203,10 @@ public bool CreateEntity(Callback callback, string workspaceId, string e } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -2140,6 +2227,7 @@ public bool CreateEntity(Callback callback, string workspaceId, string e Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2226,6 +2314,7 @@ public bool GetEntity(Callback callback, string workspaceId, string enti Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2275,8 +2364,17 @@ private void OnGetEntityResponse(RESTConnector.Request req, RESTConnector.Respon /// Any metadata related to the entity. (optional) /// Whether to use fuzzy matching for the entity. (optional) /// An array of objects describing the entity values. (optional) + /// Whether the new data is to be appended to the existing data in the entity. If + /// **append**=`false`, elements included in the new data completely replace the corresponding existing + /// elements, including all subelements. For example, if the new data for the entity includes **values** and + /// **append**=`false`, all existing values for the entity are discarded and replaced with the new values. + /// + /// If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in + /// the new data collide with existing elements, the update request fails. (optional, default to false) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Entity - public bool UpdateEntity(Callback callback, string workspaceId, string entity, string newEntity = null, string newDescription = null, Dictionary newMetadata = null, bool? newFuzzyMatch = null, List newValues = null) + public bool UpdateEntity(Callback callback, string workspaceId, string entity, string newEntity = null, string newDescription = null, Dictionary newMetadata = null, bool? newFuzzyMatch = null, List newValues = null, bool? append = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateEntity`"); @@ -2305,6 +2403,14 @@ public bool UpdateEntity(Callback callback, string workspaceId, string e } req.Parameters["version"] = VersionDate; + if (append != null) + { + req.Parameters["append"] = (bool)append ? "true" : "false"; + } + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -2325,6 +2431,7 @@ public bool UpdateEntity(Callback callback, string workspaceId, string e Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2397,6 +2504,7 @@ public bool DeleteEntity(Callback callback, string workspaceId, string e Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2483,6 +2591,7 @@ public bool ListMentions(Callback callback, string work Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/mentions", workspaceId, entity); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2584,6 +2693,7 @@ public bool ListValues(Callback callback, string workspaceId, s Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values", workspaceId, entity); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2636,10 +2746,12 @@ private void OnListValuesResponse(RESTConnector.Request req, RESTConnector.Respo /// An array of patterns for the entity value. A value can specify either synonyms or /// patterns (depending on the value type), but not both. A pattern is a regular expression; for more /// information about how to specify a pattern, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-create-dictionary-based). /// (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Value - public bool CreateValue(Callback callback, string workspaceId, string entity, string value, Dictionary metadata = null, string type = null, List synonyms = null, List patterns = null) + public bool CreateValue(Callback callback, string workspaceId, string entity, string value, Dictionary metadata = null, string type = null, List synonyms = null, List patterns = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateValue`"); @@ -2670,6 +2782,10 @@ public bool CreateValue(Callback callback, string workspaceId, string ent } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -2690,6 +2806,7 @@ public bool CreateValue(Callback callback, string workspaceId, string ent Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values", workspaceId, entity); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2778,6 +2895,7 @@ public bool GetValue(Callback callback, string workspaceId, string entity Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2832,10 +2950,20 @@ private void OnGetValueResponse(RESTConnector.Request req, RESTConnector.Respons /// An array of patterns for the entity value. A value can specify either synonyms or /// patterns (depending on the value type), but not both. A pattern is a regular expression; for more /// information about how to specify a pattern, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-create-dictionary-based). /// (optional) + /// Whether the new data is to be appended to the existing data in the entity value. If + /// **append**=`false`, elements included in the new data completely replace the corresponding existing + /// elements, including all subelements. For example, if the new data for the entity value includes **synonyms** + /// and **append**=`false`, all existing synonyms for the entity value are discarded and replaced with the new + /// synonyms. + /// + /// If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in + /// the new data collide with existing elements, the update request fails. (optional, default to false) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Value - public bool UpdateValue(Callback callback, string workspaceId, string entity, string value, string newValue = null, Dictionary newMetadata = null, string newType = null, List newSynonyms = null, List newPatterns = null) + public bool UpdateValue(Callback callback, string workspaceId, string entity, string value, string newValue = null, Dictionary newMetadata = null, string newType = null, List newSynonyms = null, List newPatterns = null, bool? append = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateValue`"); @@ -2866,6 +2994,14 @@ public bool UpdateValue(Callback callback, string workspaceId, string ent } req.Parameters["version"] = VersionDate; + if (append != null) + { + req.Parameters["append"] = (bool)append ? "true" : "false"; + } + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -2886,6 +3022,7 @@ public bool UpdateValue(Callback callback, string workspaceId, string ent Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -2961,6 +3098,7 @@ public bool DeleteValue(Callback callback, string workspaceId, string en Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3058,6 +3196,7 @@ public bool ListSynonyms(Callback callback, string workspaceI Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms", workspaceId, entity, value); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3102,8 +3241,10 @@ private void OnListSynonymsResponse(RESTConnector.Request req, RESTConnector.Res /// The text of the synonym. This string must conform to the following restrictions: /// - It cannot contain carriage return, newline, or tab characters. /// - It cannot consist of only whitespace characters. + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Synonym - public bool CreateSynonym(Callback callback, string workspaceId, string entity, string value, string synonym) + public bool CreateSynonym(Callback callback, string workspaceId, string entity, string value, string synonym, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateSynonym`"); @@ -3136,6 +3277,10 @@ public bool CreateSynonym(Callback callback, string workspaceId, string } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -3148,6 +3293,7 @@ public bool CreateSynonym(Callback callback, string workspaceId, string Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms", workspaceId, entity, value); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3232,6 +3378,7 @@ public bool GetSynonym(Callback callback, string workspaceId, string en Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3277,8 +3424,10 @@ private void OnGetSynonymResponse(RESTConnector.Request req, RESTConnector.Respo /// The text of the synonym. This string must conform to the following restrictions: /// - It cannot contain carriage return, newline, or tab characters. /// - It cannot consist of only whitespace characters. (optional) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// Synonym - public bool UpdateSynonym(Callback callback, string workspaceId, string entity, string value, string synonym, string newSynonym = null) + public bool UpdateSynonym(Callback callback, string workspaceId, string entity, string value, string synonym, string newSynonym = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateSynonym`"); @@ -3311,6 +3460,10 @@ public bool UpdateSynonym(Callback callback, string workspaceId, string } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -3323,6 +3476,7 @@ public bool UpdateSynonym(Callback callback, string workspaceId, string Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3401,6 +3555,7 @@ public bool DeleteSynonym(Callback callback, string workspaceId, string Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3492,6 +3647,7 @@ public bool ListDialogNodes(Callback callback, string work Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/dialog_nodes", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3543,7 +3699,7 @@ private void OnListDialogNodesResponse(RESTConnector.Request req, RESTConnector. /// dialog node has no previous sibling. (optional) /// The output of the dialog node. For more information about how to specify dialog node /// output, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses). /// (optional) /// The context for the dialog node. (optional) /// The metadata for the dialog node. (optional) @@ -3565,8 +3721,10 @@ private void OnListDialogNodesResponse(RESTConnector.Request req, RESTConnector. /// users. (optional) /// Whether the dialog node should be excluded from disambiguation /// suggestions. (optional, default to false) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// DialogNode - public bool CreateDialogNode(Callback callback, string workspaceId, string dialogNode, string description = null, string conditions = null, string parent = null, string previousSibling = null, DialogNodeOutput output = null, Dictionary context = null, Dictionary metadata = null, DialogNodeNextStep nextStep = null, string title = null, string type = null, string eventName = null, string variable = null, List actions = null, string digressIn = null, string digressOut = null, string digressOutSlots = null, string userLabel = null, bool? disambiguationOptOut = null) + public bool CreateDialogNode(Callback callback, string workspaceId, string dialogNode, string description = null, string conditions = null, string parent = null, string previousSibling = null, DialogNodeOutput output = null, Dictionary context = null, Dictionary metadata = null, DialogNodeNextStep nextStep = null, string title = null, string type = null, string eventName = null, string variable = null, List actions = null, string digressIn = null, string digressOut = null, string digressOutSlots = null, string userLabel = null, bool? disambiguationOptOut = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateDialogNode`"); @@ -3595,6 +3753,10 @@ public bool CreateDialogNode(Callback callback, string workspaceId, } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -3643,6 +3805,7 @@ public bool CreateDialogNode(Callback callback, string workspaceId, Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/dialog_nodes", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3721,6 +3884,7 @@ public bool GetDialogNode(Callback callback, string workspaceId, str Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3774,7 +3938,7 @@ private void OnGetDialogNodeResponse(RESTConnector.Request req, RESTConnector.Re /// dialog node has no previous sibling. (optional) /// The output of the dialog node. For more information about how to specify dialog node /// output, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses). /// (optional) /// The context for the dialog node. (optional) /// The metadata for the dialog node. (optional) @@ -3797,8 +3961,10 @@ private void OnGetDialogNodeResponse(RESTConnector.Request req, RESTConnector.Re /// users. (optional) /// Whether the dialog node should be excluded from disambiguation /// suggestions. (optional, default to false) + /// Whether to include the audit properties (`created` and `updated` timestamps) in + /// the response. (optional, default to false) /// DialogNode - public bool UpdateDialogNode(Callback callback, string workspaceId, string dialogNode, string newDialogNode = null, string newDescription = null, string newConditions = null, string newParent = null, string newPreviousSibling = null, DialogNodeOutput newOutput = null, Dictionary newContext = null, Dictionary newMetadata = null, DialogNodeNextStep newNextStep = null, string newTitle = null, string newType = null, string newEventName = null, string newVariable = null, List newActions = null, string newDigressIn = null, string newDigressOut = null, string newDigressOutSlots = null, string newUserLabel = null, bool? newDisambiguationOptOut = null) + public bool UpdateDialogNode(Callback callback, string workspaceId, string dialogNode, string newDialogNode = null, string newDescription = null, string newConditions = null, string newParent = null, string newPreviousSibling = null, DialogNodeOutput newOutput = null, Dictionary newContext = null, Dictionary newMetadata = null, DialogNodeNextStep newNextStep = null, string newTitle = null, string newType = null, string newEventName = null, string newVariable = null, List newActions = null, string newDigressIn = null, string newDigressOut = null, string newDigressOutSlots = null, string newUserLabel = null, bool? newDisambiguationOptOut = null, bool? includeAudit = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateDialogNode`"); @@ -3827,6 +3993,10 @@ public bool UpdateDialogNode(Callback callback, string workspaceId, } req.Parameters["version"] = VersionDate; + if (includeAudit != null) + { + req.Parameters["include_audit"] = (bool)includeAudit ? "true" : "false"; + } req.Headers["Content-Type"] = "application/json"; req.Headers["Accept"] = "application/json"; @@ -3875,6 +4045,7 @@ public bool UpdateDialogNode(Callback callback, string workspaceId, Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3947,6 +4118,7 @@ public bool DeleteDialogNode(Callback callback, string workspaceId, stri Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -3988,7 +4160,7 @@ private void OnDeleteDialogNodeResponse(RESTConnector.Request req, RESTConnector /// the sort order, prefix the parameter value with a minus sign (`-`). (optional) /// A cacheable parameter that limits the results to those matching the specified filter. /// For more information, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-filter-reference#filter-reference). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-filter-reference#filter-reference). /// (optional) /// The number of records to return in each page of results. (optional) /// A token identifying the page of results to retrieve. (optional) @@ -4041,6 +4213,7 @@ public bool ListLogs(Callback callback, string workspaceId, strin Connector.URL = GetServiceUrl() + string.Format("/v1/workspaces/{0}/logs", workspaceId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -4081,7 +4254,7 @@ private void OnListLogsResponse(RESTConnector.Request req, RESTConnector.Respons /// You must specify a filter query that includes a value for `language`, as well as a value for /// `request.context.system.assistant_id`, `workspace_id`, or `request.context.metadata.deployment`. For more /// information, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-filter-reference#filter-reference). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-filter-reference#filter-reference). /// How to sort the returned log events. You can sort by **request_timestamp**. To reverse /// the sort order, prefix the parameter value with a minus sign (`-`). (optional) /// The number of records to return in each page of results. (optional) @@ -4135,6 +4308,7 @@ public bool ListAllLogs(Callback callback, string filter, string Connector.URL = GetServiceUrl() + "/v1/logs"; Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -4170,7 +4344,7 @@ private void OnListAllLogsResponse(RESTConnector.Request req, RESTConnector.Resp /// /// You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes /// data. For more information about personal data and customer IDs, see [Information - /// security](https://cloud.ibm.com/docs/services/assistant?topic=assistant-information-security#information-security). + /// security](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security). /// /// This operation is limited to 4 requests per minute. For more information, see **Rate limiting**. /// @@ -4213,6 +4387,7 @@ public bool DeleteUserData(Callback callback, string customerId) Connector.URL = GetServiceUrl() + "/v1/user_data"; Authenticator.Authenticate(Connector); + return Connector.Send(req); } diff --git a/Scripts/Services/Assistant/V1/Model/CreateValue.cs b/Scripts/Services/Assistant/V1/Model/CreateValue.cs index da779b100..352ff9583 100644 --- a/Scripts/Services/Assistant/V1/Model/CreateValue.cs +++ b/Scripts/Services/Assistant/V1/Model/CreateValue.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public class TypeValue /// An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the /// value type), but not both. A pattern is a regular expression; for more information about how to specify a /// pattern, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-create-dictionary-based). /// [JsonProperty("patterns", NullValueHandling = NullValueHandling.Ignore)] public List Patterns { get; set; } diff --git a/Scripts/Services/Assistant/V1/Model/DialogNode.cs b/Scripts/Services/Assistant/V1/Model/DialogNode.cs index 7525d1259..90e47fcf0 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogNode.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogNode.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -222,7 +222,7 @@ public class DigressOutSlotsValue public string PreviousSibling { get; set; } /// /// The output of the dialog node. For more information about how to specify dialog node output, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses). /// [JsonProperty("output", NullValueHandling = NullValueHandling.Ignore)] public DialogNodeOutput Output { get; set; } diff --git a/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs b/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs index f32c12c05..19e8f76e9 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ namespace IBM.Watson.Assistant.V1.Model { /// /// The output of the dialog node. For more information about how to specify dialog node output, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses). /// public class DialogNodeOutput: DynamicModel { diff --git a/Scripts/Services/Assistant/V1/Model/RuntimeEntity.cs b/Scripts/Services/Assistant/V1/Model/RuntimeEntity.cs index b14e57024..19795f1ee 100644 --- a/Scripts/Services/Assistant/V1/Model/RuntimeEntity.cs +++ b/Scripts/Services/Assistant/V1/Model/RuntimeEntity.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,5 +56,21 @@ public class RuntimeEntity /// [JsonProperty("groups", NullValueHandling = NullValueHandling.Ignore)] public List Groups { get; set; } + /// + /// An object containing detailed information about the entity recognized in the user input. This property is + /// included only if the new system entities are enabled for the workspace. + /// + /// For more information about how the new system entities are interpreted, see the + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities). + /// + [JsonProperty("interpretation", NullValueHandling = NullValueHandling.Ignore)] + public RuntimeEntityInterpretation Interpretation { get; set; } + /// + /// An object describing the role played by a system entity that is specifies the beginning or end of a range + /// recognized in the user input. This property is included only if the new system entities are enabled for the + /// workspace. + /// + [JsonProperty("role", NullValueHandling = NullValueHandling.Ignore)] + public RuntimeEntityRole Role { get; set; } } } diff --git a/Scripts/Services/Assistant/V1/Model/RuntimeEntityInterpretation.cs b/Scripts/Services/Assistant/V1/Model/RuntimeEntityInterpretation.cs new file mode 100644 index 000000000..01736eda3 --- /dev/null +++ b/Scripts/Services/Assistant/V1/Model/RuntimeEntityInterpretation.cs @@ -0,0 +1,228 @@ +/** +* (C) Copyright IBM Corp. 2018, 2020. +* +* 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.V1.Model +{ + /// + /// RuntimeEntityInterpretation. + /// + public class RuntimeEntityInterpretation + { + /// + /// The precision or duration of a time range specified by a recognized `@sys-time` or `@sys-date` entity. + /// + public class GranularityValue + { + /// + /// Constant DAY for day + /// + public const string DAY = "day"; + /// + /// Constant FORTNIGHT for fortnight + /// + public const string FORTNIGHT = "fortnight"; + /// + /// Constant HOUR for hour + /// + public const string HOUR = "hour"; + /// + /// Constant INSTANT for instant + /// + public const string INSTANT = "instant"; + /// + /// Constant MINUTE for minute + /// + public const string MINUTE = "minute"; + /// + /// Constant MONTH for month + /// + public const string MONTH = "month"; + /// + /// Constant QUARTER for quarter + /// + public const string QUARTER = "quarter"; + /// + /// Constant SECOND for second + /// + public const string SECOND = "second"; + /// + /// Constant WEEK for week + /// + public const string WEEK = "week"; + /// + /// Constant WEEKEND for weekend + /// + public const string WEEKEND = "weekend"; + /// + /// Constant YEAR for year + /// + public const string YEAR = "year"; + + } + + /// + /// The precision or duration of a time range specified by a recognized `@sys-time` or `@sys-date` entity. + /// Constants for possible values can be found using RuntimeEntityInterpretation.GranularityValue + /// + [JsonProperty("granularity", NullValueHandling = NullValueHandling.Ignore)] + public string Granularity { get; set; } + /// + /// The calendar used to represent a recognized date (for example, `Gregorian`). + /// + [JsonProperty("calendar_type", NullValueHandling = NullValueHandling.Ignore)] + public string CalendarType { get; set; } + /// + /// A unique identifier used to associate a recognized time and date. If the user input contains a date and time + /// that are mentioned together (for example, `Today at 5`, the same **datetime_link** value is returned for + /// both the `@sys-date` and `@sys-time` entities). + /// + [JsonProperty("datetime_link", NullValueHandling = NullValueHandling.Ignore)] + public string DatetimeLink { get; set; } + /// + /// A locale-specific holiday name (such as `thanksgiving` or `christmas`). This property is included when a + /// `@sys-date` entity is recognized based on a holiday name in the user input. + /// + [JsonProperty("festival", NullValueHandling = NullValueHandling.Ignore)] + public string Festival { get; set; } + /// + /// A unique identifier used to associate multiple recognized `@sys-date`, `@sys-time`, or `@sys-number` + /// entities that are recognized as a range of values in the user's input (for example, `from July 4 until July + /// 14` or `from 20 to 25`). + /// + [JsonProperty("range_link", NullValueHandling = NullValueHandling.Ignore)] + public string RangeLink { get; set; } + /// + /// The word in the user input that indicates that a `sys-date` or `sys-time` entity is part of an implied range + /// where only one date or time is specified (for example, `since` or `until`). + /// + [JsonProperty("range_modifier", NullValueHandling = NullValueHandling.Ignore)] + public string RangeModifier { get; set; } + /// + /// A recognized mention of a relative day, represented numerically as an offset from the current date (for + /// example, `-1` for `yesterday` or `10` for `in ten days`). + /// + [JsonProperty("relative_day", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeDay { get; set; } + /// + /// A recognized mention of a relative month, represented numerically as an offset from the current month (for + /// example, `1` for `next month` or `-3` for `three months ago`). + /// + [JsonProperty("relative_month", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeMonth { get; set; } + /// + /// A recognized mention of a relative week, represented numerically as an offset from the current week (for + /// example, `2` for `in two weeks` or `-1` for `last week). + /// + [JsonProperty("relative_week", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeWeek { get; set; } + /// + /// A recognized mention of a relative date range for a weekend, represented numerically as an offset from the + /// current weekend (for example, `0` for `this weekend` or `-1` for `last weekend`). + /// + [JsonProperty("relative_weekend", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeWeekend { get; set; } + /// + /// A recognized mention of a relative year, represented numerically as an offset from the current year (for + /// example, `1` for `next year` or `-5` for `five years ago`). + /// + [JsonProperty("relative_year", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeYear { get; set; } + /// + /// A recognized mention of a specific date, represented numerically as the date within the month (for example, + /// `30` for `June 30`.). + /// + [JsonProperty("specific_day", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificDay { get; set; } + /// + /// A recognized mention of a specific day of the week as a lowercase string (for example, `monday`). + /// + [JsonProperty("specific_day_of_week", NullValueHandling = NullValueHandling.Ignore)] + public string SpecificDayOfWeek { get; set; } + /// + /// A recognized mention of a specific month, represented numerically (for example, `7` for `July`). + /// + [JsonProperty("specific_month", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificMonth { get; set; } + /// + /// A recognized mention of a specific quarter, represented numerically (for example, `3` for `the third + /// quarter`). + /// + [JsonProperty("specific_quarter", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificQuarter { get; set; } + /// + /// A recognized mention of a specific year (for example, `2016`). + /// + [JsonProperty("specific_year", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificYear { get; set; } + /// + /// A recognized numeric value, represented as an integer or double. + /// + [JsonProperty("numeric_value", NullValueHandling = NullValueHandling.Ignore)] + public float? NumericValue { get; set; } + /// + /// The type of numeric value recognized in the user input (`integer` or `rational`). + /// + [JsonProperty("subtype", NullValueHandling = NullValueHandling.Ignore)] + public string Subtype { get; set; } + /// + /// A recognized term for a time that was mentioned as a part of the day in the user's input (for example, + /// `morning` or `afternoon`). + /// + [JsonProperty("part_of_day", NullValueHandling = NullValueHandling.Ignore)] + public string PartOfDay { get; set; } + /// + /// A recognized mention of a relative hour, represented numerically as an offset from the current hour (for + /// example, `3` for `in three hours` or `-1` for `an hour ago`). + /// + [JsonProperty("relative_hour", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeHour { get; set; } + /// + /// A recognized mention of a relative time, represented numerically as an offset in minutes from the current + /// time (for example, `5` for `in five minutes` or `-15` for `fifteen minutes ago`). + /// + [JsonProperty("relative_minute", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeMinute { get; set; } + /// + /// A recognized mention of a relative time, represented numerically as an offset in seconds from the current + /// time (for example, `10` for `in ten seconds` or `-30` for `thirty seconds ago`). + /// + [JsonProperty("relative_second", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeSecond { get; set; } + /// + /// A recognized specific hour mentioned as part of a time value (for example, `10` for `10:15 AM`.). + /// + [JsonProperty("specific_hour", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificHour { get; set; } + /// + /// A recognized specific minute mentioned as part of a time value (for example, `15` for `10:15 AM`.). + /// + [JsonProperty("specific_minute", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificMinute { get; set; } + /// + /// A recognized specific second mentioned as part of a time value (for example, `30` for `10:15:30 AM`.). + /// + [JsonProperty("specific_second", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificSecond { get; set; } + /// + /// A recognized time zone mentioned as part of a time value (for example, `EST`). + /// + [JsonProperty("timezone", NullValueHandling = NullValueHandling.Ignore)] + public string Timezone { get; set; } + } +} diff --git a/Scripts/Services/Assistant/V1/Model/RuntimeEntityInterpretation.cs.meta b/Scripts/Services/Assistant/V1/Model/RuntimeEntityInterpretation.cs.meta new file mode 100644 index 000000000..13eb1fa8d --- /dev/null +++ b/Scripts/Services/Assistant/V1/Model/RuntimeEntityInterpretation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ebc834e6eff084bdabeb94a594c58f1c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Services/Assistant/V1/Model/RuntimeEntityRole.cs b/Scripts/Services/Assistant/V1/Model/RuntimeEntityRole.cs new file mode 100644 index 000000000..e5e5a64ad --- /dev/null +++ b/Scripts/Services/Assistant/V1/Model/RuntimeEntityRole.cs @@ -0,0 +1,68 @@ +/** +* (C) Copyright IBM Corp. 2018, 2020. +* +* 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.V1.Model +{ + /// + /// An object describing the role played by a system entity that is specifies the beginning or end of a range + /// recognized in the user input. This property is included only if the new system entities are enabled for the + /// workspace. + /// + public class RuntimeEntityRole + { + /// + /// The relationship of the entity to the range. + /// + public class TypeValue + { + /// + /// Constant DATE_FROM for date_from + /// + public const string DATE_FROM = "date_from"; + /// + /// Constant DATE_TO for date_to + /// + public const string DATE_TO = "date_to"; + /// + /// Constant NUMBER_FROM for number_from + /// + public const string NUMBER_FROM = "number_from"; + /// + /// Constant NUMBER_TO for number_to + /// + public const string NUMBER_TO = "number_to"; + /// + /// Constant TIME_FROM for time_from + /// + public const string TIME_FROM = "time_from"; + /// + /// Constant TIME_TO for time_to + /// + public const string TIME_TO = "time_to"; + + } + + /// + /// The relationship of the entity to the range. + /// Constants for possible values can be found using RuntimeEntityRole.TypeValue + /// + [JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)] + public string Type { get; set; } + } +} diff --git a/Scripts/Services/Assistant/V1/Model/RuntimeEntityRole.cs.meta b/Scripts/Services/Assistant/V1/Model/RuntimeEntityRole.cs.meta new file mode 100644 index 000000000..16e5cc77c --- /dev/null +++ b/Scripts/Services/Assistant/V1/Model/RuntimeEntityRole.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 63366a64066984a1a9e82b08cdca476e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Services/Assistant/V1/Model/Value.cs b/Scripts/Services/Assistant/V1/Model/Value.cs index 2e4f9cc25..4521e4ce3 100644 --- a/Scripts/Services/Assistant/V1/Model/Value.cs +++ b/Scripts/Services/Assistant/V1/Model/Value.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public class TypeValue /// An array of patterns for the entity value. A value can specify either synonyms or patterns (depending on the /// value type), but not both. A pattern is a regular expression; for more information about how to specify a /// pattern, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-entities#entities-create-dictionary-based). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-create-dictionary-based). /// [JsonProperty("patterns", NullValueHandling = NullValueHandling.Ignore)] public List Patterns { get; set; } diff --git a/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettings.cs b/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettings.cs index e5a8c0108..198ca84d2 100644 --- a/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettings.cs +++ b/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettings.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,11 @@ public class WorkspaceSystemSettings [JsonProperty("human_agent_assist", NullValueHandling = NullValueHandling.Ignore)] public Dictionary HumanAgentAssist { get; set; } /// + /// Workspace settings related to the behavior of system entities. + /// + [JsonProperty("system_entities", NullValueHandling = NullValueHandling.Ignore)] + public WorkspaceSystemSettingsSystemEntities SystemEntities { get; set; } + /// /// Workspace settings related to detection of irrelevant input. /// [JsonProperty("off_topic", NullValueHandling = NullValueHandling.Ignore)] diff --git a/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettingsSystemEntities.cs b/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettingsSystemEntities.cs new file mode 100644 index 000000000..fdaad8d3b --- /dev/null +++ b/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettingsSystemEntities.cs @@ -0,0 +1,33 @@ +/** +* (C) Copyright IBM Corp. 2018, 2020. +* +* 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.V1.Model +{ + /// + /// Workspace settings related to the behavior of system entities. + /// + public class WorkspaceSystemSettingsSystemEntities + { + /// + /// Whether the new system entities are enabled for the workspace. + /// + [JsonProperty("enabled", NullValueHandling = NullValueHandling.Ignore)] + public bool? Enabled { get; set; } + } +} diff --git a/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettingsSystemEntities.cs.meta b/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettingsSystemEntities.cs.meta new file mode 100644 index 000000000..2ffc334c3 --- /dev/null +++ b/Scripts/Services/Assistant/V1/Model/WorkspaceSystemSettingsSystemEntities.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 548a5644d38f94708b6d5c6188148f7b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Services/Assistant/V2/AssistantService.cs b/Scripts/Services/Assistant/V2/AssistantService.cs index 1ead7e354..ecd9dc658 100644 --- a/Scripts/Services/Assistant/V2/AssistantService.cs +++ b/Scripts/Services/Assistant/V2/AssistantService.cs @@ -72,6 +72,7 @@ public AssistantService(string versionDate) : this(versionDate, ConfigBasedAuthe public AssistantService(string versionDate, Authenticator authenticator) : base(versionDate, authenticator, serviceId) { Authenticator = authenticator; + if (string.IsNullOrEmpty(versionDate)) { throw new ArgumentNullException("A versionDate (format `yyyy-mm-dd`) is required to create an instance of AssistantService"); @@ -81,7 +82,6 @@ public AssistantService(string versionDate, Authenticator authenticator) : base( VersionDate = versionDate; } - if (string.IsNullOrEmpty(GetServiceUrl())) { SetServiceUrl(defaultServiceUrl); @@ -94,13 +94,13 @@ public AssistantService(string versionDate, Authenticator authenticator) : base( /// Create a new session. A session is used to send user input to a skill and receive responses. It also /// maintains the state of the conversation. A session persists until it is deleted, or until it times out /// because of inactivity. (For more information, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-assistant-settings). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings). /// /// The callback function that is invoked when the operation completes. /// Unique identifier of the assistant. To find the assistant ID in the Watson /// Assistant user interface, open the assistant settings and click **API Details**. For information about /// creating assistants, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-assistant-add#assistant-add-task). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task). /// /// **Note:** Currently, the v2 API does not support creating assistants. /// SessionResponse @@ -136,6 +136,7 @@ public bool CreateSession(Callback callback, string assistantId Connector.URL = GetServiceUrl() + string.Format("/v2/assistants/{0}/sessions", assistantId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -167,14 +168,13 @@ private void OnCreateSessionResponse(RESTConnector.Request req, RESTConnector.Re /// Delete session. /// /// Deletes a session explicitly before it times out. (For more information about the session inactivity - /// timeout, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-assistant-settings)). + /// timeout, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings)). /// /// The callback function that is invoked when the operation completes. /// Unique identifier of the assistant. To find the assistant ID in the Watson /// Assistant user interface, open the assistant settings and click **API Details**. For information about /// creating assistants, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-assistant-add#assistant-add-task). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task). /// /// **Note:** Currently, the v2 API does not support creating assistants. /// Unique identifier of the session. @@ -213,6 +213,7 @@ public bool DeleteSession(Callback callback, string assistantId, string Connector.URL = GetServiceUrl() + string.Format("/v2/assistants/{0}/sessions/{1}", assistantId, sessionId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } @@ -251,7 +252,7 @@ private void OnDeleteSessionResponse(RESTConnector.Request req, RESTConnector.Re /// Unique identifier of the assistant. To find the assistant ID in the Watson /// Assistant user interface, open the assistant settings and click **API Details**. For information about /// creating assistants, see the - /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-assistant-add#assistant-add-task). + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-add#assistant-add-task). /// /// **Note:** Currently, the v2 API does not support creating assistants. /// Unique identifier of the session. @@ -303,6 +304,7 @@ public bool Message(Callback callback, string assistantId, stri Connector.URL = GetServiceUrl() + string.Format("/v2/assistants/{0}/sessions/{1}/message", assistantId, sessionId); Authenticator.Authenticate(Connector); + return Connector.Send(req); } diff --git a/Scripts/Services/Assistant/V2/Model/MessageContextGlobalSystem.cs b/Scripts/Services/Assistant/V2/Model/MessageContextGlobalSystem.cs index 38b74fd4b..f8f58d87a 100644 --- a/Scripts/Services/Assistant/V2/Model/MessageContextGlobalSystem.cs +++ b/Scripts/Services/Assistant/V2/Model/MessageContextGlobalSystem.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,88 @@ namespace IBM.Watson.Assistant.V2.Model /// public class MessageContextGlobalSystem { + /// + /// The language code for localization in the user input. The specified locale overrides the default for the + /// assistant, and is used for interpreting entity values in user input such as date values. For example, + /// `04/03/2018` might be interpreted either as April 3 or March 4, depending on the locale. + /// + /// This property is included only if the new system entities are enabled for the skill. + /// + public class LocaleValue + { + /// + /// Constant EN_US for en-us + /// + public const string EN_US = "en-us"; + /// + /// Constant EN_CA for en-ca + /// + public const string EN_CA = "en-ca"; + /// + /// Constant EN_GB for en-gb + /// + public const string EN_GB = "en-gb"; + /// + /// Constant AR_AR for ar-ar + /// + public const string AR_AR = "ar-ar"; + /// + /// Constant CS_CZ for cs-cz + /// + public const string CS_CZ = "cs-cz"; + /// + /// Constant DE_DE for de-de + /// + public const string DE_DE = "de-de"; + /// + /// Constant ES_ES for es-es + /// + public const string ES_ES = "es-es"; + /// + /// Constant FR_FR for fr-fr + /// + public const string FR_FR = "fr-fr"; + /// + /// Constant IT_IT for it-it + /// + public const string IT_IT = "it-it"; + /// + /// Constant JA_JP for ja-jp + /// + public const string JA_JP = "ja-jp"; + /// + /// Constant KO_KR for ko-kr + /// + public const string KO_KR = "ko-kr"; + /// + /// Constant NL_NL for nl-nl + /// + public const string NL_NL = "nl-nl"; + /// + /// Constant PT_BR for pt-br + /// + public const string PT_BR = "pt-br"; + /// + /// Constant ZH_CN for zh-cn + /// + public const string ZH_CN = "zh-cn"; + /// + /// Constant ZH_TW for zh-tw + /// + public const string ZH_TW = "zh-tw"; + + } + + /// + /// The language code for localization in the user input. The specified locale overrides the default for the + /// assistant, and is used for interpreting entity values in user input such as date values. For example, + /// `04/03/2018` might be interpreted either as April 3 or March 4, depending on the locale. + /// + /// This property is included only if the new system entities are enabled for the skill. + /// Constants for possible values can be found using MessageContextGlobalSystem.LocaleValue + /// + [JsonProperty("locale", NullValueHandling = NullValueHandling.Ignore)] + public string Locale { get; set; } /// /// The user time zone. The assistant uses the time zone to correctly resolve relative time references. /// @@ -44,5 +126,18 @@ public class MessageContextGlobalSystem /// [JsonProperty("turn_count", NullValueHandling = NullValueHandling.Ignore)] public long? TurnCount { get; set; } + /// + /// The base time for interpreting any relative time mentions in the user input. The specified time overrides + /// the current server time, and is used to calculate times mentioned in relative terms such as `now` or + /// `tomorrow`. This can be useful for simulating past or future times for testing purposes, or when analyzing + /// documents such as news articles. + /// + /// This value must be a UTC time value formatted according to ISO 8601 (for example, `2019-06-26T12:00:00Z` for + /// noon on 26 June 2019. + /// + /// This property is included only if the new system entities are enabled for the skill. + /// + [JsonProperty("reference_time", NullValueHandling = NullValueHandling.Ignore)] + public string ReferenceTime { get; set; } } } diff --git a/Scripts/Services/Assistant/V2/Model/RuntimeEntity.cs b/Scripts/Services/Assistant/V2/Model/RuntimeEntity.cs index 97a1445f5..888144071 100644 --- a/Scripts/Services/Assistant/V2/Model/RuntimeEntity.cs +++ b/Scripts/Services/Assistant/V2/Model/RuntimeEntity.cs @@ -1,5 +1,5 @@ /** -* Copyright 2018, 2019 IBM Corp. All Rights Reserved. +* (C) Copyright IBM Corp. 2018, 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,5 +56,30 @@ public class RuntimeEntity /// [JsonProperty("groups", NullValueHandling = NullValueHandling.Ignore)] public List Groups { get; set; } + /// + /// An object containing detailed information about the entity recognized in the user input. This property is + /// included only if the new system entities are enabled for the skill. + /// + /// For more information about how the new system entities are interpreted, see the + /// [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-beta-system-entities). + /// + [JsonProperty("interpretation", NullValueHandling = NullValueHandling.Ignore)] + public RuntimeEntityInterpretation Interpretation { get; set; } + /// + /// An array of possible alternative values that the user might have intended instead of the value returned in + /// the **value** property. This property is returned only for `@sys-time` and `@sys-date` entities when the + /// user's input is ambiguous. + /// + /// This property is included only if the new system entities are enabled for the skill. + /// + [JsonProperty("alternatives", NullValueHandling = NullValueHandling.Ignore)] + public List Alternatives { get; set; } + /// + /// An object describing the role played by a system entity that is specifies the beginning or end of a range + /// recognized in the user input. This property is included only if the new system entities are enabled for the + /// skill. + /// + [JsonProperty("role", NullValueHandling = NullValueHandling.Ignore)] + public RuntimeEntityRole Role { get; set; } } } diff --git a/Scripts/Services/Assistant/V2/Model/RuntimeEntityAlternative.cs b/Scripts/Services/Assistant/V2/Model/RuntimeEntityAlternative.cs new file mode 100644 index 000000000..efa7c7d50 --- /dev/null +++ b/Scripts/Services/Assistant/V2/Model/RuntimeEntityAlternative.cs @@ -0,0 +1,38 @@ +/** +* (C) Copyright IBM Corp. 2018, 2020. +* +* 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 +{ + /// + /// An alternative value for the recognized entity. + /// + public class RuntimeEntityAlternative + { + /// + /// The entity value that was recognized in the user input. + /// + [JsonProperty("value", NullValueHandling = NullValueHandling.Ignore)] + public string Value { get; set; } + /// + /// A decimal percentage that represents Watson's confidence in the recognized entity. + /// + [JsonProperty("confidence", NullValueHandling = NullValueHandling.Ignore)] + public float? Confidence { get; set; } + } +} diff --git a/Scripts/Services/Assistant/V2/Model/RuntimeEntityAlternative.cs.meta b/Scripts/Services/Assistant/V2/Model/RuntimeEntityAlternative.cs.meta new file mode 100644 index 000000000..279e2d961 --- /dev/null +++ b/Scripts/Services/Assistant/V2/Model/RuntimeEntityAlternative.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf9b8650bea8440739e948e91cf6a900 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Services/Assistant/V2/Model/RuntimeEntityInterpretation.cs b/Scripts/Services/Assistant/V2/Model/RuntimeEntityInterpretation.cs new file mode 100644 index 000000000..344cfe6e8 --- /dev/null +++ b/Scripts/Services/Assistant/V2/Model/RuntimeEntityInterpretation.cs @@ -0,0 +1,228 @@ +/** +* (C) Copyright IBM Corp. 2018, 2020. +* +* 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 +{ + /// + /// RuntimeEntityInterpretation. + /// + public class RuntimeEntityInterpretation + { + /// + /// The precision or duration of a time range specified by a recognized `@sys-time` or `@sys-date` entity. + /// + public class GranularityValue + { + /// + /// Constant DAY for day + /// + public const string DAY = "day"; + /// + /// Constant FORTNIGHT for fortnight + /// + public const string FORTNIGHT = "fortnight"; + /// + /// Constant HOUR for hour + /// + public const string HOUR = "hour"; + /// + /// Constant INSTANT for instant + /// + public const string INSTANT = "instant"; + /// + /// Constant MINUTE for minute + /// + public const string MINUTE = "minute"; + /// + /// Constant MONTH for month + /// + public const string MONTH = "month"; + /// + /// Constant QUARTER for quarter + /// + public const string QUARTER = "quarter"; + /// + /// Constant SECOND for second + /// + public const string SECOND = "second"; + /// + /// Constant WEEK for week + /// + public const string WEEK = "week"; + /// + /// Constant WEEKEND for weekend + /// + public const string WEEKEND = "weekend"; + /// + /// Constant YEAR for year + /// + public const string YEAR = "year"; + + } + + /// + /// The precision or duration of a time range specified by a recognized `@sys-time` or `@sys-date` entity. + /// Constants for possible values can be found using RuntimeEntityInterpretation.GranularityValue + /// + [JsonProperty("granularity", NullValueHandling = NullValueHandling.Ignore)] + public string Granularity { get; set; } + /// + /// The calendar used to represent a recognized date (for example, `Gregorian`). + /// + [JsonProperty("calendar_type", NullValueHandling = NullValueHandling.Ignore)] + public string CalendarType { get; set; } + /// + /// A unique identifier used to associate a recognized time and date. If the user input contains a date and time + /// that are mentioned together (for example, `Today at 5`, the same **datetime_link** value is returned for + /// both the `@sys-date` and `@sys-time` entities). + /// + [JsonProperty("datetime_link", NullValueHandling = NullValueHandling.Ignore)] + public string DatetimeLink { get; set; } + /// + /// A locale-specific holiday name (such as `thanksgiving` or `christmas`). This property is included when a + /// `@sys-date` entity is recognized based on a holiday name in the user input. + /// + [JsonProperty("festival", NullValueHandling = NullValueHandling.Ignore)] + public string Festival { get; set; } + /// + /// A unique identifier used to associate multiple recognized `@sys-date`, `@sys-time`, or `@sys-number` + /// entities that are recognized as a range of values in the user's input (for example, `from July 4 until July + /// 14` or `from 20 to 25`). + /// + [JsonProperty("range_link", NullValueHandling = NullValueHandling.Ignore)] + public string RangeLink { get; set; } + /// + /// The word in the user input that indicates that a `sys-date` or `sys-time` entity is part of an implied range + /// where only one date or time is specified (for example, `since` or `until`). + /// + [JsonProperty("range_modifier", NullValueHandling = NullValueHandling.Ignore)] + public string RangeModifier { get; set; } + /// + /// A recognized mention of a relative day, represented numerically as an offset from the current date (for + /// example, `-1` for `yesterday` or `10` for `in ten days`). + /// + [JsonProperty("relative_day", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeDay { get; set; } + /// + /// A recognized mention of a relative month, represented numerically as an offset from the current month (for + /// example, `1` for `next month` or `-3` for `three months ago`). + /// + [JsonProperty("relative_month", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeMonth { get; set; } + /// + /// A recognized mention of a relative week, represented numerically as an offset from the current week (for + /// example, `2` for `in two weeks` or `-1` for `last week). + /// + [JsonProperty("relative_week", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeWeek { get; set; } + /// + /// A recognized mention of a relative date range for a weekend, represented numerically as an offset from the + /// current weekend (for example, `0` for `this weekend` or `-1` for `last weekend`). + /// + [JsonProperty("relative_weekend", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeWeekend { get; set; } + /// + /// A recognized mention of a relative year, represented numerically as an offset from the current year (for + /// example, `1` for `next year` or `-5` for `five years ago`). + /// + [JsonProperty("relative_year", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeYear { get; set; } + /// + /// A recognized mention of a specific date, represented numerically as the date within the month (for example, + /// `30` for `June 30`.). + /// + [JsonProperty("specific_day", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificDay { get; set; } + /// + /// A recognized mention of a specific day of the week as a lowercase string (for example, `monday`). + /// + [JsonProperty("specific_day_of_week", NullValueHandling = NullValueHandling.Ignore)] + public string SpecificDayOfWeek { get; set; } + /// + /// A recognized mention of a specific month, represented numerically (for example, `7` for `July`). + /// + [JsonProperty("specific_month", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificMonth { get; set; } + /// + /// A recognized mention of a specific quarter, represented numerically (for example, `3` for `the third + /// quarter`). + /// + [JsonProperty("specific_quarter", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificQuarter { get; set; } + /// + /// A recognized mention of a specific year (for example, `2016`). + /// + [JsonProperty("specific_year", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificYear { get; set; } + /// + /// A recognized numeric value, represented as an integer or double. + /// + [JsonProperty("numeric_value", NullValueHandling = NullValueHandling.Ignore)] + public float? NumericValue { get; set; } + /// + /// The type of numeric value recognized in the user input (`integer` or `rational`). + /// + [JsonProperty("subtype", NullValueHandling = NullValueHandling.Ignore)] + public string Subtype { get; set; } + /// + /// A recognized term for a time that was mentioned as a part of the day in the user's input (for example, + /// `morning` or `afternoon`). + /// + [JsonProperty("part_of_day", NullValueHandling = NullValueHandling.Ignore)] + public string PartOfDay { get; set; } + /// + /// A recognized mention of a relative hour, represented numerically as an offset from the current hour (for + /// example, `3` for `in three hours` or `-1` for `an hour ago`). + /// + [JsonProperty("relative_hour", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeHour { get; set; } + /// + /// A recognized mention of a relative time, represented numerically as an offset in minutes from the current + /// time (for example, `5` for `in five minutes` or `-15` for `fifteen minutes ago`). + /// + [JsonProperty("relative_minute", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeMinute { get; set; } + /// + /// A recognized mention of a relative time, represented numerically as an offset in seconds from the current + /// time (for example, `10` for `in ten seconds` or `-30` for `thirty seconds ago`). + /// + [JsonProperty("relative_second", NullValueHandling = NullValueHandling.Ignore)] + public float? RelativeSecond { get; set; } + /// + /// A recognized specific hour mentioned as part of a time value (for example, `10` for `10:15 AM`.). + /// + [JsonProperty("specific_hour", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificHour { get; set; } + /// + /// A recognized specific minute mentioned as part of a time value (for example, `15` for `10:15 AM`.). + /// + [JsonProperty("specific_minute", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificMinute { get; set; } + /// + /// A recognized specific second mentioned as part of a time value (for example, `30` for `10:15:30 AM`.). + /// + [JsonProperty("specific_second", NullValueHandling = NullValueHandling.Ignore)] + public float? SpecificSecond { get; set; } + /// + /// A recognized time zone mentioned as part of a time value (for example, `EST`). + /// + [JsonProperty("timezone", NullValueHandling = NullValueHandling.Ignore)] + public string Timezone { get; set; } + } +} diff --git a/Scripts/Services/Assistant/V2/Model/RuntimeEntityInterpretation.cs.meta b/Scripts/Services/Assistant/V2/Model/RuntimeEntityInterpretation.cs.meta new file mode 100644 index 000000000..2fbf39b52 --- /dev/null +++ b/Scripts/Services/Assistant/V2/Model/RuntimeEntityInterpretation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b821ea9a5478b4aa3a06ca2f19b8393f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Services/Assistant/V2/Model/RuntimeEntityRole.cs b/Scripts/Services/Assistant/V2/Model/RuntimeEntityRole.cs new file mode 100644 index 000000000..cbf6145ad --- /dev/null +++ b/Scripts/Services/Assistant/V2/Model/RuntimeEntityRole.cs @@ -0,0 +1,68 @@ +/** +* (C) Copyright IBM Corp. 2018, 2020. +* +* 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 +{ + /// + /// An object describing the role played by a system entity that is specifies the beginning or end of a range + /// recognized in the user input. This property is included only if the new system entities are enabled for the + /// skill. + /// + public class RuntimeEntityRole + { + /// + /// The relationship of the entity to the range. + /// + public class TypeValue + { + /// + /// Constant DATE_FROM for date_from + /// + public const string DATE_FROM = "date_from"; + /// + /// Constant DATE_TO for date_to + /// + public const string DATE_TO = "date_to"; + /// + /// Constant NUMBER_FROM for number_from + /// + public const string NUMBER_FROM = "number_from"; + /// + /// Constant NUMBER_TO for number_to + /// + public const string NUMBER_TO = "number_to"; + /// + /// Constant TIME_FROM for time_from + /// + public const string TIME_FROM = "time_from"; + /// + /// Constant TIME_TO for time_to + /// + public const string TIME_TO = "time_to"; + + } + + /// + /// The relationship of the entity to the range. + /// Constants for possible values can be found using RuntimeEntityRole.TypeValue + /// + [JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)] + public string Type { get; set; } + } +} diff --git a/Scripts/Services/Assistant/V2/Model/RuntimeEntityRole.cs.meta b/Scripts/Services/Assistant/V2/Model/RuntimeEntityRole.cs.meta new file mode 100644 index 000000000..abb88a544 --- /dev/null +++ b/Scripts/Services/Assistant/V2/Model/RuntimeEntityRole.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cdae1de35e1394b989a80cb15c2c65b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: