@@ -109,7 +109,7 @@ public class VisualRecognition : IWatsonService
109109 public bool Classify ( string url , OnClassify callback , string [ ] owners = default ( string [ ] ) , string [ ] classifierIDs = default ( string [ ] ) , float threshold = default ( float ) , string acceptLanguage = "en" )
110110 {
111111 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
112- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
112+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
113113 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
114114 throw new WatsonException ( "FindClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
115115 if ( string . IsNullOrEmpty ( url ) )
@@ -151,7 +151,7 @@ public class VisualRecognition : IWatsonService
151151 public bool Classify ( OnClassify callback , string imagePath , string [ ] owners = default ( string [ ] ) , string [ ] classifierIDs = default ( string [ ] ) , float threshold = default ( float ) , string acceptLanguage = "en" )
152152 {
153153 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
154- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
154+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
155155 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
156156 throw new WatsonException ( "FindClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
157157 if ( callback == null )
@@ -259,7 +259,7 @@ public bool DetectFaces(string url, OnDetectFaces callback)
259259 if ( callback == null )
260260 throw new ArgumentNullException ( "callback" ) ;
261261 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
262- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
262+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
263263 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
264264 throw new WatsonException ( "FindClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
265265
@@ -288,7 +288,7 @@ public bool DetectFaces(OnDetectFaces callback, string imagePath)
288288 if ( string . IsNullOrEmpty ( imagePath ) )
289289 throw new ArgumentNullException ( "Define an image path to classify!" ) ;
290290 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
291- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
291+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
292292 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
293293 throw new WatsonException ( "FindClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
294294
@@ -392,7 +392,7 @@ public bool RecognizeText(string url, OnRecognizeText callback)
392392 if ( callback == null )
393393 throw new ArgumentNullException ( "callback" ) ;
394394 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
395- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
395+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
396396 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
397397 throw new WatsonException ( "FindClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
398398
@@ -421,7 +421,7 @@ public bool RecognizeText(OnRecognizeText callback, string imagePath)
421421 if ( string . IsNullOrEmpty ( imagePath ) )
422422 throw new ArgumentNullException ( "Define an image path to classify!" ) ;
423423 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
424- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
424+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
425425 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
426426 throw new WatsonException ( "FindClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
427427
@@ -545,7 +545,7 @@ public FindClassifierReq(VisualRecognition service, string classifierName, OnFin
545545 if ( string . IsNullOrEmpty ( classifierName ) )
546546 throw new WatsonException ( "classifierName required" ) ;
547547 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
548- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
548+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
549549 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
550550 throw new WatsonException ( "FindClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
551551
@@ -598,7 +598,7 @@ public bool GetClassifiers(OnGetClassifiers callback)
598598 if ( callback == null )
599599 throw new ArgumentNullException ( "callback" ) ;
600600 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
601- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
601+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
602602 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
603603 throw new WatsonException ( "GetClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
604604
@@ -662,7 +662,7 @@ public bool GetClassifier(string classifierId, OnGetClassifier callback)
662662 if ( callback == null )
663663 throw new ArgumentNullException ( "callback" ) ;
664664 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
665- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
665+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
666666 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
667667 throw new WatsonException ( "GetClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
668668
@@ -728,7 +728,7 @@ private void OnGetClassifierResp(RESTConnector.Request req, RESTConnector.Respon
728728 public bool TrainClassifier ( string classifierName , string className , string positiveExamplesPath , string negativeExamplesPath , OnTrainClassifier callback )
729729 {
730730 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
731- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
731+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
732732 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
733733 throw new WatsonException ( "GetClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
734734 if ( string . IsNullOrEmpty ( classifierName ) )
@@ -764,7 +764,7 @@ public bool TrainClassifier(string classifierName, string className, string posi
764764 private bool UploadClassifier ( string classifierName , string className , byte [ ] positiveExamplesData , byte [ ] negativeExamplesData , OnTrainClassifier callback )
765765 {
766766 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
767- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
767+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
768768 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
769769 throw new WatsonException ( "GetClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
770770 if ( string . IsNullOrEmpty ( classifierName ) )
@@ -842,7 +842,7 @@ public bool DeleteClassifier(string classifierId, OnDeleteClassifier callback)
842842 if ( callback == null )
843843 throw new ArgumentNullException ( "callback" ) ;
844844 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
845- mp_ApiKey = Config . Instance . GetVariableValue ( "VISUAL_RECOGNITION_API_KEY" ) ;
845+ mp_ApiKey = Config . Instance . GetAPIKey ( SERVICE_ID ) ;
846846 if ( string . IsNullOrEmpty ( mp_ApiKey ) )
847847 throw new WatsonException ( "GetClassifier - VISUAL_RECOGNITION_API_KEY needs to be defined in config.json" ) ;
848848
0 commit comments