Ninja Parading Musically

    discovery-tsd

    0.3.0 • Public • Published

    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

    Install

    npm i discovery-tsd

    DownloadsWeekly Downloads

    316

    Version

    0.3.0

    License

    ISC

    Unpacked Size

    9.86 kB

    Total Files

    10

    Last publish

    Collaborators

    • callmehiphop