@untypeable/lil.apis

v1.0.2
Untypeable router type definitions & validators for the lil.apis API
api lil apis lil news stocks typescript untypeable weather

🤏 @untypeable/lil.apis

Untypeable router type definitions & validators for the lil.apis API

🚀 Install

Install it locally in your project

# npm
npm install @untypeable/lil.apis

# yarn
yarn add @untypeable/lil.apis

# pnpm
pnpm install @untypeable/lil.apis

🦄 Usage

Create a new client instance with the LilRouter & your desired fetch handler

import { createTypeLevelClient } from "untypeable";

import type { LilRouter } from "@untypeable/lil.apis";

const client = createTypeLevelClient<LilRouter>(async (path, input = {}) => {
  const url = new URL(path, "https://api.lil.software/");
  Object.entries(input).forEach(([key, value]) =>
    url.searchParams.append(key, value)
  );

  return fetch(url.href).then((response) => response.json());
});

const weather = await client("/weather", {
  latitude: 40.709335,
  longitude: -73.956558,
});

const news = await client("/news");

const stocks = await client("/stocks", {
  symbol: "AAPL",
});
npm i @untypeable/lil.apis

Metadata

  • MIT
  • Whatever
  • nurodev
  • released 4/11/2023

Downloads

Maintainers