# ScriptRunner Connect Managed API for Google Drive
Managed API for Google Drive is an API Client for Google Drive by [Adaptavist](https://www.adaptavist.com/). You can read more about Managed APIs [here](https://docs.adaptavist.com/src/managed-apis).

This is [ScriptRunner Connect](https://scriptrunnerconnect.com) runtime specific version of the Managed API (with `sr-connect` suffix). If you want to use Managed API in any other runtime, have a look at the [runtime agnostic version](https://www.npmjs.com/package/@managed-api/google-drive-v3-core).

# Supported API calls
- [fetch](https://docs.adaptavist.com/src/managed-apis/managed-api-abstractions)
- About
    - [me](https://developers.google.com/workspace/drive/api/reference/rest/v3/about/get)
- File
    - [copyFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/copy)
    - [createFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create)
    - [deleteFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/delete)
    - [downloadFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/download)
    - [emptyTrash](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/emptyTrash)
    - [exportFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/export)
    - [generateIds](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/generateIds)
    - [getFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/get)
    - [getFiles](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/list)
    - [getFileLabels](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/listLabels)
    - [editFileLabels](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/modifyLabels)
    - [updateFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/update)
    - [watchFile](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/watch)

# Constructing Managed API
In ScriptRunner Connect a Managed API is constructed for you, but if you need to construct it manually, here's how you can do it:
```typescript
import { GoogleDriveApi } from '@managed-api/google-drive-v3-sr-connect';

export default async function() {
    const api = new GoogleDriveApi('API_CONNECTION_ID');
}
```

# Contact
Feel free to drop ideas, suggestions or improvements into our [Slack community channel](https://join.slack.com/t/srconnectcommunity/shared_invite/zt-1c6u4gbyq-KJV_e78H0io7yctNZTBc0A).

# Changelog

* 1.4.0
    - Updated File method response types.

* 1.3.0
    - Removed `Drive` methods.

* 1.2.0
    - Made `options` optional for methods that support empty requests.

* 1.1.0
    - Added additional content type fallback value for file creation and update.

* 1.0.0
    - Added support for the following About methods:
        * [get](https://developers.google.com/workspace/drive/api/reference/rest/v3/about/get) that can be used as `About.me` or `All.aboutMe`.

    - Added support for the following Drive methods:
        * [create](https://developers.google.com/workspace/drive/api/reference/rest/v3/drives/create) that can be used as `Drive.createDrive` or `All.createDrive`.
        * [delete](https://developers.google.com/workspace/drive/api/reference/rest/v3/drives/delete) that can be used as `Drive.deleteDrive` or `All.deleteDrive`.
        * [get](https://developers.google.com/workspace/drive/api/reference/rest/v3/drives/get) that can be used as `Drive.getDrive` or `All.getDrive`.
        * [hide](https://developers.google.com/workspace/drive/api/reference/rest/v3/drives/hide) that can be used as `Drive.hideDrive` or `All.hideDrive`.
        * [list](https://developers.google.com/workspace/drive/api/reference/rest/v3/drives/list) that can be used as `Drive.getDrives` or `All.getDrives`.
        * [unhide](https://developers.google.com/workspace/drive/api/reference/rest/v3/drives/unhide) that can be used as `Drive.unhideDrive` or `All.unhideDrive`.
        * [update](https://developers.google.com/workspace/drive/api/reference/rest/v3/drives/update) that can be used as `Drive.updateDrive` or `All.updateDrive`.

    - Added support for the following File methods:
        * [copy](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/copy) that can be used as `File.copyFile` or `All.copyFile`.
        * [create](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create) that can be used as `File.createFile` or `All.createFile`.
        * [delete](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/delete) that can be used as `File.deleteFile` or `All.deleteFile`.
        * [download](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/download) that can be used as `File.downloadFile` or `All.downloadFile`.
        * [emptyTrash](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/emptyTrash) that can be used as `File.emptyTrash` or `All.emptyTrash`.
        * [export](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/export) that can be used as `File.exportFile` or `All.exportFile`.
        * [generateIds](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/generateIds) that can be used as `File.generateIds` or `All.generateIds`.
        * [get](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/get) that can be used as `File.getFile` or `All.getFile`.
        * [list](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/list) that can be used as `File.getFiles` or `All.getFiles`.
        * [listLabels](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/listLabels) that can be used as `File.getFileLabels` or `All.getFileLabels`.
        * [modifyLabels](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/modifyLabels) that can be used as `File.editFileLabels` or `All.editFileLabels`.
        * [update](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/update) that can be used as `File.updateFile` or `All.updateFile`.
        * [watch](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/watch) that can be used as `File.watchFile` or `All.watchFile`.

Copyright Adaptavist 2025 (c) All rights reserved