Class APISession

    • Constructor Detail

      • APISession

        public APISession​(String serverUrl)
        APISession constructor
        Parameters:
        serverUrl -
      • APISession

        public APISession​(String serverUrl,
                          String subDomainHost)
        APISession constructor
        Parameters:
        serverUrl -
        subDomainHost -
    • Method Detail

      • setConnection

        public void setConnection​(NetworkConnectionManager m_Connection)
        setConnection
        Parameters:
        m_Connection -
      • getSessionID

        public String getSessionID()
        getSessionID
        Returns:
        String m_SessionID
      • setSessionID

        public void setSessionID​(String m_SessionID)
        setSessionID
        Parameters:
        m_SessionID -
      • getLastSignInTime

        public Date getLastSignInTime()
        getLastSignInTime
        Returns:
        Date m_LastSignInTime
      • connected

        public boolean connected()
        connected
        Returns:
        true if connected to the server; otherwise, false
      • getActiveEmail

        public String getActiveEmail()
        getActiveEmail
        Returns:
        the email address for the currently signed in user.
      • setActiveEmail

        public void setActiveEmail​(String activeEmail)
        setActiveEmail
        Parameters:
        activeEmail -
      • connection

        public NetworkConnectionManager connection()
        connection
        Returns:
        NetworkConnectionManager The connection object
      • signInManager

        public SignInManager 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

        public User 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

        public Date lastUserPlansRefreshTime()
        lastUserPlansRefreshTime
        Returns:
        Date last user plans refresh time.
      • syncUploadLimit

        @Nullable
        public int syncUploadLimit()
        syncUploadLimit
        Returns:
        int user plans sync upload limit
      • SyncDownloadLimit

        @Nullable
        public int 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

        public Enums.LoginResult loadExistingSession​(String sessionId)
        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
      • getServerTime

        public Calendar[] getServerTime()
        getServerTime
        Returns:
        Date[] array of Last server time and Last local time
      • getAuthenticationResource

        public Authentication getAuthenticationResource()
        getAuthenticationResource retrieves an instance of an Authentication resource
        Returns:
        Authentication a new instance of an Authentication Resource
      • getFilesResource

        public Files getFilesResource()
        getFilesResource retrieves an instance of an Files resource
        Returns:
        Files a new instance of Files Resource
      • getNotificationsResource

        public Notifications getNotificationsResource()
        getNotificationsResource retrieves an instance of an Notifications resource
        Returns:
        Notifications a new instance of Notifications Resource
      • getOneDriveManagementResource

        public OneDriveManagement getOneDriveManagementResource()
        getOneDriveManagementResource retrieves an instance of an OneDriveManagement resource
        Returns:
        OneDriveManagement a new instance of an OneDriveManagement Resource
      • getOrganizationsResource

        public Organizations getOrganizationsResource()
        getOrganizationsResource retrieves an instance of an Organizations resource
        Returns:
        Organizations a new instance of Organizations Resource
      • getSessionsResource

        public Sessions getSessionsResource()
        getSessionsResource retrieves an instance of an Sessions resource
        Returns:
        Sessions a new instance of Sessions Resource
      • getSharePointResource

        public SharePoint getSharePointResource()
        getSharePointResource retrieves an instance of an SharePoint resource
        Returns:
        SharePoint a new instance of a SharePoint Resource
      • getSignInMethods

        public Enums.SignInType getSignInMethods​(String email)
        getSignInMethods
        Parameters:
        email -
        Returns:
        SignInType
      • getSystemPropertiesResource

        public SystemProperties getSystemPropertiesResource()
        getSystemPropertiesResource retrieves an instance of SystemProperties resource
        Returns:
        SystemProperties a new instance of SystemProperties Resource
      • getTransientWorkspacesResource

        public TransientWorkspaces getTransientWorkspacesResource()
        getTransientWorkspacesResource retrieves an instance of TransientWorkspaces resource
        Returns:
        TransientWorkspaces a new instance of TransientWorkspaces Resource
      • getIManageWorkspacesResource

        public IManageWorkspaces getIManageWorkspacesResource()
        getIManageWorkspacesResource retrieves an instance of IManageWorkspaces resource
        Returns:
        IManageWorkspaces a new instance of IManageWorkspaces Resource
      • getUsersResource

        public Users getUsersResource()
        getUsersResource retrieves an instance of a Users resource
        Returns:
        Users a new instance of a Users Resource
      • getWorkspacesResource

        public Workspaces getWorkspacesResource()
        getWorkspacesResource retrieves an instance of a Workspaces resource
        Returns:
        Workspaces a new instance of a Workspaces Resource
      • getSearchResource

        public Search getSearchResource()
        getSearchResource retrieves an instance of a Search resource
        Returns:
        Search a new instance of a Search Resource
      • getItemsResource

        public Items getItemsResource()
        getItemsResource retrieves an instance of a Items resource
        Returns:
        Items a new instance of a Items Resource
      • getUploadManager

        public UploadManager getUploadManager()
        get a new UploadManager instance.
        Returns:
        new UploadManager instance related to this session
      • getDownloadManager

        public DownloadManager getDownloadManager()
        get a new DownloadManager instance.
        Returns:
        New DownloadManager instance related to this session
      • setNetworkBandwidthLimit

        public void setNetworkBandwidthLimit​(@Nullable
                                             int download,
                                             @Nullable
                                             int upload)
        setNetworkBandwidthLimit
        Parameters:
        download - Sync download user limit
        upload - Sync upload user limit
      • getEmailFromSessionId

        public String getEmailFromSessionId​(String id)
        getEmailFromSessionId
        Parameters:
        id -
        Returns:
        String Email
      • getRefreshToken

        public String getRefreshToken()
        refreshToken
        Returns:
        String refreshToken
      • setRefreshToken

        public void setRefreshToken​(String refreshToken)
        setRefreshToken
        Parameters:
        refreshToken -
      • expiryTimeInSeconds

        public long expiryTimeInSeconds()
        expiryTimeInSeconds
        Returns:
        int expiryTimeInSeconds
      • getSupportedFileTypes

        public String[] 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

        public void addApiSessionEventListener​(IAPISessionEvent listener)
      • updateUploadSpeed

        public void updateUploadSpeed​(float speed)
        updateUploadSpeed
        Specified by:
        updateUploadSpeed in interface ISessionCallbacks
        Parameters:
        speed -
      • updateBytesSent

        public void updateBytesSent​(long bytes)
        updateBytesSent
        Specified by:
        updateBytesSent in interface ISessionCallbacks
        Parameters:
        bytes -