Skip to content

Commit 36d97b8

Browse files
committed
Add SetCredential(apikey) to vis rec extension
1 parent 453ab3a commit 36d97b8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/IBM.WatsonDeveloperCloud.VisualRecognition.v3/IVisualRecognitionServiceExtension.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
namespace IBM.WatsonDeveloperCloud.VisualRecognition.v3
2323
{
2424
public partial interface IVisualRecognitionService
25-
{
25+
{
26+
void SetCredential(string apikey);
27+
2628
Classifier CreateClassifier(CreateClassifier createClassifier, Dictionary<string, object> customData = null);
2729

2830
Classifier UpdateClassifier(UpdateClassifier updateClassifier, Dictionary<string, object> customData = null);

src/IBM.WatsonDeveloperCloud.VisualRecognition.v3/VisualRecognitionServiceExtension.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ namespace IBM.WatsonDeveloperCloud.VisualRecognition.v3
3232
{
3333
public partial class VisualRecognitionService : WatsonService, IVisualRecognitionService
3434
{
35+
/// <summary>
36+
/// Sets the apikey of the service.
37+
/// Also sets the endpoint if the user has not set the endpoint.
38+
/// </summary>
39+
/// <param name="apikey"></param>
40+
private void SetCredential(string apikey)
41+
{
42+
this.ApiKey = apikey;
43+
if (!_userSetEndpoint)
44+
this.Endpoint = "https://gateway-a.watsonplatform.net/visual-recognition/api";
45+
}
46+
3547
/// <summary>
3648
/// Create a classifier. Train a new multi-faceted classifier on the uploaded image data. Create your custom classifier with positive or negative examples. Include at least two sets of examples, either two positive example files or one positive and one negative file. You can upload a maximum of 256 MB per call. Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image file names, and classifier and class names). The service assumes UTF-8 encoding if it encounters non-ASCII characters.
3749
/// </summary>

0 commit comments

Comments
 (0)