GDriveClient

open class GDriveClient(backupOption: GDriveBackupOption, val auth: GDriveAuth, httpRequester: HttpRequester = HttpRequester(GOOGLE_APIS_BASE_URL))

A client for interacting with Google Drive, providing functionalities to read, write, delete, and manage files.

This class handles authentication, file operations, and folder management within Google Drive. It supports various backup options, including using the app data folder or custom folders.

Constructors

Link copied to clipboard
constructor(backupOption: GDriveBackupOption, auth: GDriveAuth, httpRequester: HttpRequester = HttpRequester(GOOGLE_APIS_BASE_URL))

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

The authentication provider for Google Drive. It handles signing in, signing out, and managing access tokens.

Functions

Link copied to clipboard
suspend fun delete(id: String): Boolean

Deletes a file from Google Drive by its ID.

Link copied to clipboard
suspend fun getIdForFilename(filename: String, isInAppDataFolder: Boolean): String?

Retrieves the Google Drive file ID associated with a given filename.

Link copied to clipboard
suspend fun isSignedIn(): Boolean
Link copied to clipboard
suspend fun read(id: String): String

Reads the content of a file from Google Drive.

Link copied to clipboard
suspend fun signIn(): Boolean
Link copied to clipboard
fun signOut()
Link copied to clipboard

Validates Google Drive authentication and necessary permissions.

Link copied to clipboard
suspend fun write(filename: String, content: String): String?

Writes content to Google Drive, replacing any existing file with the same name.