diff --git a/Examples/GenericSerialization.cs b/Examples/GenericSerialization.cs index 2d1af04ba..d415236a8 100644 --- a/Examples/GenericSerialization.cs +++ b/Examples/GenericSerialization.cs @@ -33,21 +33,8 @@ void Start() LogSystem.InstallDefaultReactors(); MessageResponse messageResponse = JsonConvert.DeserializeObject(responseJson); - //Dictionary e = Json.Deserialize(responseJson) as Dictionary; - //Dictionary context = e["context"] as Dictionary; - //Dictionary skills = context["skills"] as Dictionary; - //Dictionary main_skill = skills["main skill"] as Dictionary; - //Dictionary user_defined = main_skill["user_defined"] as Dictionary; - //string name = user_defined["name"] as string; - - //var user_defined = messageResponse.Context.Skills["main skill"]["user_defined"].ToString(); - //var uDefinedObject = JsonConvert.DeserializeObject>(user_defined); - - //Log.Debug("GenericSerialization", "main skill: {0}", uDefinedObject["name"]); - //Log.Debug("GenericSerialization", "test: {0}", messageResponse); - - var name = messageResponse.Context.Skills["main skill"]["user_defined"]["name"].ToString(); + var name = messageResponse.Context.Skills.Get("main skill").UserDefined["name"].ToString(); Log.Debug("GenericSerialization", "name: {0}", name); } diff --git a/Scripts/Services/Assistant/V1/AssistantService.cs b/Scripts/Services/Assistant/V1/AssistantService.cs index 26c6475e3..8513cc8fb 100644 --- a/Scripts/Services/Assistant/V1/AssistantService.cs +++ b/Scripts/Services/Assistant/V1/AssistantService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.Assistant.V1 public partial class AssistantService : BaseService { private const string serviceId = "assistant"; - private const string defaultUrl = "https://gateway.watsonplatform.net/assistant/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/assistant/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public AssistantService(string versionDate, Authenticator authenticator) : base( VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -117,7 +118,7 @@ public AssistantService(string versionDate, Authenticator authenticator) : base( /// Whether to include additional diagnostic information about the dialog /// nodes that were visited during processing of the message. (optional, default to false) /// MessageResponse - public bool Message(Callback callback, string workspaceId, JObject input = null, List intents = null, List entities = null, bool? alternateIntents = null, JObject context = null, JObject output = null, bool? nodesVisitedDetails = null) + public bool Message(Callback callback, string workspaceId, MessageInput input = null, List intents = null, List entities = null, bool? alternateIntents = null, Context context = null, OutputData output = null, bool? nodesVisitedDetails = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `Message`"); @@ -168,7 +169,7 @@ public bool Message(Callback callback, string workspaceId, JObj req.OnResponse = OnMessageResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/message", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/message", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -260,7 +261,7 @@ public bool ListWorkspaces(Callback callback, long? pageLim req.OnResponse = OnListWorkspacesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/workspaces", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/workspaces", GetServiceUrl()); if (connector == null) { return false; @@ -372,7 +373,7 @@ public bool CreateWorkspace(Callback callback, string name = null, st req.OnResponse = OnCreateWorkspaceResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/workspaces", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/workspaces", GetServiceUrl()); if (connector == null) { return false; @@ -466,7 +467,7 @@ public bool GetWorkspace(Callback callback, string workspaceId, bool? req.OnResponse = OnGetWorkspaceResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -592,7 +593,7 @@ public bool UpdateWorkspace(Callback callback, string workspaceId, st req.OnResponse = OnUpdateWorkspaceResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -665,7 +666,7 @@ public bool DeleteWorkspace(Callback callback, string workspaceId) req.OnResponse = OnDeleteWorkspaceResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -768,7 +769,7 @@ public bool ListIntents(Callback callback, string workspaceId, req.OnResponse = OnListIntentsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -863,7 +864,7 @@ public bool CreateIntent(Callback callback, string workspaceId, string i req.OnResponse = OnCreateIntentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -953,7 +954,7 @@ public bool GetIntent(Callback callback, string workspaceId, string inte req.OnResponse = OnGetIntentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent), GetServiceUrl()); if (connector == null) { return false; @@ -1050,7 +1051,7 @@ public bool UpdateIntent(Callback callback, string workspaceId, string i req.OnResponse = OnUpdateIntentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent), GetServiceUrl()); if (connector == null) { return false; @@ -1126,7 +1127,7 @@ public bool DeleteIntent(Callback callback, string workspaceId, string i req.OnResponse = OnDeleteIntentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}", workspaceId, intent), GetServiceUrl()); if (connector == null) { return false; @@ -1224,7 +1225,7 @@ public bool ListExamples(Callback callback, string workspaceI req.OnResponse = OnListExamplesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples", workspaceId, intent), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples", workspaceId, intent), GetServiceUrl()); if (connector == null) { return false; @@ -1318,7 +1319,7 @@ public bool CreateExample(Callback callback, string workspaceId, string req.OnResponse = OnCreateExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples", workspaceId, intent), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples", workspaceId, intent), GetServiceUrl()); if (connector == null) { return false; @@ -1403,7 +1404,7 @@ public bool GetExample(Callback callback, string workspaceId, string in req.OnResponse = OnGetExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text), GetServiceUrl()); if (connector == null) { return false; @@ -1499,7 +1500,7 @@ public bool UpdateExample(Callback callback, string workspaceId, string req.OnResponse = OnUpdateExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text), GetServiceUrl()); if (connector == null) { return false; @@ -1578,7 +1579,7 @@ public bool DeleteExample(Callback callback, string workspaceId, string req.OnResponse = OnDeleteExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/intents/{1}/examples/{2}", workspaceId, intent, text), GetServiceUrl()); if (connector == null) { return false; @@ -1674,7 +1675,7 @@ public bool ListCounterexamples(Callback callback, str req.OnResponse = OnListCounterexamplesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -1764,7 +1765,7 @@ public bool CreateCounterexample(Callback callback, string works req.OnResponse = OnCreateCounterexampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -1847,7 +1848,7 @@ public bool GetCounterexample(Callback callback, string workspac req.OnResponse = OnGetCounterexampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text), GetServiceUrl()); if (connector == null) { return false; @@ -1937,7 +1938,7 @@ public bool UpdateCounterexample(Callback callback, string works req.OnResponse = OnUpdateCounterexampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text), GetServiceUrl()); if (connector == null) { return false; @@ -2014,7 +2015,7 @@ public bool DeleteCounterexample(Callback callback, string workspaceId, req.OnResponse = OnDeleteCounterexampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/counterexamples/{1}", workspaceId, text), GetServiceUrl()); if (connector == null) { return false; @@ -2117,7 +2118,7 @@ public bool ListEntities(Callback callback, string workspaceId req.OnResponse = OnListEntitiesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -2219,7 +2220,7 @@ public bool CreateEntity(Callback callback, string workspaceId, string e req.OnResponse = OnCreateEntityResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -2309,7 +2310,7 @@ public bool GetEntity(Callback callback, string workspaceId, string enti req.OnResponse = OnGetEntityResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity), GetServiceUrl()); if (connector == null) { return false; @@ -2412,7 +2413,7 @@ public bool UpdateEntity(Callback callback, string workspaceId, string e req.OnResponse = OnUpdateEntityResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity), GetServiceUrl()); if (connector == null) { return false; @@ -2488,7 +2489,7 @@ public bool DeleteEntity(Callback callback, string workspaceId, string e req.OnResponse = OnDeleteEntityResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}", workspaceId, entity), GetServiceUrl()); if (connector == null) { return false; @@ -2578,7 +2579,7 @@ public bool ListMentions(Callback callback, string work req.OnResponse = OnListMentionsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/mentions", workspaceId, entity), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/mentions", workspaceId, entity), GetServiceUrl()); if (connector == null) { return false; @@ -2683,7 +2684,7 @@ public bool ListValues(Callback callback, string workspaceId, s req.OnResponse = OnListValuesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values", workspaceId, entity), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values", workspaceId, entity), GetServiceUrl()); if (connector == null) { return false; @@ -2793,7 +2794,7 @@ public bool CreateValue(Callback callback, string workspaceId, string ent req.OnResponse = OnCreateValueResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values", workspaceId, entity), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values", workspaceId, entity), GetServiceUrl()); if (connector == null) { return false; @@ -2885,7 +2886,7 @@ public bool GetValue(Callback callback, string workspaceId, string entity req.OnResponse = OnGetValueResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value), GetServiceUrl()); if (connector == null) { return false; @@ -2997,7 +2998,7 @@ public bool UpdateValue(Callback callback, string workspaceId, string ent req.OnResponse = OnUpdateValueResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value), GetServiceUrl()); if (connector == null) { return false; @@ -3076,7 +3077,7 @@ public bool DeleteValue(Callback callback, string workspaceId, string en req.OnResponse = OnDeleteValueResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}", workspaceId, entity, value), GetServiceUrl()); if (connector == null) { return false; @@ -3177,7 +3178,7 @@ public bool ListSynonyms(Callback callback, string workspaceI req.OnResponse = OnListSynonymsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms", workspaceId, entity, value), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms", workspaceId, entity, value), GetServiceUrl()); if (connector == null) { return false; @@ -3271,7 +3272,7 @@ public bool CreateSynonym(Callback callback, string workspaceId, string req.OnResponse = OnCreateSynonymResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms", workspaceId, entity, value), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms", workspaceId, entity, value), GetServiceUrl()); if (connector == null) { return false; @@ -3359,7 +3360,7 @@ public bool GetSynonym(Callback callback, string workspaceId, string en req.OnResponse = OnGetSynonymResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym), GetServiceUrl()); if (connector == null) { return false; @@ -3454,7 +3455,7 @@ public bool UpdateSynonym(Callback callback, string workspaceId, string req.OnResponse = OnUpdateSynonymResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym), GetServiceUrl()); if (connector == null) { return false; @@ -3536,7 +3537,7 @@ public bool DeleteSynonym(Callback callback, string workspaceId, string req.OnResponse = OnDeleteSynonymResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/entities/{1}/values/{2}/synonyms/{3}", workspaceId, entity, value, synonym), GetServiceUrl()); if (connector == null) { return false; @@ -3631,7 +3632,7 @@ public bool ListDialogNodes(Callback callback, string work req.OnResponse = OnListDialogNodesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -3709,7 +3710,7 @@ private void OnListDialogNodesResponse(RESTConnector.Request req, RESTConnector. /// A label that can be displayed externally to describe the purpose of the node to /// users. (optional) /// DialogNode - public bool CreateDialogNode(Callback callback, string workspaceId, string dialogNode, string description = null, string conditions = null, string parent = null, string previousSibling = null, JObject 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) + 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) { if (callback == null) throw new ArgumentNullException("`callback` is required for `CreateDialogNode`"); @@ -3782,7 +3783,7 @@ public bool CreateDialogNode(Callback callback, string workspaceId, req.OnResponse = OnCreateDialogNodeResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -3864,7 +3865,7 @@ public bool GetDialogNode(Callback callback, string workspaceId, str req.OnResponse = OnGetDialogNodeResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode), GetServiceUrl()); if (connector == null) { return false; @@ -3945,7 +3946,7 @@ private void OnGetDialogNodeResponse(RESTConnector.Request req, RESTConnector.Re /// A label that can be displayed externally to describe the purpose of the node to /// users. (optional) /// 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, JObject 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) + 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) { if (callback == null) throw new ArgumentNullException("`callback` is required for `UpdateDialogNode`"); @@ -4018,7 +4019,7 @@ public bool UpdateDialogNode(Callback callback, string workspaceId, req.OnResponse = OnUpdateDialogNodeResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode), GetServiceUrl()); if (connector == null) { return false; @@ -4094,7 +4095,7 @@ public bool DeleteDialogNode(Callback callback, string workspaceId, stri req.OnResponse = OnDeleteDialogNodeResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/dialog_nodes/{1}", workspaceId, dialogNode), GetServiceUrl()); if (connector == null) { return false; @@ -4193,7 +4194,7 @@ public bool ListLogs(Callback callback, string workspaceId, strin req.OnResponse = OnListLogsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/logs", workspaceId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/workspaces/{0}/logs", workspaceId), GetServiceUrl()); if (connector == null) { return false; @@ -4291,7 +4292,7 @@ public bool ListAllLogs(Callback callback, string filter, string req.OnResponse = OnListAllLogsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/logs", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/logs", GetServiceUrl()); if (connector == null) { return false; @@ -4371,7 +4372,7 @@ public bool DeleteUserData(Callback callback, string customerId) req.OnResponse = OnDeleteUserDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/Assistant/V1/Model/Context.cs b/Scripts/Services/Assistant/V1/Model/Context.cs index 482474c20..30a3ac350 100644 --- a/Scripts/Services/Assistant/V1/Model/Context.cs +++ b/Scripts/Services/Assistant/V1/Model/Context.cs @@ -15,15 +15,15 @@ * */ +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V1.Model { /// /// State information for the conversation. To maintain state, include the context from the previous response. /// - public class Context + public class Context: DynamicModel { /// /// The unique identifier of the conversation. @@ -34,7 +34,7 @@ public class Context /// For internal use only. /// [JsonProperty("system", NullValueHandling = NullValueHandling.Ignore)] - public JObject System { get; set; } + public SystemResponse System { get; set; } /// /// Metadata related to the message. /// diff --git a/Scripts/Services/Assistant/V1/Model/DialogNode.cs b/Scripts/Services/Assistant/V1/Model/DialogNode.cs index 2dcc1188d..807b98809 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogNode.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogNode.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using System; namespace IBM.Watson.Assistant.V1.Model @@ -226,7 +225,7 @@ public class DigressOutSlotsValue /// [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-overview#dialog-overview-responses). /// [JsonProperty("output", NullValueHandling = NullValueHandling.Ignore)] - public JObject Output { get; set; } + public DialogNodeOutput Output { get; set; } /// /// The context for the dialog node. /// diff --git a/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs b/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs index aabffd22d..f32c12c05 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogNodeOutput.cs @@ -16,6 +16,7 @@ */ using System.Collections.Generic; +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; namespace IBM.Watson.Assistant.V1.Model @@ -24,7 +25,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). /// - public class DialogNodeOutput + public class DialogNodeOutput: DynamicModel { /// /// An array of objects describing the output defined for the dialog node. diff --git a/Scripts/Services/Assistant/V1/Model/DialogNodeOutputOptionsElementValue.cs b/Scripts/Services/Assistant/V1/Model/DialogNodeOutputOptionsElementValue.cs index 4bc52f2bc..06ba12ea5 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogNodeOutputOptionsElementValue.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogNodeOutputOptionsElementValue.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V1.Model { @@ -31,7 +30,7 @@ public class DialogNodeOutputOptionsElementValue /// An input object that includes the input text. /// [JsonProperty("input", NullValueHandling = NullValueHandling.Ignore)] - public JObject Input { get; set; } + public MessageInput Input { get; set; } /// /// An array of intents to be used while processing the input. /// @@ -39,7 +38,7 @@ public class DialogNodeOutputOptionsElementValue /// response to user input** method. /// [JsonProperty("intents", NullValueHandling = NullValueHandling.Ignore)] - public List Intents { get; set; } + public List Intents { get; set; } /// /// An array of entities to be used while processing the user input. /// @@ -47,6 +46,6 @@ public class DialogNodeOutputOptionsElementValue /// response to user input** method. /// [JsonProperty("entities", NullValueHandling = NullValueHandling.Ignore)] - public List Entities { get; set; } + public List Entities { get; set; } } } diff --git a/Scripts/Services/Assistant/V1/Model/DialogSuggestion.cs b/Scripts/Services/Assistant/V1/Model/DialogSuggestion.cs index 8e0e73b2f..273fcc50e 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogSuggestion.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogSuggestion.cs @@ -16,7 +16,6 @@ */ using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V1.Model { @@ -42,7 +41,7 @@ public class DialogSuggestion /// corresponding option. /// [JsonProperty("output", NullValueHandling = NullValueHandling.Ignore)] - public JObject Output { get; set; } + public DialogSuggestionOutput Output { get; set; } /// /// The ID of the dialog node that the **label** property is taken from. The **label** property is populated /// using the value of the dialog node's **user_label** property. diff --git a/Scripts/Services/Assistant/V1/Model/DialogSuggestionOutput.cs b/Scripts/Services/Assistant/V1/Model/DialogSuggestionOutput.cs index 7b0b7a45e..689052e94 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogSuggestionOutput.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogSuggestionOutput.cs @@ -16,6 +16,7 @@ */ using System.Collections.Generic; +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; namespace IBM.Watson.Assistant.V1.Model @@ -24,7 +25,7 @@ namespace IBM.Watson.Assistant.V1.Model /// The dialog output that will be returned from the Watson Assistant service if the user selects the corresponding /// option. /// - public class DialogSuggestionOutput + public class DialogSuggestionOutput: DynamicModel { /// /// An array of the nodes that were triggered to create the response, in the order in which they were visited. diff --git a/Scripts/Services/Assistant/V1/Model/DialogSuggestionValue.cs b/Scripts/Services/Assistant/V1/Model/DialogSuggestionValue.cs index 6bc123bef..2838a188a 100644 --- a/Scripts/Services/Assistant/V1/Model/DialogSuggestionValue.cs +++ b/Scripts/Services/Assistant/V1/Model/DialogSuggestionValue.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V1.Model { @@ -31,7 +30,7 @@ public class DialogSuggestionValue /// An input object that includes the input text. /// [JsonProperty("input", NullValueHandling = NullValueHandling.Ignore)] - public JObject Input { get; set; } + public MessageInput Input { get; set; } /// /// An array of intents to be sent along with the user input. /// diff --git a/Scripts/Services/Assistant/V1/Model/MessageInput.cs b/Scripts/Services/Assistant/V1/Model/MessageInput.cs index 434bbc051..64b7600f5 100644 --- a/Scripts/Services/Assistant/V1/Model/MessageInput.cs +++ b/Scripts/Services/Assistant/V1/Model/MessageInput.cs @@ -15,6 +15,7 @@ * */ +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; namespace IBM.Watson.Assistant.V1.Model @@ -22,7 +23,7 @@ namespace IBM.Watson.Assistant.V1.Model /// /// An input object that includes the input text. /// - public class MessageInput + public class MessageInput: DynamicModel { /// /// The text of the user input. This string cannot contain carriage return, newline, or tab characters. diff --git a/Scripts/Services/Assistant/V1/Model/MessageRequest.cs b/Scripts/Services/Assistant/V1/Model/MessageRequest.cs index 8b2597a9d..89268f0fc 100644 --- a/Scripts/Services/Assistant/V1/Model/MessageRequest.cs +++ b/Scripts/Services/Assistant/V1/Model/MessageRequest.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V1.Model { @@ -30,7 +29,7 @@ public class MessageRequest /// An input object that includes the input text. /// [JsonProperty("input", NullValueHandling = NullValueHandling.Ignore)] - public JObject Input { get; set; } + public MessageInput Input { get; set; } /// /// Intents to use when evaluating the user input. Include intents from the previous response to continue using /// those intents rather than trying to recognize intents in the new input. @@ -52,13 +51,13 @@ public class MessageRequest /// State information for the conversation. To maintain state, include the context from the previous response. /// [JsonProperty("context", NullValueHandling = NullValueHandling.Ignore)] - public JObject Context { get; set; } + public Context Context { get; set; } /// /// An output object that includes the response to the user, the dialog nodes that were triggered, and messages /// from the log. /// [JsonProperty("output", NullValueHandling = NullValueHandling.Ignore)] - public JObject Output { get; set; } + public OutputData Output { get; set; } /// /// An array of objects describing any actions requested by the dialog node. /// diff --git a/Scripts/Services/Assistant/V1/Model/MessageResponse.cs b/Scripts/Services/Assistant/V1/Model/MessageResponse.cs index ed3d4e01d..77fdf3d33 100644 --- a/Scripts/Services/Assistant/V1/Model/MessageResponse.cs +++ b/Scripts/Services/Assistant/V1/Model/MessageResponse.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V1.Model { @@ -30,7 +29,7 @@ public class MessageResponse /// An input object that includes the input text. /// [JsonProperty("input", NullValueHandling = NullValueHandling.Ignore)] - public JObject Input { get; set; } + public MessageInput Input { get; set; } /// /// An array of intents recognized in the user input, sorted in descending order of confidence. /// @@ -50,13 +49,13 @@ public class MessageResponse /// State information for the conversation. To maintain state, include the context from the previous response. /// [JsonProperty("context", NullValueHandling = NullValueHandling.Ignore)] - public JObject Context { get; set; } + public Context Context { get; set; } /// /// An output object that includes the response to the user, the dialog nodes that were triggered, and messages /// from the log. /// [JsonProperty("output", NullValueHandling = NullValueHandling.Ignore)] - public JObject Output { get; set; } + public OutputData Output { get; set; } /// /// An array of objects describing any actions requested by the dialog node. /// diff --git a/Scripts/Services/Assistant/V1/Model/OutputData.cs b/Scripts/Services/Assistant/V1/Model/OutputData.cs index b443e8fb0..fd47e085b 100644 --- a/Scripts/Services/Assistant/V1/Model/OutputData.cs +++ b/Scripts/Services/Assistant/V1/Model/OutputData.cs @@ -16,6 +16,7 @@ */ using System.Collections.Generic; +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; namespace IBM.Watson.Assistant.V1.Model @@ -24,7 +25,7 @@ namespace IBM.Watson.Assistant.V1.Model /// An output object that includes the response to the user, the dialog nodes that were triggered, and messages from /// the log. /// - public class OutputData + public class OutputData: DynamicModel { /// /// An array of the nodes that were triggered to create the response, in the order in which they were visited. diff --git a/Scripts/Services/Assistant/V1/Model/SystemResponse.cs b/Scripts/Services/Assistant/V1/Model/SystemResponse.cs index ddec89eb6..9692336b6 100644 --- a/Scripts/Services/Assistant/V1/Model/SystemResponse.cs +++ b/Scripts/Services/Assistant/V1/Model/SystemResponse.cs @@ -15,12 +15,14 @@ * */ +using IBM.Cloud.SDK.Model; + namespace IBM.Watson.Assistant.V1.Model { /// /// For internal use only. /// - public class SystemResponse + public class SystemResponse: DynamicModel { } } diff --git a/Scripts/Services/Assistant/V2/AssistantService.cs b/Scripts/Services/Assistant/V2/AssistantService.cs index cba5648fe..e3f09c4a7 100644 --- a/Scripts/Services/Assistant/V2/AssistantService.cs +++ b/Scripts/Services/Assistant/V2/AssistantService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.Assistant.V2 public partial class AssistantService : BaseService { private const string serviceId = "assistant"; - private const string defaultUrl = "https://gateway.watsonplatform.net/assistant/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/assistant/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public AssistantService(string versionDate, Authenticator authenticator) : base( VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -131,7 +132,7 @@ public bool CreateSession(Callback callback, string assistantId req.OnResponse = OnCreateSessionResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions", assistantId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions", assistantId), GetServiceUrl()); if (connector == null) { return false; @@ -210,7 +211,7 @@ public bool DeleteSession(Callback callback, string assistantId, string req.OnResponse = OnDeleteSessionResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}", assistantId, sessionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}", assistantId, sessionId), GetServiceUrl()); if (connector == null) { return false; @@ -304,7 +305,7 @@ public bool Message(Callback callback, string assistantId, stri req.OnResponse = OnMessageResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}/message", assistantId, sessionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v2/assistants/{0}/sessions/{1}/message", assistantId, sessionId), GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/Assistant/V2/Model/MessageContext.cs b/Scripts/Services/Assistant/V2/Model/MessageContext.cs index 903cb5a9d..ce750f037 100644 --- a/Scripts/Services/Assistant/V2/Model/MessageContext.cs +++ b/Scripts/Services/Assistant/V2/Model/MessageContext.cs @@ -16,7 +16,6 @@ */ using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V2.Model { @@ -37,6 +36,6 @@ public class MessageContext /// that apply to the dialog skill used by the assistant. /// [JsonProperty("skills", NullValueHandling = NullValueHandling.Ignore)] - public JObject Skills { get; set; } + public MessageContextSkills Skills { get; set; } } } diff --git a/Scripts/Services/Assistant/V2/Model/MessageContextSkills.cs b/Scripts/Services/Assistant/V2/Model/MessageContextSkills.cs index 424f23829..582836766 100644 --- a/Scripts/Services/Assistant/V2/Model/MessageContextSkills.cs +++ b/Scripts/Services/Assistant/V2/Model/MessageContextSkills.cs @@ -15,6 +15,8 @@ * */ +using IBM.Cloud.SDK.Model; + namespace IBM.Watson.Assistant.V2.Model { /// @@ -23,7 +25,7 @@ namespace IBM.Watson.Assistant.V2.Model /// **Note:** Currently, only a single property named `main skill` is supported. This object contains variables that /// apply to the dialog skill used by the assistant. /// - public class MessageContextSkills + public class MessageContextSkills: DynamicModel { } } diff --git a/Scripts/Services/Assistant/V2/Model/SearchResult.cs b/Scripts/Services/Assistant/V2/Model/SearchResult.cs index 3b51f47c1..84887a3aa 100644 --- a/Scripts/Services/Assistant/V2/Model/SearchResult.cs +++ b/Scripts/Services/Assistant/V2/Model/SearchResult.cs @@ -16,7 +16,6 @@ */ using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Assistant.V2.Model { @@ -60,6 +59,6 @@ public class SearchResult /// tags. /// [JsonProperty("highlight", NullValueHandling = NullValueHandling.Ignore)] - public JObject Highlight { get; set; } + public SearchResultHighlight Highlight { get; set; } } } diff --git a/Scripts/Services/Assistant/V2/Model/SearchResultHighlight.cs b/Scripts/Services/Assistant/V2/Model/SearchResultHighlight.cs index fa94949ea..bba57e04c 100644 --- a/Scripts/Services/Assistant/V2/Model/SearchResultHighlight.cs +++ b/Scripts/Services/Assistant/V2/Model/SearchResultHighlight.cs @@ -16,6 +16,7 @@ */ using System.Collections.Generic; +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; namespace IBM.Watson.Assistant.V2.Model @@ -24,7 +25,7 @@ namespace IBM.Watson.Assistant.V2.Model /// An object containing segments of text from search results with query-matching text highlighted using HTML /// tags. /// - public class SearchResultHighlight + public class SearchResultHighlight: DynamicModel> { /// /// An array of strings containing segments taken from body text in the search results, with query-matching diff --git a/Scripts/Services/CompareComply/V1/CompareComplyService.cs b/Scripts/Services/CompareComply/V1/CompareComplyService.cs index ec82aa1fb..190c1e379 100644 --- a/Scripts/Services/CompareComply/V1/CompareComplyService.cs +++ b/Scripts/Services/CompareComply/V1/CompareComplyService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.CompareComply.V1 public partial class CompareComplyService : BaseService { private const string serviceId = "compare_comply"; - private const string defaultUrl = "https://gateway.watsonplatform.net/compare-comply/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/compare-comply/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public CompareComplyService(string versionDate, Authenticator authenticator) : b VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -139,7 +140,7 @@ public bool ConvertToHtml(Callback callback, System.IO.MemoryStream req.OnResponse = OnConvertToHtmlResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/html_conversion", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/html_conversion", GetServiceUrl()); if (connector == null) { return false; @@ -224,7 +225,7 @@ public bool ClassifyElements(Callback callback, System.IO.Memory req.OnResponse = OnClassifyElementsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/element_classification", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/element_classification", GetServiceUrl()); if (connector == null) { return false; @@ -309,7 +310,7 @@ public bool ExtractTables(Callback callback, System.IO.MemoryStream req.OnResponse = OnExtractTablesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/tables", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/tables", GetServiceUrl()); if (connector == null) { return false; @@ -412,7 +413,7 @@ public bool CompareDocuments(Callback callback, System.IO.MemoryS req.OnResponse = OnCompareDocumentsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/comparison", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/comparison", GetServiceUrl()); if (connector == null) { return false; @@ -499,7 +500,7 @@ public bool AddFeedback(Callback callback, FeedbackDataInput fee req.OnResponse = OnAddFeedbackResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback", GetServiceUrl()); if (connector == null) { return false; @@ -671,7 +672,7 @@ public bool ListFeedback(Callback callback, string feedbackType = req.OnResponse = OnListFeedbackResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/feedback", GetServiceUrl()); if (connector == null) { return false; @@ -750,7 +751,7 @@ public bool GetFeedback(Callback callback, string feedbackId, strin req.OnResponse = OnGetFeedbackResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId), GetServiceUrl()); if (connector == null) { return false; @@ -829,7 +830,7 @@ public bool DeleteFeedback(Callback callback, string feedbackId req.OnResponse = OnDeleteFeedbackResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/feedback/{0}", feedbackId), GetServiceUrl()); if (connector == null) { return false; @@ -968,7 +969,7 @@ public bool CreateBatch(Callback callback, string function, System. req.OnResponse = OnCreateBatchResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches", GetServiceUrl()); if (connector == null) { return false; @@ -1036,7 +1037,7 @@ public bool ListBatches(Callback callback) req.OnResponse = OnListBatchesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/batches", GetServiceUrl()); if (connector == null) { return false; @@ -1107,7 +1108,7 @@ public bool GetBatch(Callback callback, string batchId) req.OnResponse = OnGetBatchResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId), GetServiceUrl()); if (connector == null) { return false; @@ -1194,7 +1195,7 @@ public bool UpdateBatch(Callback callback, string batchId, string a req.OnResponse = OnUpdateBatchResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/batches/{0}", batchId), GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/Discovery/V1/DiscoveryService.cs b/Scripts/Services/Discovery/V1/DiscoveryService.cs index 55be748db..c127d7b0b 100644 --- a/Scripts/Services/Discovery/V1/DiscoveryService.cs +++ b/Scripts/Services/Discovery/V1/DiscoveryService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.Discovery.V1 public partial class DiscoveryService : BaseService { private const string serviceId = "discovery"; - private const string defaultUrl = "https://gateway.watsonplatform.net/discovery/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/discovery/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public DiscoveryService(string versionDate, Authenticator authenticator) : base( VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -143,7 +144,7 @@ public bool CreateEnvironment(Callback callback, string name, req.OnResponse = OnCreateEnvironmentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/environments", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/environments", GetServiceUrl()); if (connector == null) { return false; @@ -216,7 +217,7 @@ public bool ListEnvironments(Callback callback, string req.OnResponse = OnListEnvironmentsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/environments", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/environments", GetServiceUrl()); if (connector == null) { return false; @@ -285,7 +286,7 @@ public bool GetEnvironment(Callback callback, string environme req.OnResponse = OnGetEnvironmentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -372,7 +373,7 @@ public bool UpdateEnvironment(Callback callback, string enviro req.OnResponse = OnUpdateEnvironmentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -441,7 +442,7 @@ public bool DeleteEnvironment(Callback callback, stri req.OnResponse = OnDeleteEnvironmentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -519,7 +520,7 @@ public bool ListFields(Callback callback, string e req.OnResponse = OnListFieldsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/fields", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/fields", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -624,7 +625,7 @@ public bool CreateConfiguration(Callback callback, string environ req.OnResponse = OnCreateConfigurationResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -700,7 +701,7 @@ public bool ListConfigurations(Callback callback, st req.OnResponse = OnListConfigurationsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -772,7 +773,7 @@ public bool GetConfiguration(Callback callback, string environmen req.OnResponse = OnGetConfigurationResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations/{1}", environmentId, configurationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations/{1}", environmentId, configurationId), GetServiceUrl()); if (connector == null) { return false; @@ -879,7 +880,7 @@ public bool UpdateConfiguration(Callback callback, string environ req.OnResponse = OnUpdateConfigurationResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations/{1}", environmentId, configurationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations/{1}", environmentId, configurationId), GetServiceUrl()); if (connector == null) { return false; @@ -956,7 +957,7 @@ public bool DeleteConfiguration(Callback callback, req.OnResponse = OnDeleteConfigurationResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations/{1}", environmentId, configurationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/configurations/{1}", environmentId, configurationId), GetServiceUrl()); if (connector == null) { return false; @@ -990,123 +991,6 @@ private void OnDeleteConfigurationResponse(RESTConnector.Request req, RESTConnec ((RequestObject)req).Callback(response, resp.Error); } /// - /// Test configuration. - /// - /// **Deprecated** This method is no longer supported and is scheduled to be removed from service on July 31st - /// 2019. - /// - /// Runs a sample document through the default or your configuration and returns diagnostic information - /// designed to help you understand how the document was processed. The document is not added to the index. - /// - /// The callback function that is invoked when the operation completes. - /// The ID of the environment. - /// The configuration to use to process the document. If this part is provided, then - /// the provided configuration is used to process the document. If the **configuration_id** is also provided - /// (both are present at the same time), then request is rejected. The maximum supported configuration size is 1 - /// MB. Configuration parts larger than 1 MB are rejected. See the `GET /configurations/{configuration_id}` - /// operation for an example configuration. (optional) - /// The content of the document to ingest. The maximum supported file size when adding a file - /// to a collection is 50 megabytes, the maximum supported file size when testing a confiruration is 1 megabyte. - /// Files larger than the supported size are rejected. (optional) - /// The filename for file. (optional) - /// The content type of file. (optional) - /// The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are - /// rejected. Example: ``` { - /// "Creator": "Johnny Appleseed", - /// "Subject": "Apples" - /// } ```. (optional) - /// Specify to only run the input document through the given step instead of running the - /// input document through the entire ingestion workflow. Valid values are `convert`, `enrich`, and `normalize`. - /// (optional) - /// The ID of the configuration to use to process the document. If the - /// **configuration** form part is also provided (both are present at the same time), then the request will be - /// rejected. (optional) - /// TestDocument - public bool TestConfigurationInEnvironment(Callback callback, string environmentId, string configuration = null, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, string step = null, string configurationId = null) - { - if (callback == null) - throw new ArgumentNullException("`callback` is required for `TestConfigurationInEnvironment`"); - if (string.IsNullOrEmpty(environmentId)) - throw new ArgumentNullException("`environmentId` is required for `TestConfigurationInEnvironment`"); - - RequestObject req = new RequestObject - { - Callback = callback, - HttpMethod = UnityWebRequest.kHttpVerbPOST, - DisableSslVerification = DisableSslVerification - }; - - foreach (KeyValuePair kvp in customRequestHeaders) - { - req.Headers.Add(kvp.Key, kvp.Value); - } - - ClearCustomRequestHeaders(); - - foreach (KeyValuePair kvp in Common.GetSdkHeaders("discovery", "V1", "TestConfigurationInEnvironment")) - { - req.Headers.Add(kvp.Key, kvp.Value); - } - - req.Parameters["version"] = VersionDate; - req.Forms = new Dictionary(); - if (!string.IsNullOrEmpty(configuration)) - { - req.Forms["configuration"] = new RESTConnector.Form(configuration); - } - if (file != null) - { - req.Forms["file"] = new RESTConnector.Form(file, filename, fileContentType); - } - if (!string.IsNullOrEmpty(metadata)) - { - req.Forms["metadata"] = new RESTConnector.Form(metadata); - } - if (!string.IsNullOrEmpty(step)) - { - req.Parameters["step"] = step; - } - if (!string.IsNullOrEmpty(configurationId)) - { - req.Parameters["configuration_id"] = configurationId; - } - - req.OnResponse = OnTestConfigurationInEnvironmentResponse; - - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/preview", environmentId), serviceUrl); - if (connector == null) - { - return false; - } - - return connector.Send(req); - } - - private void OnTestConfigurationInEnvironmentResponse(RESTConnector.Request req, RESTConnector.Response resp) - { - DetailedResponse response = new DetailedResponse(); - foreach (KeyValuePair kvp in resp.Headers) - { - response.Headers.Add(kvp.Key, kvp.Value); - } - response.StatusCode = resp.HttpResponseCode; - - try - { - string json = Encoding.UTF8.GetString(resp.Data); - response.Result = JsonConvert.DeserializeObject(json); - response.Response = json; - } - catch (Exception e) - { - Log.Error("DiscoveryService.OnTestConfigurationInEnvironmentResponse()", "Exception: {0}", e.ToString()); - resp.Success = false; - } - - if (((RequestObject)req).Callback != null) - ((RequestObject)req).Callback(response, resp.Error); - } - /// /// Create a collection. /// /// The callback function that is invoked when the operation completes. @@ -1163,7 +1047,7 @@ public bool CreateCollection(Callback callback, string environmentId req.OnResponse = OnCreateCollectionResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -1239,7 +1123,7 @@ public bool ListCollections(Callback callback, string e req.OnResponse = OnListCollectionsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -1311,7 +1195,7 @@ public bool GetCollection(Callback callback, string environmentId, s req.OnResponse = OnGetCollectionResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1398,7 +1282,7 @@ public bool UpdateCollection(Callback callback, string environmentId req.OnResponse = OnUpdateCollectionResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1470,7 +1354,7 @@ public bool DeleteCollection(Callback callback, string req.OnResponse = OnDeleteCollectionResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1544,7 +1428,7 @@ public bool ListCollectionFields(Callback callback req.OnResponse = OnListCollectionFieldsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/fields", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/fields", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1619,7 +1503,7 @@ public bool ListExpansions(Callback callback, string environmentId, req.OnResponse = OnListExpansionsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/expansions", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/expansions", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1716,7 +1600,7 @@ public bool CreateExpansions(Callback callback, string environmentId req.OnResponse = OnCreateExpansionsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/expansions", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/expansions", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1791,7 +1675,7 @@ public bool DeleteExpansions(Callback callback, string environmentId, st req.OnResponse = OnDeleteExpansionsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/expansions", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/expansions", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1865,7 +1749,7 @@ public bool GetTokenizationDictionaryStatus(Callback ca req.OnResponse = OnGetTokenizationDictionaryStatusResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/tokenization_dictionary", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/tokenization_dictionary", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -1949,7 +1833,7 @@ public bool CreateTokenizationDictionary(Callback callb req.OnResponse = OnCreateTokenizationDictionaryResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/tokenization_dictionary", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/tokenization_dictionary", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -2023,7 +1907,7 @@ public bool DeleteTokenizationDictionary(Callback callback, string envir req.OnResponse = OnDeleteTokenizationDictionaryResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/tokenization_dictionary", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/tokenization_dictionary", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -2097,7 +1981,7 @@ public bool GetStopwordListStatus(Callback callback, st req.OnResponse = OnGetStopwordListStatusResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/stopwords", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/stopwords", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -2182,7 +2066,7 @@ public bool CreateStopwordList(Callback callback, strin req.OnResponse = OnCreateStopwordListResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/stopwords", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/stopwords", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -2257,7 +2141,7 @@ public bool DeleteStopwordList(Callback callback, string environmentId, req.OnResponse = OnDeleteStopwordListResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/stopwords", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/word_lists/stopwords", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -2372,7 +2256,7 @@ public bool AddDocument(Callback callback, string environmentI req.OnResponse = OnAddDocumentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -2451,7 +2335,7 @@ public bool GetDocumentStatus(Callback callback, string environm req.OnResponse = OnGetDocumentStatusResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents/{2}", environmentId, collectionId, documentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents/{2}", environmentId, collectionId, documentId), GetServiceUrl()); if (connector == null) { return false; @@ -2551,7 +2435,7 @@ public bool UpdateDocument(Callback callback, string environme req.OnResponse = OnUpdateDocumentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents/{2}", environmentId, collectionId, documentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents/{2}", environmentId, collectionId, documentId), GetServiceUrl()); if (connector == null) { return false; @@ -2629,7 +2513,7 @@ public bool DeleteDocument(Callback callback, string env req.OnResponse = OnDeleteDocumentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents/{2}", environmentId, collectionId, documentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/documents/{2}", environmentId, collectionId, documentId), GetServiceUrl()); if (connector == null) { return false; @@ -2709,8 +2593,6 @@ private void OnDeleteDocumentResponse(RESTConnector.Request req, RESTConnector.R /// When specified, duplicate results based on the field specified are removed /// from the returned results. Duplicate comparison is limited to the current query only, **offset** is not /// considered. This parameter is currently Beta functionality. (optional) - /// A comma-separated list of collection IDs to be queried against. Required when - /// querying multiple collections, invalid when performing a single collection query. (optional) /// When `true`, results are returned based on their similarity to the document IDs /// specified in the **similar.document_ids** parameter. (optional, default to false) /// A comma-separated list of document IDs to find similar documents. @@ -2728,7 +2610,7 @@ private void OnDeleteDocumentResponse(RESTConnector.Request req, RESTConnector.R /// If `true`, queries are not stored in the Discovery **Logs** endpoint. /// (optional, default to false) /// QueryResponse - public bool Query(Callback callback, string environmentId, string collectionId, string filter = null, string query = null, string naturalLanguageQuery = null, bool? passages = null, string aggregation = null, long? count = null, string _return = null, long? offset = null, string sort = null, bool? highlight = null, string passagesFields = null, long? passagesCount = null, long? passagesCharacters = null, bool? deduplicate = null, string deduplicateField = null, string collectionIds = null, bool? similar = null, string similarDocumentIds = null, string similarFields = null, string bias = null, bool? xWatsonLoggingOptOut = null) + public bool Query(Callback callback, string environmentId, string collectionId, string filter = null, string query = null, string naturalLanguageQuery = null, bool? passages = null, string aggregation = null, long? count = null, string _return = null, long? offset = null, string sort = null, bool? highlight = null, string passagesFields = null, long? passagesCount = null, long? passagesCharacters = null, bool? deduplicate = null, string deduplicateField = null, bool? similar = null, string similarDocumentIds = null, string similarFields = null, string bias = null, bool? xWatsonLoggingOptOut = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `Query`"); @@ -2796,8 +2678,6 @@ public bool Query(Callback callback, string environmentId, string bodyObject["deduplicate"] = JToken.FromObject(deduplicate); if (!string.IsNullOrEmpty(deduplicateField)) bodyObject["deduplicate.field"] = deduplicateField; - if (!string.IsNullOrEmpty(collectionIds)) - bodyObject["collection_ids"] = collectionIds; if (similar != null) bodyObject["similar"] = JToken.FromObject(similar); if (!string.IsNullOrEmpty(similarDocumentIds)) @@ -2810,7 +2690,7 @@ public bool Query(Callback callback, string environmentId, string req.OnResponse = OnQueryResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/query", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/query", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -2998,7 +2878,7 @@ public bool QueryNotices(Callback callback, string environ req.OnResponse = OnQueryNoticesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/notices", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/notices", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -3078,8 +2958,6 @@ private void OnQueryNoticesResponse(RESTConnector.Request req, RESTConnector.Res /// When specified, duplicate results based on the field specified are removed /// from the returned results. Duplicate comparison is limited to the current query only, **offset** is not /// considered. This parameter is currently Beta functionality. (optional) - /// A comma-separated list of collection IDs to be queried against. Required when - /// querying multiple collections, invalid when performing a single collection query. (optional) /// When `true`, results are returned based on their similarity to the document IDs /// specified in the **similar.document_ids** parameter. (optional, default to false) /// A comma-separated list of document IDs to find similar documents. @@ -3097,7 +2975,7 @@ private void OnQueryNoticesResponse(RESTConnector.Request req, RESTConnector.Res /// If `true`, queries are not stored in the Discovery **Logs** endpoint. /// (optional, default to false) /// QueryResponse - public bool FederatedQuery(Callback callback, string environmentId, string filter = null, string query = null, string naturalLanguageQuery = null, bool? passages = null, string aggregation = null, long? count = null, string _return = null, long? offset = null, string sort = null, bool? highlight = null, string passagesFields = null, long? passagesCount = null, long? passagesCharacters = null, bool? deduplicate = null, string deduplicateField = null, string collectionIds = null, bool? similar = null, string similarDocumentIds = null, string similarFields = null, string bias = null, bool? xWatsonLoggingOptOut = null) + public bool FederatedQuery(Callback callback, string environmentId, string filter = null, string query = null, string naturalLanguageQuery = null, bool? passages = null, string aggregation = null, long? count = null, string _return = null, long? offset = null, string sort = null, bool? highlight = null, string passagesFields = null, long? passagesCount = null, long? passagesCharacters = null, bool? deduplicate = null, string deduplicateField = null, bool? similar = null, string similarDocumentIds = null, string similarFields = null, string bias = null, bool? xWatsonLoggingOptOut = null) { if (callback == null) throw new ArgumentNullException("`callback` is required for `FederatedQuery`"); @@ -3163,8 +3041,6 @@ public bool FederatedQuery(Callback callback, string environmentI bodyObject["deduplicate"] = JToken.FromObject(deduplicate); if (!string.IsNullOrEmpty(deduplicateField)) bodyObject["deduplicate.field"] = deduplicateField; - if (!string.IsNullOrEmpty(collectionIds)) - bodyObject["collection_ids"] = collectionIds; if (similar != null) bodyObject["similar"] = JToken.FromObject(similar); if (!string.IsNullOrEmpty(similarDocumentIds)) @@ -3177,7 +3053,7 @@ public bool FederatedQuery(Callback callback, string environmentI req.OnResponse = OnFederatedQueryResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/query", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/query", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -3345,7 +3221,7 @@ public bool FederatedQueryNotices(Callback callback, strin req.OnResponse = OnFederatedQueryNoticesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/notices", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/notices", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -3445,7 +3321,7 @@ public bool QueryEntities(Callback callback, string envir req.OnResponse = OnQueryEntitiesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/query_entities", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/query_entities", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -3494,7 +3370,7 @@ private void OnQueryEntitiesResponse(RESTConnector.Request req, RESTConnector.Re /// The sorting method for the relationships, can be `score` or `frequency`. `frequency` is /// the number of unique times each entity is identified. The default is `score`. This parameter cannot be used /// in the same query as the **bias** parameter. (optional) - /// (optional) + /// Object containing an array of documents to query. (optional) /// The number of results to return. The default is `10`. The maximum is `1000`. /// (optional) /// The number of evidence items to return for each result. The default is `0`. The @@ -3549,7 +3425,7 @@ public bool QueryRelations(Callback callback, string env req.OnResponse = OnQueryRelationsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/query_relations", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/query_relations", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -3623,7 +3499,7 @@ public bool ListTrainingData(Callback callback, string environm req.OnResponse = OnListTrainingDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -3713,7 +3589,7 @@ public bool AddTrainingData(Callback callback, string environment req.OnResponse = OnAddTrainingDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -3787,7 +3663,7 @@ public bool DeleteAllTrainingData(Callback callback, string environmentI req.OnResponse = OnDeleteAllTrainingDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data", environmentId, collectionId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data", environmentId, collectionId), GetServiceUrl()); if (connector == null) { return false; @@ -3864,7 +3740,7 @@ public bool GetTrainingData(Callback callback, string environment req.OnResponse = OnGetTrainingDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}", environmentId, collectionId, queryId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}", environmentId, collectionId, queryId), GetServiceUrl()); if (connector == null) { return false; @@ -3941,7 +3817,7 @@ public bool DeleteTrainingData(Callback callback, string environmentId, req.OnResponse = OnDeleteTrainingDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}", environmentId, collectionId, queryId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}", environmentId, collectionId, queryId), GetServiceUrl()); if (connector == null) { return false; @@ -4018,7 +3894,7 @@ public bool ListTrainingExamples(Callback callback, string req.OnResponse = OnListTrainingExamplesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples", environmentId, collectionId, queryId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples", environmentId, collectionId, queryId), GetServiceUrl()); if (connector == null) { return false; @@ -4109,7 +3985,7 @@ public bool CreateTrainingExample(Callback callback, string env req.OnResponse = OnCreateTrainingExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples", environmentId, collectionId, queryId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples", environmentId, collectionId, queryId), GetServiceUrl()); if (connector == null) { return false; @@ -4189,7 +4065,7 @@ public bool DeleteTrainingExample(Callback callback, string environmentI req.OnResponse = OnDeleteTrainingExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples/{3}", environmentId, collectionId, queryId, exampleId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples/{3}", environmentId, collectionId, queryId, exampleId), GetServiceUrl()); if (connector == null) { return false; @@ -4280,7 +4156,7 @@ public bool UpdateTrainingExample(Callback callback, string env req.OnResponse = OnUpdateTrainingExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples/{3}", environmentId, collectionId, queryId, exampleId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples/{3}", environmentId, collectionId, queryId, exampleId), GetServiceUrl()); if (connector == null) { return false; @@ -4360,7 +4236,7 @@ public bool GetTrainingExample(Callback callback, string enviro req.OnResponse = OnGetTrainingExampleResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples/{3}", environmentId, collectionId, queryId, exampleId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/collections/{1}/training_data/{2}/examples/{3}", environmentId, collectionId, queryId, exampleId), GetServiceUrl()); if (connector == null) { return false; @@ -4440,7 +4316,7 @@ public bool DeleteUserData(Callback callback, string customerId) req.OnResponse = OnDeleteUserDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", GetServiceUrl()); if (connector == null) { return false; @@ -4524,7 +4400,7 @@ public bool CreateEvent(Callback callback, string type, Eve req.OnResponse = OnCreateEventResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/events", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/events", GetServiceUrl()); if (connector == null) { return false; @@ -4626,7 +4502,7 @@ public bool QueryLog(Callback callback, string filter = null, req.OnResponse = OnQueryLogResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/logs", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/logs", GetServiceUrl()); if (connector == null) { return false; @@ -4711,7 +4587,7 @@ public bool GetMetricsQuery(Callback callback, DateTime? startTi req.OnResponse = OnGetMetricsQueryResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/number_of_queries", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/number_of_queries", GetServiceUrl()); if (connector == null) { return false; @@ -4798,7 +4674,7 @@ public bool GetMetricsQueryEvent(Callback callback, DateTime? st req.OnResponse = OnGetMetricsQueryEventResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/number_of_queries_with_event", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/number_of_queries_with_event", GetServiceUrl()); if (connector == null) { return false; @@ -4884,7 +4760,7 @@ public bool GetMetricsQueryNoResults(Callback callback, DateTime req.OnResponse = OnGetMetricsQueryNoResultsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/number_of_queries_with_no_search_results", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/number_of_queries_with_no_search_results", GetServiceUrl()); if (connector == null) { return false; @@ -4971,7 +4847,7 @@ public bool GetMetricsEventRate(Callback callback, DateTime? sta req.OnResponse = OnGetMetricsEventRateResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/event_rate", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/event_rate", GetServiceUrl()); if (connector == null) { return false; @@ -5047,7 +4923,7 @@ public bool GetMetricsQueryTokenEvent(Callback callback, lo req.OnResponse = OnGetMetricsQueryTokenEventResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/top_query_tokens_with_event_rate", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/metrics/top_query_tokens_with_event_rate", GetServiceUrl()); if (connector == null) { return false; @@ -5120,7 +4996,7 @@ public bool ListCredentials(Callback callback, string environme req.OnResponse = OnListCredentialsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -5219,7 +5095,7 @@ public bool CreateCredentials(Callback callback, string enviro req.OnResponse = OnCreateCredentialsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -5296,7 +5172,7 @@ public bool GetCredentials(Callback callback, string environme req.OnResponse = OnGetCredentialsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials/{1}", environmentId, credentialId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials/{1}", environmentId, credentialId), GetServiceUrl()); if (connector == null) { return false; @@ -5397,7 +5273,7 @@ public bool UpdateCredentials(Callback callback, string enviro req.OnResponse = OnUpdateCredentialsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials/{1}", environmentId, credentialId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials/{1}", environmentId, credentialId), GetServiceUrl()); if (connector == null) { return false; @@ -5471,7 +5347,7 @@ public bool DeleteCredentials(Callback callback, string envir req.OnResponse = OnDeleteCredentialsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials/{1}", environmentId, credentialId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/credentials/{1}", environmentId, credentialId), GetServiceUrl()); if (connector == null) { return false; @@ -5542,7 +5418,7 @@ public bool ListGateways(Callback callback, string environmentId) req.OnResponse = OnListGatewaysResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -5621,7 +5497,7 @@ public bool CreateGateway(Callback callback, string environmentId, stri req.OnResponse = OnCreateGatewayResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways", environmentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways", environmentId), GetServiceUrl()); if (connector == null) { return false; @@ -5695,7 +5571,7 @@ public bool GetGateway(Callback callback, string environmentId, string req.OnResponse = OnGetGatewayResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways/{1}", environmentId, gatewayId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways/{1}", environmentId, gatewayId), GetServiceUrl()); if (connector == null) { return false; @@ -5769,7 +5645,7 @@ public bool DeleteGateway(Callback callback, string environmentId req.OnResponse = OnDeleteGatewayResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways/{1}", environmentId, gatewayId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/environments/{0}/gateways/{1}", environmentId, gatewayId), GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/Discovery/V1/Model/AggregationResult.cs b/Scripts/Services/Discovery/V1/Model/AggregationResult.cs index 2a6e26a69..43f9087a8 100644 --- a/Scripts/Services/Discovery/V1/Model/AggregationResult.cs +++ b/Scripts/Services/Discovery/V1/Model/AggregationResult.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// AggregationResult. + /// Aggregation results for the specified query. /// public class AggregationResult { diff --git a/Scripts/Services/Discovery/V1/Model/Collection.cs b/Scripts/Services/Discovery/V1/Model/Collection.cs index 0561ac36c..2da681d1c 100644 --- a/Scripts/Services/Discovery/V1/Model/Collection.cs +++ b/Scripts/Services/Discovery/V1/Model/Collection.cs @@ -88,7 +88,7 @@ public class StatusValue [JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)] public string Language { get; set; } /// - /// Gets or Sets DocumentCounts + /// Object containing collection document count information. /// [JsonProperty("document_counts", NullValueHandling = NullValueHandling.Ignore)] public DocumentCounts DocumentCounts { get; set; } @@ -98,7 +98,7 @@ public class StatusValue [JsonProperty("disk_usage", NullValueHandling = NullValueHandling.Ignore)] public CollectionDiskUsage DiskUsage { get; set; } /// - /// Gets or Sets TrainingStatus + /// Training status details. /// [JsonProperty("training_status", NullValueHandling = NullValueHandling.Ignore)] public TrainingStatus TrainingStatus { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/CredentialsList.cs b/Scripts/Services/Discovery/V1/Model/CredentialsList.cs index e15409d9f..5010364ad 100644 --- a/Scripts/Services/Discovery/V1/Model/CredentialsList.cs +++ b/Scripts/Services/Discovery/V1/Model/CredentialsList.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// CredentialsList. + /// Object containing array of credential definitions. /// public class CredentialsList { diff --git a/Scripts/Services/Discovery/V1/Model/DeleteCollectionResponse.cs b/Scripts/Services/Discovery/V1/Model/DeleteCollectionResponse.cs index 4a489873d..d71ed1880 100644 --- a/Scripts/Services/Discovery/V1/Model/DeleteCollectionResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/DeleteCollectionResponse.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// DeleteCollectionResponse. + /// Response object returned when deleting a colleciton. /// public class DeleteCollectionResponse { diff --git a/Scripts/Services/Discovery/V1/Model/DeleteConfigurationResponse.cs b/Scripts/Services/Discovery/V1/Model/DeleteConfigurationResponse.cs index f405d360b..03a871b1f 100644 --- a/Scripts/Services/Discovery/V1/Model/DeleteConfigurationResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/DeleteConfigurationResponse.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// DeleteConfigurationResponse. + /// Information returned when a configuration is deleted. /// public class DeleteConfigurationResponse { diff --git a/Scripts/Services/Discovery/V1/Model/DeleteDocumentResponse.cs b/Scripts/Services/Discovery/V1/Model/DeleteDocumentResponse.cs index 7aa277a26..3289afded 100644 --- a/Scripts/Services/Discovery/V1/Model/DeleteDocumentResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/DeleteDocumentResponse.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// DeleteDocumentResponse. + /// Information returned when a document is deleted. /// public class DeleteDocumentResponse { diff --git a/Scripts/Services/Discovery/V1/Model/DeleteEnvironmentResponse.cs b/Scripts/Services/Discovery/V1/Model/DeleteEnvironmentResponse.cs index 637f19b9b..cf519ac74 100644 --- a/Scripts/Services/Discovery/V1/Model/DeleteEnvironmentResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/DeleteEnvironmentResponse.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// DeleteEnvironmentResponse. + /// Response object returned when deleting an environment. /// public class DeleteEnvironmentResponse { diff --git a/Scripts/Services/Discovery/V1/Model/DocumentAccepted.cs b/Scripts/Services/Discovery/V1/Model/DocumentAccepted.cs index 116845792..1e27a8a12 100644 --- a/Scripts/Services/Discovery/V1/Model/DocumentAccepted.cs +++ b/Scripts/Services/Discovery/V1/Model/DocumentAccepted.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// DocumentAccepted. + /// Information returned after an uploaded document is accepted. /// public class DocumentAccepted { diff --git a/Scripts/Services/Discovery/V1/Model/DocumentCounts.cs b/Scripts/Services/Discovery/V1/Model/DocumentCounts.cs index d556f94d5..f702ada15 100644 --- a/Scripts/Services/Discovery/V1/Model/DocumentCounts.cs +++ b/Scripts/Services/Discovery/V1/Model/DocumentCounts.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// DocumentCounts. + /// Object containing collection document count information. /// public class DocumentCounts { diff --git a/Scripts/Services/Discovery/V1/Model/Enrichment.cs b/Scripts/Services/Discovery/V1/Model/Enrichment.cs index b2a5bf901..49f952fc4 100644 --- a/Scripts/Services/Discovery/V1/Model/Enrichment.cs +++ b/Scripts/Services/Discovery/V1/Model/Enrichment.cs @@ -20,7 +20,8 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// Enrichment. + /// Enrichment step to perform on the document. Each enrichment is performed on the specified field in the order + /// that they are listed in the configuration. /// public class Enrichment { diff --git a/Scripts/Services/Discovery/V1/Model/EnrichmentOptions.cs b/Scripts/Services/Discovery/V1/Model/EnrichmentOptions.cs index dedf88fb3..5ce29ace0 100644 --- a/Scripts/Services/Discovery/V1/Model/EnrichmentOptions.cs +++ b/Scripts/Services/Discovery/V1/Model/EnrichmentOptions.cs @@ -81,7 +81,7 @@ public class LanguageValue [JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)] public string Language { get; set; } /// - /// Gets or Sets Features + /// Object containing Natural Language Understanding features to be used. /// [JsonProperty("features", NullValueHandling = NullValueHandling.Ignore)] public NluEnrichmentFeatures Features { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/Field.cs b/Scripts/Services/Discovery/V1/Model/Field.cs index 6daa9daf9..7d71d7b90 100644 --- a/Scripts/Services/Discovery/V1/Model/Field.cs +++ b/Scripts/Services/Discovery/V1/Model/Field.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// Field. + /// Object containing field details. /// public class Field { diff --git a/Scripts/Services/Discovery/V1/Model/FontSetting.cs b/Scripts/Services/Discovery/V1/Model/FontSetting.cs index 4747ea7e5..112318fc7 100644 --- a/Scripts/Services/Discovery/V1/Model/FontSetting.cs +++ b/Scripts/Services/Discovery/V1/Model/FontSetting.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// FontSetting. + /// Font matching configuration. /// public class FontSetting { diff --git a/Scripts/Services/Discovery/V1/Model/HtmlSettings.cs b/Scripts/Services/Discovery/V1/Model/HtmlSettings.cs index 5161c7b89..e444b2162 100644 --- a/Scripts/Services/Discovery/V1/Model/HtmlSettings.cs +++ b/Scripts/Services/Discovery/V1/Model/HtmlSettings.cs @@ -36,12 +36,12 @@ public class HtmlSettings [JsonProperty("exclude_tags_keep_content", NullValueHandling = NullValueHandling.Ignore)] public List ExcludeTagsKeepContent { get; set; } /// - /// Gets or Sets KeepContent + /// Object containing an array of XPaths. /// [JsonProperty("keep_content", NullValueHandling = NullValueHandling.Ignore)] public XPathPatterns KeepContent { get; set; } /// - /// Gets or Sets ExcludeContent + /// Object containing an array of XPaths. /// [JsonProperty("exclude_content", NullValueHandling = NullValueHandling.Ignore)] public XPathPatterns ExcludeContent { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/ListCollectionsResponse.cs b/Scripts/Services/Discovery/V1/Model/ListCollectionsResponse.cs index 6f74c4186..cf8bf7530 100644 --- a/Scripts/Services/Discovery/V1/Model/ListCollectionsResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/ListCollectionsResponse.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// ListCollectionsResponse. + /// Response object containing an array of collection details. /// public class ListCollectionsResponse { diff --git a/Scripts/Services/Discovery/V1/Model/ListConfigurationsResponse.cs b/Scripts/Services/Discovery/V1/Model/ListConfigurationsResponse.cs index f229d575e..c485379de 100644 --- a/Scripts/Services/Discovery/V1/Model/ListConfigurationsResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/ListConfigurationsResponse.cs @@ -21,12 +21,12 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// ListConfigurationsResponse. + /// Object containing an array of available configurations. /// public class ListConfigurationsResponse { /// - /// An array of Configurations that are available for the service instance. + /// An array of configurations that are available for the service instance. /// [JsonProperty("configurations", NullValueHandling = NullValueHandling.Ignore)] public List Configurations { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/ListEnvironmentsResponse.cs b/Scripts/Services/Discovery/V1/Model/ListEnvironmentsResponse.cs index 0d8a03e76..1263ddac7 100644 --- a/Scripts/Services/Discovery/V1/Model/ListEnvironmentsResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/ListEnvironmentsResponse.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// ListEnvironmentsResponse. + /// Response object containing an array of configured environments. /// public class ListEnvironmentsResponse { diff --git a/Scripts/Services/Discovery/V1/Model/NluEnrichmentCategories.cs b/Scripts/Services/Discovery/V1/Model/NluEnrichmentCategories.cs index 464ee02f0..327432600 100644 --- a/Scripts/Services/Discovery/V1/Model/NluEnrichmentCategories.cs +++ b/Scripts/Services/Discovery/V1/Model/NluEnrichmentCategories.cs @@ -15,12 +15,14 @@ * */ +using IBM.Cloud.SDK.Model; + namespace IBM.Watson.Discovery.V1.Model { /// /// An object that indicates the Categories enrichment will be applied to the specified field. /// - public class NluEnrichmentCategories + public class NluEnrichmentCategories: DynamicModel { } } diff --git a/Scripts/Services/Discovery/V1/Model/NluEnrichmentFeatures.cs b/Scripts/Services/Discovery/V1/Model/NluEnrichmentFeatures.cs index 247b5219c..cd9e5e8f2 100644 --- a/Scripts/Services/Discovery/V1/Model/NluEnrichmentFeatures.cs +++ b/Scripts/Services/Discovery/V1/Model/NluEnrichmentFeatures.cs @@ -16,12 +16,11 @@ */ using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Discovery.V1.Model { /// - /// NluEnrichmentFeatures. + /// Object containing Natural Language Understanding features to be used. /// public class NluEnrichmentFeatures { @@ -49,7 +48,7 @@ public class NluEnrichmentFeatures /// An object that indicates the Categories enrichment will be applied to the specified field. /// [JsonProperty("categories", NullValueHandling = NullValueHandling.Ignore)] - public JObject Categories { get; set; } + public NluEnrichmentCategories Categories { get; set; } /// /// An object specifiying the semantic roles enrichment and related parameters. /// diff --git a/Scripts/Services/Discovery/V1/Model/NormalizationOperation.cs b/Scripts/Services/Discovery/V1/Model/NormalizationOperation.cs index 1ccbda2ad..494d65273 100644 --- a/Scripts/Services/Discovery/V1/Model/NormalizationOperation.cs +++ b/Scripts/Services/Discovery/V1/Model/NormalizationOperation.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// NormalizationOperation. + /// Object containing normalization operations. /// public class NormalizationOperation { diff --git a/Scripts/Services/Discovery/V1/Model/PdfHeadingDetection.cs b/Scripts/Services/Discovery/V1/Model/PdfHeadingDetection.cs index 6232b41b3..85b101415 100644 --- a/Scripts/Services/Discovery/V1/Model/PdfHeadingDetection.cs +++ b/Scripts/Services/Discovery/V1/Model/PdfHeadingDetection.cs @@ -21,12 +21,12 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// PdfHeadingDetection. + /// Object containing heading detection conversion settings for PDF documents. /// public class PdfHeadingDetection { /// - /// Gets or Sets Fonts + /// Array of font matching configurations. /// [JsonProperty("fonts", NullValueHandling = NullValueHandling.Ignore)] public List Fonts { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/PdfSettings.cs b/Scripts/Services/Discovery/V1/Model/PdfSettings.cs index 638ecfa55..f0054ab39 100644 --- a/Scripts/Services/Discovery/V1/Model/PdfSettings.cs +++ b/Scripts/Services/Discovery/V1/Model/PdfSettings.cs @@ -25,7 +25,7 @@ namespace IBM.Watson.Discovery.V1.Model public class PdfSettings { /// - /// Gets or Sets Heading + /// Object containing heading detection conversion settings for PDF documents. /// [JsonProperty("heading", NullValueHandling = NullValueHandling.Ignore)] public PdfHeadingDetection Heading { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/QueryFilterType.cs b/Scripts/Services/Discovery/V1/Model/QueryFilterType.cs index eb43b7924..22f3b1d35 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryFilterType.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryFilterType.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryFilterType. + /// Object containing information about excluded and included types. /// public class QueryFilterType { diff --git a/Scripts/Services/Discovery/V1/Model/QueryNoticesResponse.cs b/Scripts/Services/Discovery/V1/Model/QueryNoticesResponse.cs index 132ecdf34..5c445893b 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryNoticesResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryNoticesResponse.cs @@ -17,12 +17,11 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryNoticesResponse. + /// Object containing notice query results. /// public class QueryNoticesResponse { @@ -35,7 +34,7 @@ public class QueryNoticesResponse /// Array of document results that match the query. /// [JsonProperty("results", NullValueHandling = NullValueHandling.Ignore)] - public List Results { get; set; } + public List Results { get; set; } /// /// Array of aggregation results that match the query. /// diff --git a/Scripts/Services/Discovery/V1/Model/QueryNoticesResult.cs b/Scripts/Services/Discovery/V1/Model/QueryNoticesResult.cs index 1c0412487..bdf781190 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryNoticesResult.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryNoticesResult.cs @@ -16,14 +16,15 @@ */ using System.Collections.Generic; +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryNoticesResult. + /// Query result object. /// - public class QueryNoticesResult + public class QueryNoticesResult: DynamicModel { /// /// The type of the original source file. diff --git a/Scripts/Services/Discovery/V1/Model/QueryPassages.cs b/Scripts/Services/Discovery/V1/Model/QueryPassages.cs index 14779e0af..491f4f6e8 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryPassages.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryPassages.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryPassages. + /// A passage query result. /// public class QueryPassages { diff --git a/Scripts/Services/Discovery/V1/Model/QueryRelationsArgument.cs b/Scripts/Services/Discovery/V1/Model/QueryRelationsArgument.cs index 7c4f968a3..ac5b1bf14 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryRelationsArgument.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryRelationsArgument.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryRelationsArgument. + /// Object containing an array of query entities. /// public class QueryRelationsArgument { diff --git a/Scripts/Services/Discovery/V1/Model/QueryRelationsEntity.cs b/Scripts/Services/Discovery/V1/Model/QueryRelationsEntity.cs index 630375afd..45e9c59ca 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryRelationsEntity.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryRelationsEntity.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryRelationsEntity. + /// Object defining a knowledge graph relationship query entity. /// public class QueryRelationsEntity { diff --git a/Scripts/Services/Discovery/V1/Model/QueryRelationsFilter.cs b/Scripts/Services/Discovery/V1/Model/QueryRelationsFilter.cs index 55403658b..0daf694ef 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryRelationsFilter.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryRelationsFilter.cs @@ -21,17 +21,17 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryRelationsFilter. + /// Object containing an array of documents to query. /// public class QueryRelationsFilter { /// - /// Gets or Sets RelationTypes + /// Object containing information about excluded and included types. /// [JsonProperty("relation_types", NullValueHandling = NullValueHandling.Ignore)] public QueryFilterType RelationTypes { get; set; } /// - /// Gets or Sets EntityTypes + /// Object containing information about excluded and included types. /// [JsonProperty("entity_types", NullValueHandling = NullValueHandling.Ignore)] public QueryFilterType EntityTypes { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/QueryRelationsRelationship.cs b/Scripts/Services/Discovery/V1/Model/QueryRelationsRelationship.cs index 5a5d2496e..7149ebeab 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryRelationsRelationship.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryRelationsRelationship.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryRelationsRelationship. + /// Object containing knowledge graph relationship details. /// public class QueryRelationsRelationship { diff --git a/Scripts/Services/Discovery/V1/Model/QueryRelationsResponse.cs b/Scripts/Services/Discovery/V1/Model/QueryRelationsResponse.cs index c1cd46334..b6cfd92b0 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryRelationsResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryRelationsResponse.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryRelationsResponse. + /// Object containing an array of relationship responses. /// public class QueryRelationsResponse { diff --git a/Scripts/Services/Discovery/V1/Model/QueryResponse.cs b/Scripts/Services/Discovery/V1/Model/QueryResponse.cs index 17134432c..c2bd63bdb 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryResponse.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryResponse.cs @@ -17,7 +17,6 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Discovery.V1.Model { @@ -35,7 +34,7 @@ public class QueryResponse /// Array of document results for the query. /// [JsonProperty("results", NullValueHandling = NullValueHandling.Ignore)] - public List Results { get; set; } + public List Results { get; set; } /// /// Array of aggregation results for the query. /// diff --git a/Scripts/Services/Discovery/V1/Model/QueryResult.cs b/Scripts/Services/Discovery/V1/Model/QueryResult.cs index d6fdb7a8c..3da2e92be 100644 --- a/Scripts/Services/Discovery/V1/Model/QueryResult.cs +++ b/Scripts/Services/Discovery/V1/Model/QueryResult.cs @@ -16,14 +16,15 @@ */ using System.Collections.Generic; +using IBM.Cloud.SDK.Model; using Newtonsoft.Json; namespace IBM.Watson.Discovery.V1.Model { /// - /// QueryResult. + /// Query result object. /// - public class QueryResult + public class QueryResult: DynamicModel { /// /// The unique identifier of the document. diff --git a/Scripts/Services/Discovery/V1/Model/Term.cs b/Scripts/Services/Discovery/V1/Model/Term.cs index 631028857..10387157c 100644 --- a/Scripts/Services/Discovery/V1/Model/Term.cs +++ b/Scripts/Services/Discovery/V1/Model/Term.cs @@ -31,7 +31,7 @@ public class Term [JsonProperty("field", NullValueHandling = NullValueHandling.Ignore)] public string Field { get; set; } /// - /// Gets or Sets Count + /// The number of terms identified. /// [JsonProperty("count", NullValueHandling = NullValueHandling.Ignore)] public long? Count { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/TopHitsResults.cs b/Scripts/Services/Discovery/V1/Model/TopHitsResults.cs index d017724e1..69c498520 100644 --- a/Scripts/Services/Discovery/V1/Model/TopHitsResults.cs +++ b/Scripts/Services/Discovery/V1/Model/TopHitsResults.cs @@ -17,12 +17,11 @@ using System.Collections.Generic; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace IBM.Watson.Discovery.V1.Model { /// - /// TopHitsResults. + /// Top hit information for this query. /// public class TopHitsResults { @@ -35,6 +34,6 @@ public class TopHitsResults /// Top results returned by the aggregation. /// [JsonProperty("hits", NullValueHandling = NullValueHandling.Ignore)] - public List Hits { get; set; } + public List Hits { get; set; } } } diff --git a/Scripts/Services/Discovery/V1/Model/TrainingDataSet.cs b/Scripts/Services/Discovery/V1/Model/TrainingDataSet.cs index da55da619..898e0554d 100644 --- a/Scripts/Services/Discovery/V1/Model/TrainingDataSet.cs +++ b/Scripts/Services/Discovery/V1/Model/TrainingDataSet.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// TrainingDataSet. + /// Training information for a specific collection. /// public class TrainingDataSet { diff --git a/Scripts/Services/Discovery/V1/Model/TrainingExample.cs b/Scripts/Services/Discovery/V1/Model/TrainingExample.cs index 6bd1476e5..27793f36e 100644 --- a/Scripts/Services/Discovery/V1/Model/TrainingExample.cs +++ b/Scripts/Services/Discovery/V1/Model/TrainingExample.cs @@ -20,7 +20,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// TrainingExample. + /// Training example details. /// public class TrainingExample { diff --git a/Scripts/Services/Discovery/V1/Model/TrainingExampleList.cs b/Scripts/Services/Discovery/V1/Model/TrainingExampleList.cs index 7eb7b0c42..8a419e272 100644 --- a/Scripts/Services/Discovery/V1/Model/TrainingExampleList.cs +++ b/Scripts/Services/Discovery/V1/Model/TrainingExampleList.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// TrainingExampleList. + /// Object containing an array of training examples. /// public class TrainingExampleList { diff --git a/Scripts/Services/Discovery/V1/Model/TrainingQuery.cs b/Scripts/Services/Discovery/V1/Model/TrainingQuery.cs index 5c6a14dda..10200412a 100644 --- a/Scripts/Services/Discovery/V1/Model/TrainingQuery.cs +++ b/Scripts/Services/Discovery/V1/Model/TrainingQuery.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// TrainingQuery. + /// Training query details. /// public class TrainingQuery { diff --git a/Scripts/Services/Discovery/V1/Model/TrainingStatus.cs b/Scripts/Services/Discovery/V1/Model/TrainingStatus.cs index bf68ae5db..314bb7bf5 100644 --- a/Scripts/Services/Discovery/V1/Model/TrainingStatus.cs +++ b/Scripts/Services/Discovery/V1/Model/TrainingStatus.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// TrainingStatus. + /// Training status details. /// public class TrainingStatus { diff --git a/Scripts/Services/Discovery/V1/Model/WordHeadingDetection.cs b/Scripts/Services/Discovery/V1/Model/WordHeadingDetection.cs index bd92b9553..55b90d110 100644 --- a/Scripts/Services/Discovery/V1/Model/WordHeadingDetection.cs +++ b/Scripts/Services/Discovery/V1/Model/WordHeadingDetection.cs @@ -21,17 +21,17 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// WordHeadingDetection. + /// Object containing heading detection conversion settings for Microsoft Word documents. /// public class WordHeadingDetection { /// - /// Gets or Sets Fonts + /// Array of font matching configurations. /// [JsonProperty("fonts", NullValueHandling = NullValueHandling.Ignore)] public List Fonts { get; set; } /// - /// Gets or Sets Styles + /// Array of Microsoft Word styles to convert. /// [JsonProperty("styles", NullValueHandling = NullValueHandling.Ignore)] public List Styles { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/WordSettings.cs b/Scripts/Services/Discovery/V1/Model/WordSettings.cs index 860482a9e..c541f5459 100644 --- a/Scripts/Services/Discovery/V1/Model/WordSettings.cs +++ b/Scripts/Services/Discovery/V1/Model/WordSettings.cs @@ -25,7 +25,7 @@ namespace IBM.Watson.Discovery.V1.Model public class WordSettings { /// - /// Gets or Sets Heading + /// Object containing heading detection conversion settings for Microsoft Word documents. /// [JsonProperty("heading", NullValueHandling = NullValueHandling.Ignore)] public WordHeadingDetection Heading { get; set; } diff --git a/Scripts/Services/Discovery/V1/Model/WordStyle.cs b/Scripts/Services/Discovery/V1/Model/WordStyle.cs index 851bb6d39..42de4154e 100644 --- a/Scripts/Services/Discovery/V1/Model/WordStyle.cs +++ b/Scripts/Services/Discovery/V1/Model/WordStyle.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// WordStyle. + /// Microsoft Word styles to convert into a specified HTML head level. /// public class WordStyle { diff --git a/Scripts/Services/Discovery/V1/Model/XPathPatterns.cs b/Scripts/Services/Discovery/V1/Model/XPathPatterns.cs index c25b0662e..62678aeb6 100644 --- a/Scripts/Services/Discovery/V1/Model/XPathPatterns.cs +++ b/Scripts/Services/Discovery/V1/Model/XPathPatterns.cs @@ -21,7 +21,7 @@ namespace IBM.Watson.Discovery.V1.Model { /// - /// XPathPatterns. + /// Object containing an array of XPaths. /// public class XPathPatterns { diff --git a/Scripts/Services/LanguageTranslator/V3/LanguageTranslatorService.cs b/Scripts/Services/LanguageTranslator/V3/LanguageTranslatorService.cs index b98a1e4be..c8441f8d6 100644 --- a/Scripts/Services/LanguageTranslator/V3/LanguageTranslatorService.cs +++ b/Scripts/Services/LanguageTranslator/V3/LanguageTranslatorService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.LanguageTranslator.V3 public partial class LanguageTranslatorService : BaseService { private const string serviceId = "language_translator"; - private const string defaultUrl = "https://gateway.watsonplatform.net/language-translator/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/language-translator/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public LanguageTranslatorService(string versionDate, Authenticator authenticator VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -143,7 +144,7 @@ public bool Translate(Callback callback, List text, s req.OnResponse = OnTranslateResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/translate", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/translate", GetServiceUrl()); if (connector == null) { return false; @@ -212,7 +213,7 @@ public bool ListIdentifiableLanguages(Callback callback) req.OnResponse = OnListIdentifiableLanguagesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/identifiable_languages", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/identifiable_languages", GetServiceUrl()); if (connector == null) { return false; @@ -286,7 +287,7 @@ public bool Identify(Callback callback, string text) req.OnResponse = OnIdentifyResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/identify", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/identify", GetServiceUrl()); if (connector == null) { return false; @@ -372,7 +373,7 @@ public bool ListModels(Callback callback, string source = nul req.OnResponse = OnListModelsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/models", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/models", GetServiceUrl()); if (connector == null) { return false; @@ -484,7 +485,7 @@ public bool CreateModel(Callback callback, string baseModelId, req.OnResponse = OnCreateModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/models", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/models", GetServiceUrl()); if (connector == null) { return false; @@ -555,7 +556,7 @@ public bool DeleteModel(Callback callback, string modelId) req.OnResponse = OnDeleteModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/models/{0}", modelId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/models/{0}", modelId), GetServiceUrl()); if (connector == null) { return false; @@ -628,7 +629,7 @@ public bool GetModel(Callback callback, string modelId) req.OnResponse = OnGetModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/models/{0}", modelId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/models/{0}", modelId), GetServiceUrl()); if (connector == null) { return false; @@ -696,7 +697,7 @@ public bool ListDocuments(Callback callback) req.OnResponse = OnListDocumentsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/documents", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/documents", GetServiceUrl()); if (connector == null) { return false; @@ -804,7 +805,7 @@ public bool TranslateDocument(Callback callback, System.IO.Memor req.OnResponse = OnTranslateDocumentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/documents", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/documents", GetServiceUrl()); if (connector == null) { return false; @@ -875,7 +876,7 @@ public bool GetDocumentStatus(Callback callback, string document req.OnResponse = OnGetDocumentStatusResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/documents/{0}", documentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/documents/{0}", documentId), GetServiceUrl()); if (connector == null) { return false; @@ -946,7 +947,7 @@ public bool DeleteDocument(Callback callback, string documentId) req.OnResponse = OnDeleteDocumentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/documents/{0}", documentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/documents/{0}", documentId), GetServiceUrl()); if (connector == null) { return false; @@ -1026,7 +1027,7 @@ public bool GetTranslatedDocument(Callback callback, string documentId, req.OnResponse = OnGetTranslatedDocumentResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/documents/{0}/translated_document", documentId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/documents/{0}/translated_document", documentId), GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/NaturalLanguageClassifier/V1/NaturalLanguageClassifierService.cs b/Scripts/Services/NaturalLanguageClassifier/V1/NaturalLanguageClassifierService.cs index f5e516dc2..c844b4fb3 100644 --- a/Scripts/Services/NaturalLanguageClassifier/V1/NaturalLanguageClassifierService.cs +++ b/Scripts/Services/NaturalLanguageClassifier/V1/NaturalLanguageClassifierService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.NaturalLanguageClassifier.V1 public partial class NaturalLanguageClassifierService : BaseService { private const string serviceId = "natural_language_classifier"; - private const string defaultUrl = "https://gateway.watsonplatform.net/natural-language-classifier/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/natural-language-classifier/api"; #region VersionDate #endregion @@ -63,9 +63,10 @@ public NaturalLanguageClassifierService() : this(ConfigBasedAuthenticatorFactory public NaturalLanguageClassifierService(Authenticator authenticator) : base(authenticator, serviceId) { Authenticator = authenticator; - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -117,7 +118,7 @@ public bool Classify(Callback callback, string classifierId, str req.OnResponse = OnClassifyResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}/classify", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}/classify", classifierId), GetServiceUrl()); if (connector == null) { return false; @@ -200,7 +201,7 @@ public bool ClassifyCollection(Callback callback, stri req.OnResponse = OnClassifyCollectionResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}/classify_collection", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}/classify_collection", classifierId), GetServiceUrl()); if (connector == null) { return false; @@ -289,7 +290,7 @@ public bool CreateClassifier(Callback callback, System.IO.MemoryStre req.OnResponse = OnCreateClassifierResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/classifiers", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/classifiers", GetServiceUrl()); if (connector == null) { return false; @@ -356,7 +357,7 @@ public bool ListClassifiers(Callback callback) req.OnResponse = OnListClassifiersResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/classifiers", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/classifiers", GetServiceUrl()); if (connector == null) { return false; @@ -426,7 +427,7 @@ public bool GetClassifier(Callback callback, string classifierId) req.OnResponse = OnGetClassifierResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}", classifierId), GetServiceUrl()); if (connector == null) { return false; @@ -494,7 +495,7 @@ public bool DeleteClassifier(Callback callback, string classifierId) req.OnResponse = OnDeleteClassifierResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/classifiers/{0}", classifierId), GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/NaturalLanguageUnderstanding/V1/Model/SemanticRolesResult.cs b/Scripts/Services/NaturalLanguageUnderstanding/V1/Model/SemanticRolesResult.cs index dc38677fc..4ccdef819 100644 --- a/Scripts/Services/NaturalLanguageUnderstanding/V1/Model/SemanticRolesResult.cs +++ b/Scripts/Services/NaturalLanguageUnderstanding/V1/Model/SemanticRolesResult.cs @@ -43,6 +43,6 @@ public class SemanticRolesResult /// The extracted object from the sentence. /// [JsonProperty("object", NullValueHandling = NullValueHandling.Ignore)] - public SemanticRolesResultModelObject _Object { get; set; } + public SemanticRolesResultObject _Object { get; set; } } } diff --git a/Scripts/Services/NaturalLanguageUnderstanding/V1/NaturalLanguageUnderstandingService.cs b/Scripts/Services/NaturalLanguageUnderstanding/V1/NaturalLanguageUnderstandingService.cs index d97b18199..be77684b2 100644 --- a/Scripts/Services/NaturalLanguageUnderstanding/V1/NaturalLanguageUnderstandingService.cs +++ b/Scripts/Services/NaturalLanguageUnderstanding/V1/NaturalLanguageUnderstandingService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.NaturalLanguageUnderstanding.V1 public partial class NaturalLanguageUnderstandingService : BaseService { private const string serviceId = "natural_language_understanding"; - private const string defaultUrl = "https://gateway.watsonplatform.net/natural-language-understanding/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/natural-language-understanding/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public NaturalLanguageUnderstandingService(string versionDate, Authenticator aut VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -186,7 +187,7 @@ public bool Analyze(Callback callback, Features features, strin req.OnResponse = OnAnalyzeResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/analyze", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/analyze", GetServiceUrl()); if (connector == null) { return false; @@ -256,7 +257,7 @@ public bool ListModels(Callback callback) req.OnResponse = OnListModelsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/models", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/models", GetServiceUrl()); if (connector == null) { return false; @@ -327,7 +328,7 @@ public bool DeleteModel(Callback callback, string modelId) req.OnResponse = OnDeleteModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/models/{0}", modelId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/models/{0}", modelId), GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/PersonalityInsights/V3/PersonalityInsightsService.cs b/Scripts/Services/PersonalityInsights/V3/PersonalityInsightsService.cs index f8dc41429..b7a56605a 100644 --- a/Scripts/Services/PersonalityInsights/V3/PersonalityInsightsService.cs +++ b/Scripts/Services/PersonalityInsights/V3/PersonalityInsightsService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.PersonalityInsights.V3 public partial class PersonalityInsightsService : BaseService { private const string serviceId = "personality_insights"; - private const string defaultUrl = "https://gateway.watsonplatform.net/personality-insights/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/personality-insights/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public PersonalityInsightsService(string versionDate, Authenticator authenticato VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -216,7 +217,7 @@ public bool Profile(Callback callback, Content content, string contentT req.OnResponse = OnProfileResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/profile", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/profile", GetServiceUrl()); if (connector == null) { return false; @@ -378,7 +379,7 @@ public bool ProfileAsCsv(Callback callback, Content cont req.OnResponse = OnProfileAsCsvResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/profile", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/profile", GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/SpeechToText/V1/SpeechToTextService.cs b/Scripts/Services/SpeechToText/V1/SpeechToTextService.cs index 78fe58a3d..76434aadd 100644 --- a/Scripts/Services/SpeechToText/V1/SpeechToTextService.cs +++ b/Scripts/Services/SpeechToText/V1/SpeechToTextService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.SpeechToText.V1 public partial class SpeechToTextService : BaseService { private const string serviceId = "speech_to_text"; - private const string defaultUrl = "https://stream.watsonplatform.net/speech-to-text/api"; + private const string defaultServiceUrl = "https://stream.watsonplatform.net/speech-to-text/api"; #region VersionDate #endregion @@ -63,9 +63,10 @@ public SpeechToTextService() : this(ConfigBasedAuthenticatorFactory.GetAuthentic public SpeechToTextService(Authenticator authenticator) : base(authenticator, serviceId) { Authenticator = authenticator; - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -107,7 +108,7 @@ public bool ListModels(Callback callback) req.OnResponse = OnListModelsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/models", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/models", GetServiceUrl()); if (connector == null) { return false; @@ -182,7 +183,7 @@ public bool GetModel(Callback callback, string modelId) req.OnResponse = OnGetModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/models/{0}", modelId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/models/{0}", modelId), GetServiceUrl()); if (connector == null) { return false; @@ -541,7 +542,7 @@ public bool Recognize(Callback callback, byte[] audio, req.OnResponse = OnRecognizeResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/recognize", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/recognize", GetServiceUrl()); if (connector == null) { return false; @@ -653,7 +654,7 @@ public bool RegisterCallback(Callback callback, string callbackU req.OnResponse = OnRegisterCallbackResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/register_callback", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/register_callback", GetServiceUrl()); if (connector == null) { return false; @@ -732,7 +733,7 @@ public bool UnregisterCallback(Callback callback, string callbackUrl) req.OnResponse = OnUnregisterCallbackResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/unregister_callback", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/unregister_callback", GetServiceUrl()); if (connector == null) { return false; @@ -1170,7 +1171,7 @@ public bool CreateJob(Callback callback, byte[] audio, string co req.OnResponse = OnCreateJobResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/recognitions", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/recognitions", GetServiceUrl()); if (connector == null) { return false; @@ -1245,7 +1246,7 @@ public bool CheckJobs(Callback callback) req.OnResponse = OnCheckJobsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/recognitions", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/recognitions", GetServiceUrl()); if (connector == null) { return false; @@ -1327,7 +1328,7 @@ public bool CheckJob(Callback callback, string id) req.OnResponse = OnCheckJobResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/recognitions/{0}", id), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/recognitions/{0}", id), GetServiceUrl()); if (connector == null) { return false; @@ -1404,7 +1405,7 @@ public bool DeleteJob(Callback callback, string id) req.OnResponse = OnDeleteJobResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/recognitions/{0}", id), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/recognitions/{0}", id), GetServiceUrl()); if (connector == null) { return false; @@ -1523,7 +1524,7 @@ public bool CreateLanguageModel(Callback callback, string name, s req.OnResponse = OnCreateLanguageModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", GetServiceUrl()); if (connector == null) { return false; @@ -1603,7 +1604,7 @@ public bool ListLanguageModels(Callback callback, string languag req.OnResponse = OnListLanguageModelsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", GetServiceUrl()); if (connector == null) { return false; @@ -1679,7 +1680,7 @@ public bool GetLanguageModel(Callback callback, string customizat req.OnResponse = OnGetLanguageModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -1756,7 +1757,7 @@ public bool DeleteLanguageModel(Callback callback, string customizationI req.OnResponse = OnDeleteLanguageModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -1883,7 +1884,7 @@ public bool TrainLanguageModel(Callback callback, string custo req.OnResponse = OnTrainLanguageModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/train", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/train", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -1961,7 +1962,7 @@ public bool ResetLanguageModel(Callback callback, string customizationId req.OnResponse = OnResetLanguageModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/reset", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/reset", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -2047,7 +2048,7 @@ public bool UpgradeLanguageModel(Callback callback, string customization req.OnResponse = OnUpgradeLanguageModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/upgrade_model", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/upgrade_model", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -2124,7 +2125,7 @@ public bool ListCorpora(Callback callback, string customizationId) req.OnResponse = OnListCorporaResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -2270,7 +2271,7 @@ public bool AddCorpus(Callback callback, string customizationId, string req.OnResponse = OnAddCorpusResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora/{1}", customizationId, corpusName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora/{1}", customizationId, corpusName), GetServiceUrl()); if (connector == null) { return false; @@ -2350,7 +2351,7 @@ public bool GetCorpus(Callback callback, string customizationId, string req.OnResponse = OnGetCorpusResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora/{1}", customizationId, corpusName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora/{1}", customizationId, corpusName), GetServiceUrl()); if (connector == null) { return false; @@ -2433,7 +2434,7 @@ public bool DeleteCorpus(Callback callback, string customizationId, stri req.OnResponse = OnDeleteCorpusResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora/{1}", customizationId, corpusName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/corpora/{1}", customizationId, corpusName), GetServiceUrl()); if (connector == null) { return false; @@ -2532,7 +2533,7 @@ public bool ListWords(Callback callback, string customizationId, string w req.OnResponse = OnListWordsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -2659,7 +2660,7 @@ public bool AddWords(Callback callback, string customizationId, List callback, string customizationId, string wo req.OnResponse = OnAddWordResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, wordName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, wordName), GetServiceUrl()); if (connector == null) { return false; @@ -2876,7 +2877,7 @@ public bool GetWord(Callback callback, string customizationId, string word req.OnResponse = OnGetWordResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, wordName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, wordName), GetServiceUrl()); if (connector == null) { return false; @@ -2961,7 +2962,7 @@ public bool DeleteWord(Callback callback, string customizationId, string req.OnResponse = OnDeleteWordResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, wordName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, wordName), GetServiceUrl()); if (connector == null) { return false; @@ -3038,7 +3039,7 @@ public bool ListGrammars(Callback callback, string customizationId) req.OnResponse = OnListGrammarsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -3184,7 +3185,7 @@ public bool AddGrammar(Callback callback, string customizationId, string req.OnResponse = OnAddGrammarResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars/{1}", customizationId, grammarName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars/{1}", customizationId, grammarName), GetServiceUrl()); if (connector == null) { return false; @@ -3264,7 +3265,7 @@ public bool GetGrammar(Callback callback, string customizationId, strin req.OnResponse = OnGetGrammarResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars/{1}", customizationId, grammarName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars/{1}", customizationId, grammarName), GetServiceUrl()); if (connector == null) { return false; @@ -3347,7 +3348,7 @@ public bool DeleteGrammar(Callback callback, string customizationId, str req.OnResponse = OnDeleteGrammarResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars/{1}", customizationId, grammarName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/grammars/{1}", customizationId, grammarName), GetServiceUrl()); if (connector == null) { return false; @@ -3445,7 +3446,7 @@ public bool CreateAcousticModel(Callback callback, string name, s req.OnResponse = OnCreateAcousticModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/acoustic_customizations", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/acoustic_customizations", GetServiceUrl()); if (connector == null) { return false; @@ -3525,7 +3526,7 @@ public bool ListAcousticModels(Callback callback, string languag req.OnResponse = OnListAcousticModelsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/acoustic_customizations", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/acoustic_customizations", GetServiceUrl()); if (connector == null) { return false; @@ -3601,7 +3602,7 @@ public bool GetAcousticModel(Callback callback, string customizat req.OnResponse = OnGetAcousticModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -3678,7 +3679,7 @@ public bool DeleteAcousticModel(Callback callback, string customizationI req.OnResponse = OnDeleteAcousticModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -3801,7 +3802,7 @@ public bool TrainAcousticModel(Callback callback, string custo req.OnResponse = OnTrainAcousticModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/train", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/train", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -3881,7 +3882,7 @@ public bool ResetAcousticModel(Callback callback, string customizationId req.OnResponse = OnResetAcousticModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/reset", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/reset", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -3992,7 +3993,7 @@ public bool UpgradeAcousticModel(Callback callback, string customization req.OnResponse = OnUpgradeAcousticModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/upgrade_model", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/upgrade_model", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -4071,7 +4072,7 @@ public bool ListAudio(Callback callback, string customizationId) req.OnResponse = OnListAudioResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -4283,7 +4284,7 @@ public bool AddAudio(Callback callback, string customizationId, string a req.OnResponse = OnAddAudioResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio/{1}", customizationId, audioName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio/{1}", customizationId, audioName), GetServiceUrl()); if (connector == null) { return false; @@ -4376,7 +4377,7 @@ public bool GetAudio(Callback callback, string customizationId, st req.OnResponse = OnGetAudioResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio/{1}", customizationId, audioName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio/{1}", customizationId, audioName), GetServiceUrl()); if (connector == null) { return false; @@ -4461,7 +4462,7 @@ public bool DeleteAudio(Callback callback, string customizationId, strin req.OnResponse = OnDeleteAudioResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio/{1}", customizationId, audioName), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/acoustic_customizations/{0}/audio/{1}", customizationId, audioName), GetServiceUrl()); if (connector == null) { return false; @@ -4544,7 +4545,7 @@ public bool DeleteUserData(Callback callback, string customerId) req.OnResponse = OnDeleteUserDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/TextToSpeech/V1/TextToSpeechService.cs b/Scripts/Services/TextToSpeech/V1/TextToSpeechService.cs index 531d6e69e..f251f0480 100644 --- a/Scripts/Services/TextToSpeech/V1/TextToSpeechService.cs +++ b/Scripts/Services/TextToSpeech/V1/TextToSpeechService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.TextToSpeech.V1 public partial class TextToSpeechService : BaseService { private const string serviceId = "text_to_speech"; - private const string defaultUrl = "https://stream.watsonplatform.net/text-to-speech/api"; + private const string defaultServiceUrl = "https://stream.watsonplatform.net/text-to-speech/api"; #region VersionDate #endregion @@ -63,9 +63,10 @@ public TextToSpeechService() : this(ConfigBasedAuthenticatorFactory.GetAuthentic public TextToSpeechService(Authenticator authenticator) : base(authenticator, serviceId) { Authenticator = authenticator; - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -108,7 +109,7 @@ public bool ListVoices(Callback callback) req.OnResponse = OnListVoicesResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/voices", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/voices", GetServiceUrl()); if (connector == null) { return false; @@ -192,7 +193,7 @@ public bool GetVoice(Callback callback, string voice, string customizatio req.OnResponse = OnGetVoiceResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/voices/{0}", voice), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/voices/{0}", voice), GetServiceUrl()); if (connector == null) { return false; @@ -368,7 +369,7 @@ public bool Synthesize(Callback callback, string text, string accept = n req.OnResponse = OnSynthesizeResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/synthesize", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/synthesize", GetServiceUrl()); if (connector == null) { return false; @@ -462,7 +463,7 @@ public bool GetPronunciation(Callback callback, string text, stri req.OnResponse = OnGetPronunciationResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/pronunciation", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/pronunciation", GetServiceUrl()); if (connector == null) { return false; @@ -554,7 +555,7 @@ public bool CreateVoiceModel(Callback callback, string name, string req.OnResponse = OnCreateVoiceModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", GetServiceUrl()); if (connector == null) { return false; @@ -636,7 +637,7 @@ public bool ListVoiceModels(Callback callback, string language = nu req.OnResponse = OnListVoiceModelsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/customizations", GetServiceUrl()); if (connector == null) { return false; @@ -748,7 +749,7 @@ public bool UpdateVoiceModel(Callback callback, string customizationId, req.OnResponse = OnUpdateVoiceModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -826,7 +827,7 @@ public bool GetVoiceModel(Callback callback, string customizationId) req.OnResponse = OnGetVoiceModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -903,7 +904,7 @@ public bool DeleteVoiceModel(Callback callback, string customizationId) req.OnResponse = OnDeleteVoiceModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -1013,7 +1014,7 @@ public bool AddWords(Callback callback, string customizationId, List callback, string customizationId) req.OnResponse = OnListWordsResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words", customizationId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words", customizationId), GetServiceUrl()); if (connector == null) { return false; @@ -1208,7 +1209,7 @@ public bool AddWord(Callback callback, string customizationId, string wo req.OnResponse = OnAddWordResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, word), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, word), GetServiceUrl()); if (connector == null) { return false; @@ -1289,7 +1290,7 @@ public bool GetWord(Callback callback, string customizationId, stri req.OnResponse = OnGetWordResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, word), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, word), GetServiceUrl()); if (connector == null) { return false; @@ -1369,7 +1370,7 @@ public bool DeleteWord(Callback callback, string customizationId, string req.OnResponse = OnDeleteWordResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, word), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v1/customizations/{0}/words/{1}", customizationId, word), GetServiceUrl()); if (connector == null) { return false; @@ -1452,7 +1453,7 @@ public bool DeleteUserData(Callback callback, string customerId) req.OnResponse = OnDeleteUserDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v1/user_data", GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/ToneAnalyzer/V3/ToneAnalyzerService.cs b/Scripts/Services/ToneAnalyzer/V3/ToneAnalyzerService.cs index a4fe2e98a..e1a4f41e4 100644 --- a/Scripts/Services/ToneAnalyzer/V3/ToneAnalyzerService.cs +++ b/Scripts/Services/ToneAnalyzer/V3/ToneAnalyzerService.cs @@ -32,7 +32,7 @@ namespace IBM.Watson.ToneAnalyzer.V3 public partial class ToneAnalyzerService : BaseService { private const string serviceId = "tone_analyzer"; - private const string defaultUrl = "https://gateway.watsonplatform.net/tone-analyzer/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/tone-analyzer/api"; #region VersionDate private string versionDate; @@ -81,9 +81,10 @@ public ToneAnalyzerService(string versionDate, Authenticator authenticator) : ba VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -187,7 +188,7 @@ public bool Tone(Callback callback, ToneInput toneInput, string co req.OnResponse = OnToneResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/tone", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/tone", GetServiceUrl()); if (connector == null) { return false; @@ -296,7 +297,7 @@ public bool ToneChat(Callback callback, List utter req.OnResponse = OnToneChatResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/tone_chat", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/tone_chat", GetServiceUrl()); if (connector == null) { return false; diff --git a/Scripts/Services/VisualRecognition/V3/VisualRecognitionService.cs b/Scripts/Services/VisualRecognition/V3/VisualRecognitionService.cs index d925dc3c3..5a0bfa4b2 100644 --- a/Scripts/Services/VisualRecognition/V3/VisualRecognitionService.cs +++ b/Scripts/Services/VisualRecognition/V3/VisualRecognitionService.cs @@ -31,7 +31,7 @@ namespace IBM.Watson.VisualRecognition.V3 public partial class VisualRecognitionService : BaseService { private const string serviceId = "visual_recognition"; - private const string defaultUrl = "https://gateway.watsonplatform.net/visual-recognition/api"; + private const string defaultServiceUrl = "https://gateway.watsonplatform.net/visual-recognition/api"; #region VersionDate private string versionDate; @@ -80,9 +80,10 @@ public VisualRecognitionService(string versionDate, Authenticator authenticator) VersionDate = versionDate; } - if (string.IsNullOrEmpty(serviceUrl)) + + if (string.IsNullOrEmpty(GetServiceUrl())) { - serviceUrl = defaultUrl; + SetServiceUrl(defaultServiceUrl); } } @@ -174,7 +175,7 @@ public bool Classify(Callback callback, System.IO.MemoryStream req.OnResponse = OnClassifyResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/classify", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/classify", GetServiceUrl()); if (connector == null) { return false; @@ -208,111 +209,6 @@ private void OnClassifyResponse(RESTConnector.Request req, RESTConnector.Respons ((RequestObject)req).Callback(response, resp.Error); } /// - /// Detect faces in images. - /// - /// **Important:** On April 2, 2018, the identity information in the response to calls to the Face model was - /// removed. The identity information refers to the `name` of the person, `score`, and `type_hierarchy` - /// knowledge graph. For details about the enhanced Face model, see the [Release - /// notes](https://cloud.ibm.com/docs/services/visual-recognition?topic=visual-recognition-release-notes#2april2018). - /// - /// Analyze and get data about faces in images. Responses can include estimated age and gender. This feature - /// uses a built-in model, so no training is necessary. The **Detect faces** method does not support general - /// biometric facial recognition. - /// - /// Supported image formats include .gif, .jpg, .png, and .tif. The maximum image size is 10 MB. The minimum - /// recommended pixel density is 32X32 pixels, but the service tends to perform better with images that are at - /// least 224 x 224 pixels. - /// - /// The callback function that is invoked when the operation completes. - /// An image file (gif, .jpg, .png, .tif.) or .zip file with images. Limit the .zip - /// file to 100 MB. You can include a maximum of 15 images in a request. - /// - /// Encode the image and .zip file names in UTF-8 if they contain non-ASCII characters. The service assumes - /// UTF-8 encoding if it encounters non-ASCII characters. - /// - /// You can also include an image with the **url** parameter. (optional) - /// The filename for imagesFile. (optional) - /// The content type of imagesFile. (optional) - /// The URL of an image to analyze. Must be in .gif, .jpg, .png, or .tif format. The minimum - /// recommended pixel density is 32X32 pixels, but the service tends to perform better with images that are at - /// least 224 x 224 pixels. The maximum image size is 10 MB. Redirects are followed, so you can use a shortened - /// URL. - /// - /// You can also include images with the **images_file** parameter. (optional) - /// The desired language of parts of the response. See the response for details. - /// (optional, default to en) - /// DetectedFaces - public bool DetectFaces(Callback callback, System.IO.MemoryStream imagesFile = null, string imagesFilename = null, string imagesFileContentType = null, string url = null, string acceptLanguage = null) - { - if (callback == null) - throw new ArgumentNullException("`callback` is required for `DetectFaces`"); - - RequestObject req = new RequestObject - { - Callback = callback, - HttpMethod = UnityWebRequest.kHttpVerbPOST, - DisableSslVerification = DisableSslVerification - }; - - foreach (KeyValuePair kvp in customRequestHeaders) - { - req.Headers.Add(kvp.Key, kvp.Value); - } - - ClearCustomRequestHeaders(); - - foreach (KeyValuePair kvp in Common.GetSdkHeaders("watson_vision_combined", "V3", "DetectFaces")) - { - req.Headers.Add(kvp.Key, kvp.Value); - } - - req.Parameters["version"] = VersionDate; - req.Forms = new Dictionary(); - if (imagesFile != null) - { - req.Forms["images_file"] = new RESTConnector.Form(imagesFile, imagesFilename, imagesFileContentType); - } - if (!string.IsNullOrEmpty(url)) - { - req.Forms["url"] = new RESTConnector.Form(url); - } - - req.OnResponse = OnDetectFacesResponse; - - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/detect_faces", serviceUrl); - if (connector == null) - { - return false; - } - - return connector.Send(req); - } - - private void OnDetectFacesResponse(RESTConnector.Request req, RESTConnector.Response resp) - { - DetailedResponse response = new DetailedResponse(); - foreach (KeyValuePair kvp in resp.Headers) - { - response.Headers.Add(kvp.Key, kvp.Value); - } - response.StatusCode = resp.HttpResponseCode; - - try - { - string json = Encoding.UTF8.GetString(resp.Data); - response.Result = JsonConvert.DeserializeObject(json); - response.Response = json; - } - catch (Exception e) - { - Log.Error("VisualRecognitionService.OnDetectFacesResponse()", "Exception: {0}", e.ToString()); - resp.Success = false; - } - - if (((RequestObject)req).Callback != null) - ((RequestObject)req).Callback(response, resp.Error); - } - /// /// Create a classifier. /// /// Train a new multi-faceted classifier on the uploaded image data. Create your custom classifier with positive @@ -398,7 +294,7 @@ public bool CreateClassifier(Callback callback, string name, Diction req.OnResponse = OnCreateClassifierResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/classifiers", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/classifiers", GetServiceUrl()); if (connector == null) { return false; @@ -470,7 +366,7 @@ public bool ListClassifiers(Callback callback, bool? verbose = null req.OnResponse = OnListClassifiersResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/classifiers", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/classifiers", GetServiceUrl()); if (connector == null) { return false; @@ -541,7 +437,7 @@ public bool GetClassifier(Callback callback, string classifierId) req.OnResponse = OnGetClassifierResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}", classifierId), GetServiceUrl()); if (connector == null) { return false; @@ -657,7 +553,7 @@ public bool UpdateClassifier(Callback callback, string classifierId, req.OnResponse = OnUpdateClassifierResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}", classifierId), GetServiceUrl()); if (connector == null) { return false; @@ -726,7 +622,7 @@ public bool DeleteClassifier(Callback callback, string classifierId) req.OnResponse = OnDeleteClassifierResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}", classifierId), GetServiceUrl()); if (connector == null) { return false; @@ -798,7 +694,7 @@ public bool GetCoreMlModel(Callback callback, string classifierId) req.OnResponse = OnGetCoreMlModelResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}/core_ml_model", classifierId), serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, string.Format("/v3/classifiers/{0}/core_ml_model", classifierId), GetServiceUrl()); if (connector == null) { return false; @@ -868,7 +764,7 @@ public bool DeleteUserData(Callback callback, string customerId) req.OnResponse = OnDeleteUserDataResponse; - RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/user_data", serviceUrl); + RESTConnector connector = RESTConnector.GetConnector(Authenticator, "/v3/user_data", GetServiceUrl()); if (connector == null) { return false; diff --git a/Tests/AssistantV1IntegrationTests.cs b/Tests/AssistantV1IntegrationTests.cs index 3be139c39..1ad73531e 100644 --- a/Tests/AssistantV1IntegrationTests.cs +++ b/Tests/AssistantV1IntegrationTests.cs @@ -88,17 +88,17 @@ public void TestSetup() public IEnumerator TestMessage() { workspaceId = Environment.GetEnvironmentVariable("ASSISTANT_WORKSPACE_ID"); - JToken context = null; + Context context = null; MessageResponse messageResponse = null; - JToken conversationId = null; + string conversationId = null; Log.Debug("AssistantV1IntegrationTests", "Attempting to Message...{0}...", workspaceId); service.Message( callback: (DetailedResponse response, IBMError error) => { messageResponse = response.Result; context = messageResponse.Context; - Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output["generic"][0]["text"]); - (context as JObject).TryGetValue("conversation_id", out conversationId); + Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output.Generic[0].Text); + conversationId = context.ConversationId; Assert.IsNotNull(context); Assert.IsNotNull(conversationId); Assert.IsNull(error); @@ -113,26 +113,30 @@ public IEnumerator TestMessage() service.WithHeader("X-Watson-Test", "1"); messageResponse = null; - JObject input = new JObject(); - JToken conversationId1 = null; + MessageInput input = new MessageInput(); + string conversationId1 = null; + context.Add("name", "watson"); input.Add("text", "Are you open on Christmas?"); + Log.Debug("AssistantV1IntegrationTests", "Attempting to Message...Are you open on Christmas?"); service.Message( callback: (DetailedResponse response, IBMError error) => { + Context context1 = null; messageResponse = response.Result; - context = messageResponse.Context; - Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output["generic"][0]["text"]); - (context as JObject).TryGetValue("conversation_id", out conversationId1); + context1 = messageResponse.Context; + Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output.Generic[0].Text); + conversationId1 = context1.ConversationId; + Assert.AreEqual(context1.Get("name"), context.Get("name")); Assert.IsNotNull(context); Assert.IsNotNull(conversationId1); - Assert.IsTrue(conversationId1.ToString() == conversationId.ToString()); + Assert.IsTrue(conversationId1 == conversationId); Assert.IsNull(error); }, workspaceId: workspaceId, input: input, - context: context as JObject, + context: context, nodesVisitedDetails: true ); @@ -142,8 +146,8 @@ public IEnumerator TestMessage() service.WithHeader("X-Watson-Test", "1"); messageResponse = null; - input = new JObject(); - JToken conversationId2 = null; + input = new MessageInput(); + string conversationId2 = null; input.Add("text", "What are your hours?"); Log.Debug("AssistantV1IntegrationTests", "Attempting to Message...What are your hours?"); service.Message( @@ -151,8 +155,8 @@ public IEnumerator TestMessage() { messageResponse = response.Result; context = messageResponse.Context; - Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output["generic"][0]["text"]); - (context as JObject).TryGetValue("conversation_id", out conversationId2); + Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output.Generic[0].Text); + conversationId2 = context.ConversationId; Assert.IsNotNull(context); Assert.IsNotNull(conversationId2); @@ -161,7 +165,7 @@ public IEnumerator TestMessage() }, workspaceId: workspaceId, input: input, - context: context as JObject, + context: context, nodesVisitedDetails: true ); @@ -171,8 +175,8 @@ public IEnumerator TestMessage() service.WithHeader("X-Watson-Test", "1"); messageResponse = null; - input = new JObject(); - JToken conversationId3 = null; + input = new MessageInput(); + string conversationId3 = null; input.Add("text", "I'd like to make an appointment for 12pm."); Log.Debug("AssistantV1IntegrationTests", "Attempting to Message...I'd like to make an appointment for 12pm."); service.Message( @@ -180,8 +184,8 @@ public IEnumerator TestMessage() { messageResponse = response.Result; context = messageResponse.Context; - Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output["generic"][0]["text"]); - (context as JObject).TryGetValue("conversation_id", out conversationId3); + Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output.Generic[0].Text); + conversationId3 = context.ConversationId; Assert.IsNotNull(context); Assert.IsNotNull(conversationId3); @@ -190,7 +194,7 @@ public IEnumerator TestMessage() }, workspaceId: workspaceId, input: input, - context: context as JObject, + context: context, nodesVisitedDetails: true ); @@ -200,8 +204,8 @@ public IEnumerator TestMessage() service.WithHeader("X-Watson-Test", "1"); messageResponse = null; - input = new JObject(); - JToken conversationId4 = null; + input = new MessageInput(); + string conversationId4 = null; input.Add("text", "On Friday please."); Log.Debug("AssistantV1IntegrationTests", "Attempting to Message...On Friday please."); service.Message( @@ -209,8 +213,8 @@ public IEnumerator TestMessage() { messageResponse = response.Result; context = messageResponse.Context; - Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output["generic"][0]["text"]); - (context as JObject).TryGetValue("conversation_id", out conversationId4); + Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output.Generic[0].Text); + conversationId4 = context.ConversationId; Assert.IsNotNull(context); Assert.IsNotNull(conversationId4); @@ -219,7 +223,7 @@ public IEnumerator TestMessage() }, workspaceId: workspaceId, input: input, - context: context as JObject, + context: context, nodesVisitedDetails: true ); @@ -229,8 +233,8 @@ public IEnumerator TestMessage() service.WithHeader("X-Watson-Test", "1"); messageResponse = null; - input = new JObject(); - JToken conversationId5 = null; + input = new MessageInput(); + string conversationId5 = null; input.Add("text", "Yes."); Log.Debug("AssistantV1IntegrationTests", "Attempting to Message...Yes."); service.Message( @@ -238,8 +242,8 @@ public IEnumerator TestMessage() { messageResponse = response.Result; context = messageResponse.Context; - Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output["generic"][0]["text"]); - (context as JObject).TryGetValue("conversation_id", out conversationId5); + Log.Debug("AssistantV1IntegrationTests", "result: {0}", messageResponse.Output.Generic[0].Text); + conversationId5 = context.ConversationId; Assert.IsNotNull(context); Assert.IsNotNull(conversationId5); @@ -248,7 +252,7 @@ public IEnumerator TestMessage() }, workspaceId: workspaceId, input: input, - context: context as JObject, + context: context, nodesVisitedDetails: true ); @@ -314,7 +318,7 @@ public IEnumerator TestGetWorkspace() [UnityTest, Order(3)] public IEnumerator TestListWorkspaces() { - Log.Debug("AssistantServiceV1IntegrationTests", "Attempting to ListWorkspaces...{0}", service.GetServiceUrl()); + Log.Debug("AssistantServiceV1IntegrationTests", "Attempting to ListWorkspaces..."); WorkspaceCollection listWorkspacesResponse = null; service.ListWorkspaces( callback: (DetailedResponse response, IBMError error) => diff --git a/Tests/DiscoveryV1IntegrationTests.cs b/Tests/DiscoveryV1IntegrationTests.cs index b37f38d4c..8d6c9f5d2 100644 --- a/Tests/DiscoveryV1IntegrationTests.cs +++ b/Tests/DiscoveryV1IntegrationTests.cs @@ -329,41 +329,6 @@ public IEnumerator TestUpdateConfiguration() } #endregion - #region TestConfigurationInEnvironment - [UnityTest, Order(8)] - public IEnumerator TestTestConfigurationInEnvironment() - { - Log.Debug("DiscoveryServiceV1IntegrationTests", "Attempting to TestConfigurationInEnvironment..."); - TestDocument testConfigurationInEnvironmentResponse = null; - using (FileStream fs = File.OpenRead(watsonBeatsJeopardyHtmlFilePath)) - { - using (MemoryStream ms = new MemoryStream()) - { - fs.CopyTo(ms); - service.TestConfigurationInEnvironment( - callback: (DetailedResponse response, IBMError error) => - { - Log.Debug("DiscoveryServiceV1IntegrationTests", "TestConfigurationInEnvironment result: {0}", response.Response); - testConfigurationInEnvironmentResponse = response.Result; - Assert.IsNotNull(testConfigurationInEnvironmentResponse); - Assert.IsNotNull(testConfigurationInEnvironmentResponse.Status); - Assert.IsNotNull(testConfigurationInEnvironmentResponse.Snapshots); - Assert.IsNull(error); - }, - environmentId: environmentId, - configurationId: createdConfigurationId, - file: ms, - fileContentType: Utility.GetMimeType(Path.GetExtension(watsonBeatsJeopardyHtmlFilePath)), - filename: Path.GetFileName(watsonBeatsJeopardyHtmlFilePath) - ); - - while (testConfigurationInEnvironmentResponse == null) - yield return null; - } - } - } - #endregion - #region CreateCollection [UnityTest, Order(9)] public IEnumerator TestCreateCollection() @@ -886,7 +851,6 @@ public IEnumerator TestFederatedQuery() }, environmentId: environmentId, naturalLanguageQuery: "When did Watson win Jeopardy", - collectionIds: collectionId, passages: true, count: 10, highlight: true diff --git a/Tests/VisualRecognitionV3IntegrationTests.cs b/Tests/VisualRecognitionV3IntegrationTests.cs index dc1aac9c6..269ca6d2f 100644 --- a/Tests/VisualRecognitionV3IntegrationTests.cs +++ b/Tests/VisualRecognitionV3IntegrationTests.cs @@ -41,7 +41,6 @@ public class VisualRecognitionV3IntegrationTests private string turtleImageFilepath; private string turtleImageContentType = "image/jpeg"; private string obamaImageFilepath; - private string obamaImageContentType = "image/jpeg"; private string imageMetadataFilepath; private string classifierName = "unity-sdk-classifier-safe-to-delete"; private string classifierId; @@ -161,41 +160,6 @@ public IEnumerator TestClassify() } #endregion - #region DetectFaces - [UnityTest, Order(2)] - public IEnumerator TestDetectFaces() - { - Log.Debug("VisualRecognitionServiceV3IntegrationTests", "Attempting to DetectFaces..."); - DetectedFaces detectFacesResponse = null; - using (FileStream fs = File.OpenRead(obamaImageFilepath)) - { - using (MemoryStream ms = new MemoryStream()) - { - fs.CopyTo(ms); - service.DetectFaces( - callback: (DetailedResponse response, IBMError error) => - { - Log.Debug("VisualRecognitionServiceV3IntegrationTests", "DetectFaces result: {0}", response.Response); - detectFacesResponse = response.Result; - Assert.IsNotNull(detectFacesResponse); - Assert.IsNotNull(detectFacesResponse.Images); - Assert.IsTrue(detectFacesResponse.Images.Count > 0); - Assert.IsNotNull(detectFacesResponse.Images[0].Faces); - Assert.IsTrue(detectFacesResponse.Images[0].Faces.Count > 0); - Assert.IsNull(error); - }, - imagesFile: ms, - imagesFileContentType: obamaImageContentType, - imagesFilename: Path.GetFileName(obamaImageFilepath) - ); - - while (detectFacesResponse == null) - yield return null; - } - } - } - #endregion - #region GetClassifier //[UnityTest, Order(3)] public IEnumerator TestGetClassifier()