A TypeScript SDK for interacting with the Star Wars API (SWAPI) @ Simplr's SW-API.
# Using bun
bun i @simplr-sh/swapi-sdk
# Using NPM
npm i @simplr-sh/swapi-sdk
# Using NPM
yarn i @simplr-sh/swapi-sdk
- Full TypeScript support
- Type-safe responses
- Simple and intuitive API
getFilms()
: Get all Star Wars filmsgetFilmById(id: number)
: Get a film by IDgetFilmSchema()
: Get the film schemasearchFilms(query: string)
: Search films by title
getPeople()
: Get all peoplegetPersonById(id: number)
: Get a person by IDgetPersonSchema()
: Get the person schemasearchPeople(query: string)
: Search people by name
getPlanets()
: Get all planetsgetPlanetById(id: number)
: Get a planet by IDgetPlanetSchema()
: Get the planet schemasearchPlanets(query: string)
: Search planets by name
getSpecies()
: Get all speciesgetSpeciesById(id: number)
: Get a species by IDgetSpeciesSchema()
: Get the species schemasearchSpecies(query: string)
: Search species by name
getStarships()
: Get all starshipsgetStarshipById(id: number)
: Get a starship by IDgetStarshipSchema()
: Get the starship schemasearchStarships(query: string)
: Search starships by name
getVehicles()
: Get all vehiclesgetVehicleById(id: number)
: Get a vehicle by IDgetVehicleSchema()
: Get the vehicle schemasearchVehicles(query: string)
: Search vehicles by name
getRoot()
: Get the API root endpoints
import { films, people, planets, species, starships, vehicles } from '@simplr-sh/swapi-sdk';
// Get all films
const allFilms = await films.getFilms();
// Search for people
const searchResults = await people.searchPeople('luke');
// Get a specific planet
const tatooine = await planets.getPlanetById(1);
bun install
bun run index.ts
This project was created using bun init
in bun v1.1.42.