Package com.softlayer.api
Interface ApiClient
-
- All Known Implementing Classes:
RestApiClient
public interface ApiClientCommon interface for all API clients.RestApiClientis the preferred implementation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <S extends Service>
ScreateService(Class<S> serviceClass, String id)Get a service for the given sets of classes and optional ID.HttpCredentialsgetCredentials()Returns the HTTP Authorization headerApiClientwithBearerToken(String token)Uses a HTTP Bearer token for authentication instead of API key.ApiClientwithCredentials(String username, String apiKey)Set the username and API key credentials.ApiClientwithLoggingEnabled()Enables logging for client API calls
-
-
-
Method Detail
-
withCredentials
ApiClient withCredentials(String username, String apiKey)
Set the username and API key credentials. This is required for most service methods.- Returns:
- This instance
-
withBearerToken
ApiClient withBearerToken(String token)
Uses a HTTP Bearer token for authentication instead of API key.- Returns:
- This instance
-
withLoggingEnabled
ApiClient withLoggingEnabled()
Enables logging for client API calls- Returns:
- This instance
-
getCredentials
HttpCredentials getCredentials()
Returns the HTTP Authorization header- Returns:
- This instance
-
createService
<S extends Service> S createService(Class<S> serviceClass, String id)
Get a service for the given sets of classes and optional ID. It is not recommended to call this directly, but rather invoke the service method on the type class. E.g.Account.service(ApiClient).
-
-