Skip to content

A simple Typescript SDK for the Simplr's Star Wars API (SWAPI) service that provides a simple, typesafe interface to interact with the API.

Notifications You must be signed in to change notification settings

simplr-sh/swapi-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@simplr-sh/swapi-sdk

A TypeScript SDK for interacting with the Star Wars API (SWAPI) @ Simplr's SW-API.

Installation

# Using bun
bun i @simplr-sh/swapi-sdk
# Using NPM
npm i @simplr-sh/swapi-sdk
# Using NPM
yarn i @simplr-sh/swapi-sdk

Features

  • Full TypeScript support
  • Type-safe responses
  • Simple and intuitive API

API Reference

Films

  • getFilms(): Get all Star Wars films
  • getFilmById(id: number): Get a film by ID
  • getFilmSchema(): Get the film schema
  • searchFilms(query: string): Search films by title

People

  • getPeople(): Get all people
  • getPersonById(id: number): Get a person by ID
  • getPersonSchema(): Get the person schema
  • searchPeople(query: string): Search people by name

Planets

  • getPlanets(): Get all planets
  • getPlanetById(id: number): Get a planet by ID
  • getPlanetSchema(): Get the planet schema
  • searchPlanets(query: string): Search planets by name

Species

  • getSpecies(): Get all species
  • getSpeciesById(id: number): Get a species by ID
  • getSpeciesSchema(): Get the species schema
  • searchSpecies(query: string): Search species by name

Starships

  • getStarships(): Get all starships
  • getStarshipById(id: number): Get a starship by ID
  • getStarshipSchema(): Get the starship schema
  • searchStarships(query: string): Search starships by name

Vehicles

  • getVehicles(): Get all vehicles
  • getVehicleById(id: number): Get a vehicle by ID
  • getVehicleSchema(): Get the vehicle schema
  • searchVehicles(query: string): Search vehicles by name

Root

  • getRoot(): Get the API root endpoints

Usage

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);

Development

bun install
bun run index.ts

This project was created using bun init in bun v1.1.42.

About

A simple Typescript SDK for the Simplr's Star Wars API (SWAPI) service that provides a simple, typesafe interface to interact with the API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published