Mirra
IntegrationsGoogle

Google Drive

SDK reference for google drive operations

Overview

Google Drive file storage and management

  • Category: storage
  • Auth Required: Yes
  • Supported Modes: standard, delegated

Operations

listFiles

List files in Google Drive

Arguments:

  • query (string, optional): Search query (Google Drive query syntax)
  • pageSize (number, optional): Maximum number of files to return (default: 20)

Returns:

AdapterOperationResult - List of normalized files with count, query, and files array

Response Fields:

FieldTypeDescription
countnumberNumber of files returned
querystringSearch query used (optional)
filesGoogleDriveFileSummary[]Array of file summaries
files item fields (GoogleDriveFileSummary)
FieldTypeDescription
idstringFile ID
namestringFile name
mimeTypestringMIME type
mimeTypeReadablestringHuman-readable file type
createdAtstringISO 8601 creation date
modifiedAtstringISO 8601 modification date
isFolderbooleanWhether this is a folder

Example:

const result = await mirra.googleDrive.listFiles({});

createFile

Create a new file in Google Drive

Arguments:

  • name (string, required): Name of the file
  • mimeType (string, required): MIME type of the file
  • folderId (string, optional): Parent folder ID (optional)

Returns:

AdapterOperationResult - Created file information

Response Fields:

FieldTypeDescription
fileIdstringCreated file ID
namestringFile name
mimeTypestringMIME type
webViewLinkstringWeb view URL (optional)

Example:

const result = await mirra.googleDrive.createFile({
  name: "example",
  mimeType: "example"
});

createFolder

Create a new folder in Google Drive

Arguments:

  • name (string, required): Name of the folder
  • parentFolderId (string, optional): Parent folder ID (optional)

Returns:

AdapterOperationResult - Created folder information

Response Fields:

FieldTypeDescription
folderIdstringCreated folder ID
namestringFolder name
webViewLinkstringWeb view URL (optional)

Example:

const result = await mirra.googleDrive.createFolder({
  name: "example"
});

getFileInfo

Get information about a file

Arguments:

  • fileId (string, required): ID of the file

Returns:

AdapterOperationResult - Normalized file info with id, name, mimeType, size, dates, owner, etc.

Response Fields:

FieldTypeDescription
idstringFile ID
namestringFile name
mimeTypestringMIME type
mimeTypeReadablestringHuman-readable file type
sizenumberFile size in bytes
createdAtstringISO 8601 creation date
modifiedAtstringISO 8601 modification date
webViewLink`stringnull`
parentsstring[]Parent folder IDs
owner`GoogleDriveOwnernull`
owner item fields (GoogleDriveOwner)
FieldTypeDescription
namestringOwner name
emailstringOwner email

| isFolder | boolean | Whether this is a folder | | isTrashed | boolean | Whether file is in trash |

Example:

const result = await mirra.googleDrive.getFileInfo({
  fileId: "abc123"
});

shareFile

Share a file with others

Arguments:

  • fileId (string, required): ID of the file to share
  • email (string, optional): Email address to share with (optional)
  • role (string, optional): Permission role: reader, writer, commenter (default: reader)

Returns:

AdapterOperationResult - Share result with link

Response Fields:

FieldTypeDescription
fileIdstringShared file ID
permissionIdstringCreated permission ID
rolestringPermission role granted
sharedbooleanWhether share succeeded

Example:

const result = await mirra.googleDrive.shareFile({
  fileId: "abc123"
});

downloadFile

Download a file from Google Drive. For Google Docs/Sheets, exports as PDF/XLSX. Returns base64-encoded data.

Arguments:

  • fileId (string, required): ID of the file to download

Returns:

AdapterOperationResult - File data (base64) and mimeType

Response Fields:

FieldTypeDescription
datastringBase64-encoded file content
mimeTypestringMIME type of downloaded file

Example:

const result = await mirra.googleDrive.downloadFile({
  fileId: "abc123"
});

moveFile

Move a file to a different folder

Arguments:

  • fileId (string, required): ID of the file to move
  • folderId (string, required): ID of the destination folder

Returns:

AdapterOperationResult - Updated file information

Response Fields:

FieldTypeDescription
fileIdstringMoved file ID
namestringFile name
movedbooleanWhether move succeeded

Example:

const result = await mirra.googleDrive.moveFile({
  fileId: "abc123",
  folderId: "abc123"
});

deleteFile

Delete a file or folder. By default moves to trash; set permanently=true to delete forever.

Arguments:

  • fileId (string, required): ID of the file or folder to delete
  • permanently (boolean, optional): If true, permanently delete instead of moving to trash (default: false)

Returns:

AdapterOperationResult - Delete confirmation

Response Fields:

FieldTypeDescription
fileIdstringDeleted file ID
deletedstringDeletion type: permanent or trash

Example:

const result = await mirra.googleDrive.deleteFile({
  fileId: "abc123"
});

searchFiles

Search for files using Google Drive query syntax

Arguments:

  • query (string, required): Search query using Drive syntax (e.g., "name contains 'report'", "mimeType='application/pdf'")
  • pageSize (number, optional): Maximum number of files to return (default: 20)

Returns:

AdapterOperationResult - List of normalized matching files

Response Fields:

FieldTypeDescription
countnumberNumber of files returned
querystringSearch query used
filesGoogleDriveFileSummary[]Array of matching file summaries
files item fields (GoogleDriveFileSummary)
FieldTypeDescription
idstringFile ID
namestringFile name
mimeTypestringMIME type
mimeTypeReadablestringHuman-readable file type
createdAtstringISO 8601 creation date
modifiedAtstringISO 8601 modification date
isFolderbooleanWhether this is a folder

Example:

const result = await mirra.googleDrive.searchFiles({
  query: "example"
});

updateFile

Update file metadata (name, description)

Arguments:

  • fileId (string, required): ID of the file to update
  • name (string, optional): New name for the file
  • description (string, optional): New description for the file

Returns:

AdapterOperationResult - Updated file information

Response Fields:

FieldTypeDescription
fileIdstringUpdated file ID
namestringFile name
updatedbooleanWhether update succeeded

Example:

const result = await mirra.googleDrive.updateFile({
  fileId: "abc123"
});

On this page