Package com.softlayer.api
Interface ApiClient
- All Known Implementing Classes:
RestApiClient
public interface ApiClient
Common interface for all API clients.
RestApiClient is the preferred implementation-
Method Summary
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 Details
-
withCredentials
Set the username and API key credentials. This is required for most service methods.- Returns:
- This instance
-
withBearerToken
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
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).
-