npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xyz-angular-swapi

v0.1.0

Published

AngularJS wrapper to consume swapi.co API

Downloads

7

Readme

AngularJS service for Star Wars API

An AngularJS service wrapping Stars Wars API (swapi.co), inspired by SWAPI-Wrapper by Raymond Camden.

The service is completly promise oriented and offers access to swapi.co from AngularJS applications.

The xyz.angular.swapi modules comes with one angular constant swapiEndpoints, used internally by the main service swapiService.

To use the service just import the module in your AngularJS application and inject the swapiService whre required.

// include the module
angular.module('myStarWarsApp', ['xyz.angular.swapi']).

controller('jediController', ['swapiService', 
  function($scope, swapiService) {
    // get luke skywalker data
    swapiService.peope('1').
    then(function(lukeData){
      $scope.luke = lukeData;
    });
  }
])
<ul>
  <li>Name: {{luke.name}}</li>
  <li>Eyes color: {{luke.eye_color}}</li>
  <li>Skin color: {{luke.skin_color}}</li>
</ul>

For any end-point exposed by swapi.com 3 methods are available:

  • get specific resource by type and id
  • get all resources for a given type
  • get JSON Schema for a given type

Complete API, all methods return a promise.

film

  • film(id) return one film
  • films([page]) return all films paginated. If no page is passed defaults to 1.
  • filmSchema() return the JSON Schema for the film resource

people

  • person(id) return one person
  • people([page]) return all people paginated. If no page is passed defaults to 1.
  • peopleSchema() return the JSON Schema for the people resource

planets

  • planet(id) return one planet
  • planets([page]) return all planets paginated. If no page is passed defaults to 1.
  • planetSchema() return the JSON Schema for the planet resource

species

  • singleSpecies(id) return one species
  • species([page]) return all species paginated. If no page is passed defaults to 1.
  • speciesSchema() return the JSON Schema for the species resource

starships

  • starship(id) return one starship
  • starships([page]) return all starships paginated. If no page is passed defaults to 1.
  • starshipSchema() return the JSON Schema for the starship resource

vehicles

  • vehicle(id) return one vehicle
  • vehicles([page]) return all vehicles paginated. If no page is passed defaults to 1.
  • vehicleSchema() return the JSON Schema for the vehicle resource

Work in progress

An integration with the local storage has been already done but has external dependencies. Will be added as soon as we can remove all dependencies.