# ScriptRunner Connect Managed API for Google Sheets
Managed API for Google Sheets is an API Client for Google Sheets 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-sheets-v4-core).

# Supported API calls
- [fetch](https://docs.adaptavist.com/src/managed-apis/managed-api-abstractions)
- [createSpreadsheet](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create)
- [getSpreadsheet](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/get)
- Value
    - [appendValuesInRange](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append)
    - [clearValuesInRange](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear)
    - [getValuesInRange](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get)
    - [setValuesInRange](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update)
- Sheet
    - [copySheet](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.sheets/copyTo)

# 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 { GoogleSheetsApi } from '@managed-api/google-sheets-v4-sr-connect';

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

# Contact
Feel free to drop ideas, suggestions or improvements into our [Community hub](https://loop.scriptrunnerhq.com/c/integration-forum).

# Changelog
- 2.1.0
    - Removed non-empty body from HEAD requests.
- 2.0.0
    - `Breaking change:` URL and query string parameters are now URL encoded, meaning if you encoded them explicitly before you have to remove your own encoding, otherwise they will get double encoded.
- 0.1.6
    - Fixed README

Copyright Adaptavist 2022 (c) All rights reserved