Skip to content

Commit 215cd9a

Browse files
authored
Merge pull request #206 from watson-developer-cloud/4311-gdpr
Custom request and Response Headers
2 parents b6ba849 + c131247 commit 215cd9a

File tree

389 files changed

+12171
-2840
lines changed

Some content is hidden

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

389 files changed

+12171
-2840
lines changed

IBM.WatsonDeveloperCloud.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.WatsonDeveloperCloud.As
105105
EndProject
106106
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.WatsonDeveloperCloud.Assistant.v1.IntegrationTests", "test\IBM.WatsonDeveloperCloud.Assistant.v1.IntegrationTests\IBM.WatsonDeveloperCloud.Assistant.v1.IntegrationTests.csproj", "{8616701B-F226-4462-9949-DE1F2C88B194}"
107107
EndProject
108+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.WatsonDeveloperCloud.Assistant.v1.UnitTests", "test\IBM.WatsonDeveloperCloud.Assistant.v1.UnitTests\IBM.WatsonDeveloperCloud.Assistant.v1.UnitTests.csproj", "{3FA3418E-F5C5-463B-B371-FF38093A7D9D}"
109+
EndProject
108110
Global
109111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
110112
Debug|Any CPU = Debug|Any CPU
@@ -255,6 +257,10 @@ Global
255257
{8616701B-F226-4462-9949-DE1F2C88B194}.Debug|Any CPU.Build.0 = Debug|Any CPU
256258
{8616701B-F226-4462-9949-DE1F2C88B194}.Release|Any CPU.ActiveCfg = Release|Any CPU
257259
{8616701B-F226-4462-9949-DE1F2C88B194}.Release|Any CPU.Build.0 = Release|Any CPU
260+
{3FA3418E-F5C5-463B-B371-FF38093A7D9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
261+
{3FA3418E-F5C5-463B-B371-FF38093A7D9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
262+
{3FA3418E-F5C5-463B-B371-FF38093A7D9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
263+
{3FA3418E-F5C5-463B-B371-FF38093A7D9D}.Release|Any CPU.Build.0 = Release|Any CPU
258264
EndGlobalSection
259265
GlobalSection(SolutionProperties) = preSolution
260266
HideSolutionNode = FALSE
@@ -309,6 +315,7 @@ Global
309315
{E3D238D7-7A09-4447-B836-8D6ABF4BFF80} = {28E61676-E9FF-4DA9-99CC-5E0D16F02380}
310316
{60793E3F-EF8D-4FF8-9C69-33D1ADBC3C39} = {E3D238D7-7A09-4447-B836-8D6ABF4BFF80}
311317
{8616701B-F226-4462-9949-DE1F2C88B194} = {E3D238D7-7A09-4447-B836-8D6ABF4BFF80}
318+
{3FA3418E-F5C5-463B-B371-FF38093A7D9D} = {E3D238D7-7A09-4447-B836-8D6ABF4BFF80}
312319
EndGlobalSection
313320
GlobalSection(ExtensibilityGlobals) = postSolution
314321
SolutionGuid = {B9D9D17B-1C17-402F-B701-DC671528690A}

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,39 @@ You can get the latest SDK packages through NuGet. Installation instructions can
3737

3838
Or manually [here][latest_release].
3939

40+
## Custom Request Headers
41+
You can send custom request headers by adding them to the `customData` object.
42+
```cs
43+
void Example()
44+
{
45+
AssistantService assistant = new AssistantService("<username>", "<password>", "<version-date>");
46+
47+
// Create customData object
48+
Dictionary<string, object> customData = new Dictionary<string, object>();
49+
// Create a dictionary of custom headers
50+
Dictionary<string, string> customHeaders = new Dictionary<string, string>();
51+
// Add to the header dictionary
52+
customHeaders.Add("X-Watson-Metadata", "customer_id=some-assistant-customer-id");
53+
// Add the header dictionary to the custom data object
54+
customData.Add(Constants.String.CUSTOM_REQUEST_HEADERS, customHeaders);
55+
56+
var results = assistant.Message("<workspace-id>", "<message-request>", customData: customData);
57+
}
58+
```
59+
60+
## Response Headers
61+
You can get the response headers and the raw json response in the result object.
62+
```cs
63+
void Example()
64+
{
65+
AssistantService assistant = new AssistantService("<username>", "<password>", "<version-date>");
66+
var results = assistant.Message("<workspace-id>", "<message-request>");
67+
68+
var responseHeaders = results.ResponseHeaders; // The response headers
69+
var responseJson = results.ResponseJson; // The raw response json
70+
}
71+
```
72+
4073
## Documentation
4174
Click [here][dotnet-standard-sdk-documentation] for documentation by release and branch.
4275

examples/IBM.WatsonDeveloperCloud.SpeechToText.v1.Example/SpeechToTextServiceExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class SpeechToTextServiceExample
3232
{
3333
private AutoResetEvent autoEvent = new AutoResetEvent(false);
3434
private static string credentials = string.Empty;
35-
private string EN_US = "en-US_BroadbandModel";
35+
//private string EN_US = "en-US_BroadbandModel";
3636
//private string _customModelName = "dotnet-integration-test-custom-model";
3737
//private string _customModelDescription = "A custom model to test .NET SDK Speech to Text customization.";
3838
//private string _corpusName = "The Jabberwocky";
@@ -193,7 +193,7 @@ public SpeechToTextServiceExample(string url, string username, string password)
193193
var acousticModel = new CreateAcousticModel
194194
{
195195
Name = _acousticModelName,
196-
BaseModelName = EN_US,
196+
BaseModelName = Model.CreateAcousticModel.BaseModelNameEnum.EN_US_BROADBANDMODEL,
197197
Description = _acousticModelDescription
198198
};
199199

0 commit comments

Comments
 (0)