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

1.0.2 • Public • Published

🪐 @untypeable/swapi

Untypeable router type definitions & validators for the swapi Star Wars API

🚀 Install

Install it locally in your project

# npm
npm install @untypeable/swapi

# yarn
yarn add @untypeable/swapi

# pnpm
pnpm install @untypeable/swapi

🦄 Usage

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

import { createTypeLevelClient } from "untypeable";

import type { SwapiRouter } from "@untypeable/swapi";

const client = createTypeLevelClient<SwapiRouter>((path, input = {}) =>
  fetch(`https://swapi.dev/api/${path}?${new URLSearchParams(input)}`).then(
    (res) => res.json()
  )
);

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

Package Sidebar

Install

npm i @untypeable/swapi

Homepage

swapi.dev/

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

68.6 kB

Total Files

9

Last publish

Collaborators

  • nurodev