0.2.0 • Published 5 years ago

@ganesshkumar/gapi v0.2.0

Weekly downloads
14
License
Apache-2.0
Repository
github
Last release
5 years ago

gapi

A thin Node wrapper for Google's client-side javascript V3 API with TypeScript declaration.

Example

npm install --save gapi-client

yarn add gapi-client

index.js:

import gapi from '@ganesshkumar/gapi';

gapi.load('client:auth2', () => {
  gapi.client.init({
    discoveryDocs: ["<discoveryDocs_corresponding_to_the_APIs_you_use>"],
    clientId: '<your_client_id>',
    scope: '<scope_you_want_to_add>'
  }).then(function () {
    // do stuff with loaded APIs
    gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
    updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
  });
});

const updateSigninStatus = (isSignedIn) => {
  if (isSignedIn) {
    console.log('User is signed in')
  } else {
    console.log('User is not signed in')
  }
}

// To trigger the sign in flow, you can call the following function from appropriate place.
gapi.auth2.getAuthInstance().signIn();

TypeScript

This repo has the basic support for TypeScript.

License

Apache-2.0

0.2.0

5 years ago

0.1.0

5 years ago

0.1.1

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago