Class OneDrive

java.lang.Object
com.amilesend.onedrive.OneDrive
Direct Known Subclasses:
BusinessOneDrive

public class OneDrive extends Object
The primary exposed object to consumers to access drives available to the authenticated user.

While this object can be instantiated directly by consumers, it is recommended to leverage the OneDriveFactoryStateManager instead. Doing so simplifies OAUTH authentication and persists the authentication tokens for reuse. Without it, consumers are responsible for initiating the OAUTH handshake to obtain the authorization code and managing persisted refresh tokens for future instantiation without requiring the user to re-authorize the consumer application with their OneDrive account.

See Also:
  • Constructor Details

  • Method Details

    • getUserDrive

      public Drive getUserDrive()
      Gets the user's default drive that is associated with their account.
      Returns:
      the user's drive
      See Also:
    • getAvailableDrives

      public List<Drive> getAvailableDrives()
      Gets the list of drives available to the authenticated user.
      Returns:
      the list of available drives
      See Also:
    • getDrive

      public Drive getDrive(String driveId)
      Gets the Drive for the given driveId.
      Parameters:
      driveId - the drive identifier
      Returns:
      the drive
      See Also:
    • getUserDisplayName

      public String getUserDisplayName()
      Gets the authenticated user's display name associated with their default drive.
      Returns:
      the user's display name
    • getAuthInfo

      public OneDriveAuthInfo getAuthInfo()
      Gets the authentication information associated with the current user connection. Since this includes the access and refresh tokens, this should be treated as the customer's credentials. This can be persisted if consumers are managing their own token state for instantiation.
      Returns:
      the authentication information