Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 592 Bytes

README.md

File metadata and controls

24 lines (16 loc) · 592 Bytes

Breadboard Discovery Types

Made primarily to read the PaLM API Discovery doc and spit out nice TypeScript declarations.

To use:

import { config } from "dotenv";

import { toTypes } from "@google-labs/discovery-types";

config();

const DISCOVER_DOC_URL =
  "https://generativelanguage.googleapis.com/$discovery/rest?version=v1beta2";
const { API_KEY } = process.env;
if (!API_KEY) throw new Error("API_KEY is not defined");

const response = await fetch(`${DISCOVER_DOC_URL}&key=${API_KEY}`);
const doc = await response.json();

const types = toTypes(doc);
console.log(types);