Netzo Logo

googledrive

Google Drive is a file storage and synchronization service.

Usage

import { googledrive } from 'netzo/apis/googledrive.ts'

const api = googledrive({
  googleServiceAccountCredentials: Deno.env.get('GOOGLE_SERVICE_ACCOUNT_CREDENTIALS'),
  scope: ['drive.readonly'],
})

Configuration

The googlesheets factory function expects an object with the following, and returns an object with an API client api.

ParamTypeDefaultDescription
googleServiceAccountCredentialsstringDeno.env.get('GOOGLE_SERVICE_ACCOUNT_CREDENTIALS')credentials to use for authentication
scopearray['spreadsheets.readonly']the permissions granted to interact with the resource
Refer to the API documentation to get the required information.

Examples

The following examples assume you have created an api client instance.

Find files

Find all files that match the query.

const query: QueryFiles = {}
const result = await api.files.get<Files>(query)
const resultData = result.files

Get file

Get a file by id.

const query: QueryFile = {}
const resultData = await api.files[FILE_ID].get<File>(query)

Copy file

Create a copy of a file and apply updates.

const data: DataCopyFile = { description: 'Copy of my file' }
const resultData = await api.files[FILE_ID].copy.post<File>(data)

References