This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

google-api-client

2.1.0 • Public • Published

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);
    });
};

Readme

Keywords

Package Sidebar

Install

npm i google-api-client

Weekly Downloads

31

Version

2.1.0

License

MIT

Last publish

Collaborators

  • yunyu
  • williamyeny