Skip to content

Commit c746a85

Browse files
authored
Merge pull request #255 from watson-developer-cloud/248-move-set-credentials-apikey
Move SetCredential(apikey)
2 parents 0494b00 + 4d890aa commit c746a85

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
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+
public 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>

src/IBM.WatsonDeveloperCloud/Service/IWatsonService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public interface IWatsonService
3030
string Password { get; set; }
3131

3232
void SetCredential(string userName, string password);
33-
void SetCredential(string apikey);
3433
void SetCredential(TokenOptions tokenOptions);
3534
void SetEndpoint(string endpoint);
3635
}

src/IBM.WatsonDeveloperCloud/Service/WatsonService.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,7 @@ public void SetCredential(string userName, string password)
9292
this.UserName = userName;
9393
this.Password = password;
9494
}
95-
96-
/// <summary>
97-
/// Sets the apikey of the service.
98-
/// Also sets the endpoint if the user has not set the endpoint.
99-
/// </summary>
100-
/// <param name="apikey"></param>
101-
public void SetCredential(string apikey)
102-
{
103-
this.ApiKey = apikey;
104-
if (!_userSetEndpoint)
105-
this.Endpoint = "https://gateway-a.watsonplatform.net/visual-recognition/api";
106-
}
107-
95+
10896
/// <summary>
10997
/// Sets the tokenOptions for the service.
11098
/// Also sets the endpoint if the user has not set the endpoint.

0 commit comments

Comments
 (0)