public class ApiClientProvider extends Object
Modifier and Type | Class and Description |
---|---|
class |
ApiClientProvider.AuthenticatedClientProvider
Base class for creating authenticated clients that are correctly configured to communicate with a Bridge study.
|
class |
ApiClientProvider.AuthenticatedClientProviderBuilder
Builder for AuthenticatedClientProvider.
|
Constructor and Description |
---|
ApiClientProvider(String baseUrl,
String userAgent,
String acceptLanguage,
String appId)
Creates a builder for accessing services associated with an environment and app.
|
ApiClientProvider(String baseUrl,
String userAgent,
String acceptLanguage,
String appId,
SocketFactory socketFactory,
List<okhttp3.Interceptor> networkInterceptors,
List<okhttp3.Interceptor> applicationInterceptors)
Creates a builder for accessing services associated with an environment and appId.
|
Modifier and Type | Method and Description |
---|---|
ApiClientProvider.AuthenticatedClientProviderBuilder |
getAuthenticatedClientProviderBuilder()
Returns a builder for authenticated access to this app.
|
AuthenticationApi |
getAuthenticationApi()
Get an instance of the Authentication API client.
|
<T> T |
getClient(Class<T> service)
Create an unauthenticated client (this client cannot authenticate automatically, and is only used for
public APIs not requiring a server user to access).
|
public ApiClientProvider(String baseUrl, String userAgent, String acceptLanguage, String appId)
baseUrl
- base url for Bridge serviceuserAgent
- user-agent string in Bridge's expected format, see RestUtils.getUserAgent(ClientInfo)
acceptLanguage
- optional comma-separated list of preferred languages for this client (most to least
preferredappId
- app identifierpublic ApiClientProvider(String baseUrl, String userAgent, String acceptLanguage, String appId, SocketFactory socketFactory, List<okhttp3.Interceptor> networkInterceptors, List<okhttp3.Interceptor> applicationInterceptors)
baseUrl
- base url for Bridge serviceuserAgent
- user-agent string in Bridge's expected format, see RestUtils.getUserAgent(ClientInfo)
acceptLanguage
- optional comma-separated list of preferred languages for this client (most to least
preferredappId
- app identifiersocketFactory
- optional factory to customize how OkHttp creates sockets. This is used on Android to associate a
socket with statistics for the current thread, as required by Android O. If no factory is passed, the
result is OkHttp's default behaviornetworkInterceptors
- additional network applicationInterceptorsapplicationInterceptors
- additional application applicationInterceptorspublic <T> T getClient(Class<T> service)
T
- One of the Api classes in the org.sagebionetworks.bridge.rest.api package.service
- Class representing the servicepublic AuthenticationApi getAuthenticationApi()
Basically a convenience wrapper for getClient(AuthenticationApi.class).
public ApiClientProvider.AuthenticatedClientProviderBuilder getAuthenticatedClientProviderBuilder()
Copyright © 2022 Sage Bionetworks. All rights reserved.