# google-api-client

> An OAuth2 Promise-based client for Google APIs.

Latest version **2.1.0** (published 2017-03-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install google-api-client
pnpm add google-api-client
yarn add google-api-client
bun add google-api-client
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-03-23 |
| First published | 2016-02-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+10 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Kurt Freytag |
| Maintainers | cohere |
| Keywords | google, api |

## Links

- npm: https://www.npmjs.com/package/google-api-client
- Repository: https://github.com/cohere-io/google-api-client
- Homepage: https://github.com/cohere-io/google-api-client#readme
- Issues: https://github.com/cohere-io/google-api-client/issues
- npm.io page: https://npm.io/package/google-api-client

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) 4.6.x
- [request](https://npm.io/package/request.md) 2.x.x
- [bluebird](https://npm.io/package/bluebird.md) 3.3.x
- [promiseq](https://npm.io/package/promiseq.md) 0.1.x

## Recent versions

- 2.1.0 (latest) — 2017-03-23
- 2.0.5 — 2016-03-30
- 2.0.4 — 2016-03-28
- 2.0.3 — 2016-03-28
- 2.0.2 — 2016-03-28
- 2.0.1 — 2016-03-28
- 2.0.0 — 2016-03-28
- 1.0.5 — 2016-03-10
- 1.0.4 — 2016-03-09
- 1.0.3 — 2016-03-08
- 1.0.2 — 2016-02-25
- 1.0.0 — 2016-02-23

## README

3/23/17 : 2.1.0 modifies, yet again, how the client is instantiated. See the example below.

A simple example:

```
const google          = require('google-api-client'),
      queryParams     = {
        'start-date'    : '2017-03-01',
        'end-date'      : '2017-03-31',
        'ids'           : 'ga:[TABLE_ID]',
        'dimensions'    : 'ga:date',
        'metrics'       : 'ga:sessions'
      };

return new Promise(function(resolve, reject) {

    var Client = new google.ApiClient([CLIENT_ID]);

    Client.oauth2.refreshToken([REFRESH_TOKEN], [CLIENT_SECRET])
    .then(function(accessToken) {
	    Client.setAccessToken(accessToken);
	    return Client.analytics.data.get(queryParams);
    })
    .then(function(result) {
	    console.log(result);
    })
    .catch(function(error) {
	    console.log(error);
    });
};
```

---
_Source: https://npm.io/package/google-api-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
