Skip to content

callmehiphop/discovery-tsd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

discovery-tsd

Generate TypeScript types from Google's Discovery API

Install

$ npm install discovery-tsd

CLI

$ dtsd bigquery v2 > bigquery.d.ts

API

createTypes(api, version, [options])

const createTypes = require('discovery-tsd');
const fs = require('fs');
const {promisify} = require('util');

const writeFile = promisify(fs.writeFile);

async function getTypes() {
  const types = await createTypes('bigquery', 'v2');
  await writeFile('./bigquery.d.ts', types);
}

fetch(api, version)

Fetches the Discovery Document resource.

Refer to the getRest Documentation for more details.

const {fetch} = require('discovery-tsd');

async function getJSON() {
  const json = await fetch('bigquery', 'v2');
}

render(json, [options])

Creates types for the supplied Discovery Document JSON.

const {fetch, render} = require('discovery-tsd');

async function createTypes() {
  const json = await fetch('bigquery', 'v2');
  return render(json);
}

License

ISC

About

Generate TypeScript types from Google's Discovery API

Resources

License

Stars

Watchers

Forks

Packages

No packages published