@untypeable/lil.apis
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

🤏 @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",
});

Package Sidebar

Install

npm i @untypeable/lil.apis

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

12 kB

Total Files

9

Last publish

Collaborators

  • nurodev