Class APISession
java.lang.Object
com.blackberry.workspaces.sdk.api.APISession
- All Implemented Interfaces:
ISessionCallbacks
,Serializable
public class APISession extends Object implements ISessionCallbacks, Serializable
APISession
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description APISession(String serverUrl)
APISession constructorAPISession(String serverUrl, String subDomainHost)
APISession constructor -
Method Summary
Modifier and Type Method Description void
addApiSessionEventListener(IAPISessionEvent listener)
void
caughtSocketException(SocketException socketException)
caughtSocketExceptionboolean
connected()
connectedNetworkConnectionManager
connection()
connectionvoid
endSession()
EndSession Clear the SessionID value and stop the renewal timervoid
establishedConnectionToTheInternet()
establishedConnectionToTheInternetlong
expiryTimeInSeconds()
expiryTimeInSecondsString
getAccessToken()
getTokenString
getActiveEmail()
getActiveEmailAuthentication
getAuthenticationResource()
getAuthenticationResource retrieves an instance of an Authentication resourceNetworkConnectionManager
getConnection()
getConnectionDownloadManager
getDownloadManager()
get a new DownloadManager instance.String
getEmailFromSessionId(String id)
getEmailFromSessionIdFiles
getFilesResource()
getFilesResource retrieves an instance of an Files resourceboolean
getGlobalDownloadPermission()
getGlobalDownloadPermissionIManageWorkspaces
getIManageWorkspacesResource()
getIManageWorkspacesResource retrieves an instance of IManageWorkspaces resourceboolean
getIsUploading()
getIsUploading if there is a file being uploaded right now in a thread safe mannerItems
getItemsResource()
getItemsResource retrieves an instance of a Items resourceDate
getLastSignInTime()
getLastSignInTimeNotifications
getNotificationsResource()
getNotificationsResource retrieves an instance of an Notifications resourceOneDriveManagement
getOneDriveManagementResource()
getOneDriveManagementResource retrieves an instance of an OneDriveManagement resourceOrganizations
getOrganizationsResource()
getOrganizationsResource retrieves an instance of an Organizations resourceString
getRefreshToken()
refreshTokenSearch
getSearchResource()
getSearchResource retrieves an instance of a Search resourceCalendar[]
getServerTime()
getServerTimeString
getServiceAccountToken(String userEmail, String issuer, int expiresInMinutes, PrivateKey privateKey, String encryptionAlgorithm)
getServiceAccountToken A helper method for formulating an authorization token when using Service Accounts for user authentication.String
getSessionID()
getSessionIDSessions
getSessionsResource()
getSessionsResource retrieves an instance of an Sessions resourceSharePoint
getSharePointResource()
getSharePointResource retrieves an instance of an SharePoint resourceEnums.SignInType
getSignInMethods(String email)
getSignInMethodsString[]
getSupportedFileTypes()
getSupportedFileTypesSystemProperties
getSystemPropertiesResource()
getSystemPropertiesResource retrieves an instance of SystemProperties resourceTransientWorkspaces
getTransientWorkspacesResource()
getTransientWorkspacesResource retrieves an instance of TransientWorkspaces resourceUploadManager
getUploadManager()
get a new UploadManager instance.Users
getUsersResource()
getUsersResource retrieves an instance of a Users resourceWorkspaces
getWorkspacesResource()
getWorkspacesResource retrieves an instance of a Workspaces resourceboolean
isServiceAccount()
isServiceAccountDate
lastUserPlansRefreshTime()
lastUserPlansRefreshTimeItemListJson<WorkspaceInfoJson>
listAvailableVDRs(List<String> roomTypes)
listAvailableVDRsEnums.LoginResult
loadExistingSession(String sessionId)
loadExistingSessionEnums.LoginResult
loadExistingSession(String sessionId, boolean useServerCertificateValidationCallback, boolean loadUserData)
loadExistingSessionboolean
logOff()
logOffvoid
lostConnectionToTheInternet()
lostConnectionToTheInternetvoid
reportProxyAuthenticationRequired()
reportProxyAuthenticationRequiredlong
SentBytes()
SentBytesEnums.RestartStatus
sessionIdExpired(String oldSid)
sessionIdExpiredvoid
setActiveEmail(String activeEmail)
setActiveEmailvoid
setConnection(NetworkConnectionManager m_Connection)
setConnectionvoid
setGlobalDownloadPermission(boolean GlobalDownloadPermission)
setGlobalDownloadPermissionvoid
setIsUploading(boolean m_IsUploading)
setIsUploadingvoid
setNetworkBandwidthLimit(int download, int upload)
setNetworkBandwidthLimitvoid
setRefreshToken(String refreshToken)
setRefreshTokenvoid
setServerTime(Calendar serverTime)
setServerTimevoid
setSessionID(String m_SessionID)
setSessionIDSignInManager
signInManager()
signInManagerEnums.LoginResult
startSessionWithOAuth(android.app.Activity activity, String email, String refreshToken, boolean showUiIfRefreshFails)
startSessionWithOAuthEnums.LoginResult
startSessionWithServiceAccount(String userEmail, String issuer, int expiresInMinutes, PrivateKey privateKey, String encryptionAlgorithm)
startSessionWithServiceAccountint
SyncDownloadLimit()
SyncDownloadLimitint
syncUploadLimit()
syncUploadLimitboolean
testConnection()
testConnectionvoid
updateBytesSent(long bytes)
updateBytesSentvoid
updateUploadSpeed(float speed)
updateUploadSpeedfloat
uploadSpeed()
uploadSpeedUser
userPlan()
userPlanvoid
waitForRenewal()
waitForRenewal Waits for renewal
-
Constructor Details
-
APISession
APISession constructor- Parameters:
serverUrl
-
-
APISession
APISession constructor- Parameters:
serverUrl
-subDomainHost
-
-
-
Method Details
-
getConnection
getConnection- Returns:
- NetworkConnectionManager
-
setConnection
setConnection- Parameters:
m_Connection
-
-
getSessionID
getSessionID- Returns:
- String m_SessionID
-
setSessionID
setSessionID- Parameters:
m_SessionID
-
-
getLastSignInTime
getLastSignInTime- Returns:
- Date m_LastSignInTime
-
connected
public boolean connected()connected- Returns:
- true if connected to the server; otherwise, false
-
getActiveEmail
getActiveEmail- Returns:
- the email address for the currently signed in user.
-
setActiveEmail
setActiveEmail- Parameters:
activeEmail
-
-
connection
connection- Returns:
- NetworkConnectionManager The connection object
-
signInManager
signInManager- Returns:
- SignInManager the SignInManager object.
-
getGlobalDownloadPermission
public boolean getGlobalDownloadPermission()getGlobalDownloadPermission- Returns:
- True if global download permission is on; otherwise, false.
-
setGlobalDownloadPermission
public void setGlobalDownloadPermission(boolean GlobalDownloadPermission)setGlobalDownloadPermission- Parameters:
GlobalDownloadPermission
-
-
getIsUploading
public boolean getIsUploading()getIsUploading if there is a file being uploaded right now in a thread safe manner- Returns:
- True if there is a file being uploaded; otherwise, false.
-
setIsUploading
public void setIsUploading(boolean m_IsUploading)setIsUploading- Parameters:
m_IsUploading
-
-
userPlan
userPlan- Returns:
- User the user plan information.
-
SentBytes
public long SentBytes()SentBytes- Returns:
- long the current sent bytes
-
uploadSpeed
public float uploadSpeed()uploadSpeed- Returns:
- float current upload speed.
-
lastUserPlansRefreshTime
lastUserPlansRefreshTime- Returns:
- Date last user plans refresh time.
-
syncUploadLimit
syncUploadLimit- Returns:
- int user plans sync upload limit
-
SyncDownloadLimit
SyncDownloadLimit- Returns:
- int user plan sync download limit.
-
startSessionWithServiceAccount
public Enums.LoginResult startSessionWithServiceAccount(String userEmail, String issuer, int expiresInMinutes, PrivateKey privateKey, String encryptionAlgorithm)startSessionWithServiceAccount- Parameters:
userEmail
-issuer
-expiresInMinutes
-privateKey
-encryptionAlgorithm
-- Returns:
- success when Login successful;other wise one of login results
- See Also:
Enums.LoginResult
-
startSessionWithOAuth
public Enums.LoginResult startSessionWithOAuth(android.app.Activity activity, String email, String refreshToken, boolean showUiIfRefreshFails)startSessionWithOAuth- Parameters:
email
-refreshToken
-showUiIfRefreshFails
-- Returns:
- success when Login successful;other wise one of login results
- Throws:
IOException
- See Also:
Enums.LoginResult
-
endSession
public void endSession()EndSession Clear the SessionID value and stop the renewal timer -
logOff
public boolean logOff()logOff- Returns:
- true if logoff succeeded; otherwise, false.
-
loadExistingSession
loadExistingSession- Parameters:
sessionId
-- Returns:
- success when Login successful;other wise one of login results
- See Also:
Enums.LoginResult
-
loadExistingSession
public Enums.LoginResult loadExistingSession(String sessionId, boolean useServerCertificateValidationCallback, boolean loadUserData)loadExistingSession- Parameters:
sessionId
-useServerCertificateValidationCallback
-loadUserData
-- Returns:
- success when Login successful;other wise one of login results
- See Also:
Enums.LoginResult
-
testConnection
public boolean testConnection()testConnection- Returns:
- true if connected to the Internet and to the server
-
listAvailableVDRs
listAvailableVDRs- Parameters:
roomTypes
- list of room types- Returns:
- ItemListJson of WorkspaceInfoJson
-
getServerTime
getServerTime- Returns:
- Date[] array of Last server time and Last local time
-
getAuthenticationResource
getAuthenticationResource retrieves an instance of an Authentication resource- Returns:
- Authentication a new instance of an Authentication Resource
-
getFilesResource
getFilesResource retrieves an instance of an Files resource- Returns:
- Files a new instance of Files Resource
-
getNotificationsResource
getNotificationsResource retrieves an instance of an Notifications resource- Returns:
- Notifications a new instance of Notifications Resource
-
getOneDriveManagementResource
getOneDriveManagementResource retrieves an instance of an OneDriveManagement resource- Returns:
- OneDriveManagement a new instance of an OneDriveManagement Resource
-
getOrganizationsResource
getOrganizationsResource retrieves an instance of an Organizations resource- Returns:
- Organizations a new instance of Organizations Resource
-
getSessionsResource
getSessionsResource retrieves an instance of an Sessions resource- Returns:
- Sessions a new instance of Sessions Resource
-
getSharePointResource
getSharePointResource retrieves an instance of an SharePoint resource- Returns:
- SharePoint a new instance of a SharePoint Resource
-
getSignInMethods
getSignInMethods- Parameters:
email
-- Returns:
- SignInType
-
getSystemPropertiesResource
getSystemPropertiesResource retrieves an instance of SystemProperties resource- Returns:
- SystemProperties a new instance of SystemProperties Resource
-
getTransientWorkspacesResource
getTransientWorkspacesResource retrieves an instance of TransientWorkspaces resource- Returns:
- TransientWorkspaces a new instance of TransientWorkspaces Resource
-
getIManageWorkspacesResource
getIManageWorkspacesResource retrieves an instance of IManageWorkspaces resource- Returns:
- IManageWorkspaces a new instance of IManageWorkspaces Resource
-
getUsersResource
getUsersResource retrieves an instance of a Users resource- Returns:
- Users a new instance of a Users Resource
-
getWorkspacesResource
getWorkspacesResource retrieves an instance of a Workspaces resource- Returns:
- Workspaces a new instance of a Workspaces Resource
-
getSearchResource
getSearchResource retrieves an instance of a Search resource- Returns:
- Search a new instance of a Search Resource
-
getItemsResource
getItemsResource retrieves an instance of a Items resource- Returns:
- Items a new instance of a Items Resource
-
getUploadManager
get a new UploadManager instance.- Returns:
- new UploadManager instance related to this session
-
getDownloadManager
get a new DownloadManager instance.- Returns:
- New DownloadManager instance related to this session
-
setNetworkBandwidthLimit
setNetworkBandwidthLimit- Parameters:
download
- Sync download user limitupload
- Sync upload user limit
-
getEmailFromSessionId
getEmailFromSessionId- Parameters:
id
-- Returns:
- String Email
-
getRefreshToken
refreshToken- Returns:
- String refreshToken
-
setRefreshToken
setRefreshToken- Parameters:
refreshToken
-
-
expiryTimeInSeconds
public long expiryTimeInSeconds()expiryTimeInSeconds- Returns:
- int expiryTimeInSeconds
-
getSupportedFileTypes
getSupportedFileTypes- Returns:
- String[] array of supported file types
-
isServiceAccount
public boolean isServiceAccount()isServiceAccount- Returns:
- true if the signIn type is Service Account, false otherwise
-
getServiceAccountToken
public String getServiceAccountToken(String userEmail, String issuer, int expiresInMinutes, PrivateKey privateKey, String encryptionAlgorithm)getServiceAccountToken A helper method for formulating an authorization token when using Service Accounts for user authentication.- Parameters:
userEmail
-issuer
-expiresInMinutes
-privateKey
-encryptionAlgorithm
-- Returns:
- String authToken The authorization token to be used in making API requests
-
addApiSessionEventListener
-
updateUploadSpeed
public void updateUploadSpeed(float speed)updateUploadSpeed- Specified by:
updateUploadSpeed
in interfaceISessionCallbacks
- Parameters:
speed
-
-
updateBytesSent
public void updateBytesSent(long bytes)updateBytesSent- Specified by:
updateBytesSent
in interfaceISessionCallbacks
- Parameters:
bytes
-
-
sessionIdExpired
sessionIdExpired- Specified by:
sessionIdExpired
in interfaceISessionCallbacks
- Parameters:
oldSid
-- Returns:
- true if session restarted successfully; otherwise, false.
-
lostConnectionToTheInternet
public void lostConnectionToTheInternet()Description copied from interface:ISessionCallbacks
lostConnectionToTheInternet- Specified by:
lostConnectionToTheInternet
in interfaceISessionCallbacks
-
reportProxyAuthenticationRequired
public void reportProxyAuthenticationRequired()Description copied from interface:ISessionCallbacks
reportProxyAuthenticationRequired- Specified by:
reportProxyAuthenticationRequired
in interfaceISessionCallbacks
-
setServerTime
setServerTime- Specified by:
setServerTime
in interfaceISessionCallbacks
- Parameters:
serverTime
-
-
waitForRenewal
public void waitForRenewal()waitForRenewal Waits for renewal- Specified by:
waitForRenewal
in interfaceISessionCallbacks
-
getAccessToken
getToken- Specified by:
getAccessToken
in interfaceISessionCallbacks
- Returns:
- session ID
-
caughtSocketException
Description copied from interface:ISessionCallbacks
caughtSocketException- Specified by:
caughtSocketException
in interfaceISessionCallbacks
- Parameters:
socketException
- SocketException
-
establishedConnectionToTheInternet
public void establishedConnectionToTheInternet()Description copied from interface:ISessionCallbacks
establishedConnectionToTheInternet- Specified by:
establishedConnectionToTheInternet
in interfaceISessionCallbacks
-