Skip to content

Commit 48d5b37

Browse files
committed
test: Remove customData from tests and exaamples
1 parent d1bbee8 commit 48d5b37

16 files changed

+268
-550
lines changed

Examples/ExampleStreaming.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private IEnumerator RecordingHandler()
205205
yield break;
206206
}
207207

208-
private void OnRecognize(SpeechRecognitionEvent result, Dictionary<string, object> customData)
208+
private void OnRecognize(SpeechRecognitionEvent result)
209209
{
210210
if (result != null && result.results.Length > 0)
211211
{
@@ -239,7 +239,7 @@ private void OnRecognize(SpeechRecognitionEvent result, Dictionary<string, objec
239239
}
240240
}
241241

242-
private void OnRecognizeSpeaker(SpeakerRecognitionEvent result, Dictionary<string, object> customData)
242+
private void OnRecognizeSpeaker(SpeakerRecognitionEvent result)
243243
{
244244
if (result != null)
245245
{

Scripts/Services/SpeechToText/V1/SpeechToTextServiceExtension.cs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ public float SilenceThreshold
246246
/// This callback object is used by the Recognize() and StartListening() methods.
247247
/// </summary>
248248
/// <param name="results">The ResultList object containing the results.</param>
249-
public delegate void OnRecognize(SpeechRecognitionEvent results, Dictionary<string, object> customData = null);
249+
public delegate void OnRecognize(SpeechRecognitionEvent results);
250250

251251
/// <summary>
252252
/// This callback object is used by the RecognizeSpeaker() method.
253253
/// </summary>
254254
/// <param name="speakerRecognitionEvent">Array of speaker label results.</param>
255-
public delegate void OnRecognizeSpeaker(SpeakerRecognitionEvent speakerRecognitionEvent, Dictionary<string, object> customData = null);
255+
public delegate void OnRecognizeSpeaker(SpeakerRecognitionEvent speakerRecognitionEvent);
256256

257257
/// <summary>
258258
/// This starts the service listening and it will invoke the callback for any recognized speech.
@@ -262,25 +262,19 @@ public float SilenceThreshold
262262
/// <param name="callback">All recognize results are passed to this callback.</param>
263263
/// <param name="speakerLabelCallback">Speaker label goes through this callback if it arrives separately from recognize result.</param>
264264
/// <returns>Returns true on success, false on failure.</returns>
265-
public bool StartListening(OnRecognize callback, OnRecognizeSpeaker speakerLabelCallback = null, Dictionary<string, object> customData = null)
265+
public bool StartListening(OnRecognize callback, OnRecognizeSpeaker speakerLabelCallback = null)
266266
{
267267
if (callback == null)
268268
throw new ArgumentNullException("callback");
269269
if (_isListening)
270270
return false;
271271
if (!CreateListenConnector())
272272
return false;
273-
274-
if (customData == null)
275-
customData = new Dictionary<string, object>();
276-
273+
277274
Dictionary<string, string> customHeaders = new Dictionary<string, string>();
278-
if (customData.ContainsKey(Constants.String.CUSTOM_REQUEST_HEADERS))
275+
foreach (KeyValuePair<string, string> kvp in customRequestHeaders)
279276
{
280-
foreach (KeyValuePair<string, string> kvp in customData[Constants.String.CUSTOM_REQUEST_HEADERS] as Dictionary<string, string>)
281-
{
282-
customHeaders.Add(kvp.Key, kvp.Value);
283-
}
277+
customHeaders.Add(kvp.Key, kvp.Value);
284278
}
285279

286280
if (customHeaders != null && _listenSocket != null)
@@ -539,10 +533,10 @@ private void OnListenMessage(WSConnector.Message msg)
539533
if (msg is WSConnector.TextMessage)
540534
{
541535
WSConnector.TextMessage tm = (WSConnector.TextMessage)msg;
542-
Dictionary<string, object> customData = new Dictionary<string, object>();
543-
customData.Add(Constants.String.JSON, tm.Text);
544-
if (tm.Headers != null && tm.Headers.Count > 0)
545-
customData.Add(Constants.String.RESPONSE_HEADERS, tm.Headers);
536+
//Dictionary<string, object> customData = new Dictionary<string, object>();
537+
//customData.Add(Constants.String.JSON, tm.Text);
538+
//if (tm.Headers != null && tm.Headers.Count > 0)
539+
// customData.Add(Constants.String.RESPONSE_HEADERS, tm.Headers);
546540

547541
IDictionary json = Json.Deserialize(tm.Text) as IDictionary;
548542
if (json != null)
@@ -558,7 +552,7 @@ private void OnListenMessage(WSConnector.Message msg)
558552
// SendStart();
559553

560554
if (_listenCallback != null)
561-
_listenCallback(results, customData);
555+
_listenCallback(results);
562556
else
563557
StopListening(); // automatically stop listening if our callback is destroyed.
564558
}

Scripts/Services/VisualRecognition/V3/VisualRecognitionService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ private void OnDetectFacesResponse(RESTConnector.Request req, RESTConnector.Resp
376376
///
377377
/// Encode special characters in the file name in UTF-8. (optional)</param>
378378
/// <returns><see cref="Classifier" />Classifier</returns>
379-
public bool CreateClassifier(Callback<Classifier> callback, string name, System.IO.FileStream positiveExamples, System.IO.FileStream negativeExamples = null)
379+
public bool CreateClassifier(Callback<Classifier> callback, string name, Dictionary<string, System.IO.FileStream> positiveExamples, System.IO.FileStream negativeExamples = null)
380380
{
381381
if (callback == null)
382382
throw new ArgumentNullException("`callback` is required for `CreateClassifier`");
@@ -705,7 +705,7 @@ private void OnListClassifiersResponse(RESTConnector.Request req, RESTConnector.
705705
///
706706
/// Encode special characters in the file name in UTF-8. (optional)</param>
707707
/// <returns><see cref="Classifier" />Classifier</returns>
708-
public bool UpdateClassifier(Callback<Classifier> callback, string classifierId, System.IO.FileStream positiveExamples = null, System.IO.FileStream negativeExamples = null)
708+
public bool UpdateClassifier(Callback<Classifier> callback, string classifierId, Dictionary<string, System.IO.FileStream> positiveExamples = null, System.IO.FileStream negativeExamples = null)
709709
{
710710
if (callback == null)
711711
throw new ArgumentNullException("`callback` is required for `UpdateClassifier`");

0 commit comments

Comments
 (0)