55
55
import java .util .regex .Pattern ;
56
56
57
57
/**
58
- * Watson service abstract common functionality of various Watson Services. It handle authentication and default url.
59
- *
60
- * @see <a href="http://www.ibm.com/watson/developercloud/"> IBM Watson Developer Cloud</a>
58
+ * Abstracts common functionality of various IBM Cloud services.
61
59
*/
62
60
public abstract class BaseService {
63
61
64
- private static final String URL = "url" ;
65
- private static final String PATH_AUTHORIZATION_V1_TOKEN = "/v1/token" ;
66
- private static final String AUTHORIZATION = "authorization" ;
67
62
private static final String BASIC = "Basic " ;
68
63
private static final String BEARER = "Bearer " ;
69
64
private static final String APIKEY_AS_USERNAME = "apikey" ;
@@ -80,17 +75,10 @@ public abstract class BaseService {
80
75
private OkHttpClient client ;
81
76
82
77
/** The default headers. */
83
- protected Headers defaultHeaders = null ;
78
+ private Headers defaultHeaders = null ;
84
79
85
80
/** The skip authentication. */
86
- protected boolean skipAuthentication = false ;
87
-
88
- /** The Constant MESSAGE_CODE. */
89
- protected static final String MESSAGE_CODE = "code" ;
90
-
91
-
92
- /** The Constant VERSION. */
93
- protected static final String VERSION = "version" ;
81
+ private boolean skipAuthentication = false ;
94
82
95
83
96
84
// Regular expression for JSON-related mimetypes.
@@ -276,23 +264,6 @@ public String getEndPoint() {
276
264
return endPoint ;
277
265
}
278
266
279
- /**
280
- * Gets an authorization token that can be use to authorize API calls.
281
- *
282
- *
283
- * @return the token
284
- */
285
- public ServiceCall <String > getToken () {
286
- HttpUrl url = HttpUrl .parse (getEndPoint ()).newBuilder ()
287
- .setPathSegment (0 , AUTHORIZATION )
288
- .addPathSegment (PATH_AUTHORIZATION_V1_TOKEN )
289
- .build ();
290
- Request request = RequestBuilder .get (url )
291
- .header (HttpHeaders .ACCEPT , HttpMediaType .TEXT_PLAIN ).query (URL , getEndPoint ()).build ();
292
-
293
- return createServiceCall (request , ResponseConverterUtils .getString ());
294
- }
295
-
296
267
/**
297
268
* Checks the status of the tokenManager.
298
269
*
0 commit comments