0.1.0 • Published 7 months ago

google-api-javascript-client v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

google-api-javascript-client

NPM version

This is a simple NPM wrapper around the Google API Javascript Client, which is not published to NPM. This package also includes the TypeScript definitions for the client.

Install

npm install google-api-javascript-client

Usage

import { gapi, load } from "google-api-javascript-client";
// Or
const { gapi, load } = require("google-api-javascript-client");

async function fn() {
    // 1. Load the JavaScript client library.
    await load('client')
    
    // 2. Initialize the JavaScript client library.
    await gapi.client.init({
        'apiKey': 'YOUR_API_KEY',
        // clientId and scope are optional if auth is not required.
        'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
        'scope': 'profile',
    })

    // 3. Initialize and make the API request.
    const response = await gapi.client.request({
        'path': 'https://people.googleapis.com/v1/people/me?requestMask.includeField=person.names',
    })
    console.log(response.result);
}

License

MIT

0.1.0

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago

0.0.0

7 months ago