public class BoxClient extends BoxBase implements IAuthFlowListener
Constructor and Description |
---|
BoxClient(java.lang.String clientId,
java.lang.String clientSecret)
Deprecated.
|
BoxClient(java.lang.String clientId,
java.lang.String clientSecret,
IBoxResourceHub resourcehub,
IBoxJSONParser parser) |
Modifier and Type | Method and Description |
---|---|
void |
addOAuthRefreshListener(OAuthRefreshListener listener) |
void |
authenticate(IAuthData authData)
Get authenticated using a Auth object, this could be a previously stored data.
|
void |
authenticate(IAuthFlowUI authFlowUI,
boolean autoRefreshOAuth,
IAuthFlowListener listener)
Get authenticated.
|
void |
authenticateFromSecureStorage(IAuthSecureStorage storage)
Authenticate from the auth object stored in the secure storage.
|
IAuthDataController |
createAuthDataController(java.lang.String clientId,
java.lang.String clientSecret) |
IBoxRequestAuth |
createAuthorization(IAuthDataController controller) |
protected IBoxJSONParser |
createJSONParser(IBoxResourceHub resourceHub)
Create a json parser.
|
protected IBoxResourceHub |
createResourceHub()
Create a resource hub
|
protected IBoxRESTClient |
createRestClient()
Create a REST client to make api calls.
|
IBoxRequestAuth |
getAuth()
Get the auth object used to make api calls.
|
BoxOAuthToken |
getAuthData()
Get the OAuth data.
|
OAuthDataController.OAuthTokenState |
getAuthState()
Check authentication state.
|
BoxCollaborationsManager |
getCollaborationsManager() |
BoxCommentsManager |
getCommentsManager() |
IBoxConfig |
getConfig()
Get config.
|
BoxEventsManager |
getEventsManager() |
BoxFilesManager |
getFilesManager()
Get the BoxFilesManager, which can be used to make API calls on files endpoints.
|
BoxFoldersManager |
getFoldersManager() |
IBoxJSONParser |
getJSONParser() |
OAuthDataController |
getOAuthDataController()
Get the OAuthDataController that controls OAuth data.
|
BoxOAuthManager |
getOAuthManager()
Get the OAuthManager, which can be used to make OAuth related api calls.
|
protected BoxOAuthToken |
getOAuthTokenFromMessage(IAuthFlowMessage message) |
IBoxResourceHub |
getResourceHub()
Get resource hub.
|
BoxResourceManager |
getResourceManagerWithSharedLinkAuth(BoxResourceType type,
java.lang.String sharedLink,
java.lang.String password)
A generic way to get a resourceManager with shared link auth.
|
protected IBoxRESTClient |
getRestClient()
Get rest client.
|
BoxSearchManager |
getSearchManager() |
BoxCommentsManager |
getSharedCommentsManager(java.lang.String sharedLink,
java.lang.String password)
Get the BoxCommentsManager for shared items, which can be used to make API calls on comments endpoints for a shared item.
|
BoxFilesManager |
getSharedFilesManager(java.lang.String sharedLink,
java.lang.String password)
Get the BoxFilesManager for shared items, which can be used to make API calls on files endpoints for a shared item.
|
BoxFoldersManager |
getSharedFoldersManager(java.lang.String sharedLink,
java.lang.String password)
Get the BoxFoldersManager for shared items, which can be used to make API calls on folders endpoints for a shared item.
|
IBoxRequestAuth |
getSharedItemAuth(java.lang.String sharedLink,
java.lang.String password)
Get the authorization needed for shared items.
|
BoxSharedItemsManager |
getSharedItemsManager(java.lang.String sharedLink,
java.lang.String password)
Get Shared Items manager, which can be used to make API calls on shared item endpoints.
|
BoxUsersManager |
getUsersManager() |
boolean |
isAuthenticated()
Whether this client is authenticated.
|
void |
onAuthFlowEvent(IAuthEvent event,
IAuthFlowMessage message)
On an event.
|
void |
onAuthFlowException(java.lang.Exception e)
On an exception.
|
void |
onAuthFlowMessage(IAuthFlowMessage message)
On a message.
|
void |
saveAuth(IAuthSecureStorage storage)
Save auth in a customized secure storage.
|
void |
setAutoRefreshOAuth(boolean autoRefresh)
Makes OAuth auto refresh itself when token expires.
|
void |
setConnectionOpen(boolean connectionOpen) |
void |
setConnectionTimeOut(int timeOut)
Set connection time out.
|
public BoxClient(java.lang.String clientId, java.lang.String clientSecret, IBoxResourceHub resourcehub, IBoxJSONParser parser)
clientId
- client idclientSecret
- client secretresourcehub
- resource hub, use null for default resource hub.parser
- json parser, use null for default parser.@Deprecated public BoxClient(java.lang.String clientId, java.lang.String clientSecret)
public boolean isAuthenticated()
public void setAutoRefreshOAuth(boolean autoRefresh)
autoRefresh
- public void setConnectionOpen(boolean connectionOpen)
public void setConnectionTimeOut(int timeOut)
timeOut
- public OAuthDataController getOAuthDataController()
public void addOAuthRefreshListener(OAuthRefreshListener listener)
public BoxOAuthToken getAuthData() throws AuthFatalFailureException
AuthFatalFailureException
public void saveAuth(IAuthSecureStorage storage) throws AuthFatalFailureException
storage
- AuthFatalFailureException
public void authenticateFromSecureStorage(IAuthSecureStorage storage)
storage
- public BoxFilesManager getFilesManager()
public BoxOAuthManager getOAuthManager()
public BoxSharedItemsManager getSharedItemsManager(java.lang.String sharedLink, java.lang.String password)
sharedLink
- shared linkpassword
- passwordpublic BoxFilesManager getSharedFilesManager(java.lang.String sharedLink, java.lang.String password)
sharedLink
- shared link.password
- password of the shared link, use null if there is no passwordpublic BoxFoldersManager getSharedFoldersManager(java.lang.String sharedLink, java.lang.String password)
sharedLink
- shared link.password
- password of the shared link, use null if there is no passwordpublic BoxCommentsManager getSharedCommentsManager(java.lang.String sharedLink, java.lang.String password)
sharedLink
- shared link.password
- password of the shared link, use null if there is no passwordpublic BoxResourceManager getResourceManagerWithSharedLinkAuth(BoxResourceType type, java.lang.String sharedLink, java.lang.String password)
type
- sharedLink
- password
- public BoxFoldersManager getFoldersManager()
public BoxSearchManager getSearchManager()
public BoxEventsManager getEventsManager()
public BoxCollaborationsManager getCollaborationsManager()
public BoxCommentsManager getCommentsManager()
public BoxUsersManager getUsersManager()
public void authenticate(IAuthData authData)
token
- public void authenticate(IAuthFlowUI authFlowUI, boolean autoRefreshOAuth, IAuthFlowListener listener)
authFlowUI
- UI for the auth(OAuth) flow.autoRefreshOAuth
- whether the OAuth token should be auto refreshed when it expires. Note only set this to true when you are making api calls in a single thread
fashion, multi-thread auto-refreshing at a same time could cause problem.listener
- listener listening to the auth flow events.public void onAuthFlowEvent(IAuthEvent event, IAuthFlowMessage message)
IAuthFlowListener
onAuthFlowEvent
in interface IAuthFlowListener
event
- statemessage
- context message of this eventpublic OAuthDataController.OAuthTokenState getAuthState()
public IBoxConfig getConfig()
protected IBoxResourceHub createResourceHub()
protected IBoxJSONParser createJSONParser(IBoxResourceHub resourceHub)
resourceHub
- public IBoxResourceHub getResourceHub()
public IBoxJSONParser getJSONParser()
protected IBoxRESTClient getRestClient()
protected IBoxRESTClient createRestClient()
public IBoxRequestAuth getSharedItemAuth(java.lang.String sharedLink, java.lang.String password)
sharedLink
- shared linkpassword
- password(use null if no password at all)public IAuthDataController createAuthDataController(java.lang.String clientId, java.lang.String clientSecret)
public IBoxRequestAuth createAuthorization(IAuthDataController controller)
public IBoxRequestAuth getAuth()
public void onAuthFlowMessage(IAuthFlowMessage message)
IAuthFlowListener
onAuthFlowMessage
in interface IAuthFlowListener
message
- messagepublic void onAuthFlowException(java.lang.Exception e)
IAuthFlowListener
onAuthFlowException
in interface IAuthFlowListener
e
- exceptionprotected BoxOAuthToken getOAuthTokenFromMessage(IAuthFlowMessage message)