Skip to content

robby-cornelissen/google-api-nodejs-tsd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google-api-nodejs-tsd

Typescript definitions for the Google APIs Node.js Client, generated based on the endpoint metadata made available through the Google API Discovery Service.

Importing and using

To use the type definitions for a given Google API, you need to reference both the base definition file (googleapis/googleapis.d.ts) and the API-specific definition file in your project.

'use strict';

import * as google from "googleapis";

// simple
google.discovery('v1').apis.list({
    preferred: true
}, (e, directoryList) => {
    if(e) {
        console.error(e);
    } else {
        console.log(directoryList.items.map(item => item.name + ' ' + item.version).join('\n'));
    }
});

// typed
import Discovery = google.discovery.v1.Discovery;
import DirectoryList = google.discovery.v1.DirectoryList;

let discovery: Discovery = google.discovery('v1');

discovery.apis.list({
    preferred: true
}, (e, directoryList: DirectoryList) => {
    if(e) {
        console.error(e);
    } else {
        console.log(directoryList.items.map(item => item.name + ' ' + item.version).join('\n'));
    }
});

Caveats

  • The definitions, as well as the definition generator are largely untested.
  • Certain call patterns allowed by the Google client are as of yet undefined in the definitions.

TODO

  • Generate typings.json files so that definitions can be installed using typings.
  • Generate documentation to be added to the definition files.
  • Generate tests to go along with the definition files.
  • Add support for various JSON Schema constructs (e.g. patternProperties)
  • Factor out JSON Schema to Typescript definition conversion into a separate project.
  • Complete the definitions for the Google Auth Node.js Library and put them in a separate project.
  • Complete the definitions for Nunjucks and put them in a separate project.
  • Submit definitions to DefinitelyTyped.
  • A whole lotta testing

About

Typescript definitions for Google APIs Node.js Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published