-
Notifications
You must be signed in to change notification settings - Fork 10
/
swapi.min.js
1 lines (1 loc) · 1.31 KB
/
swapi.min.js
1
var swapiModule=function(){function a(a,b){function c(){4==d.readyState&&(200!=d.status||b(JSON.parse(d.responseText)))}var d=new XMLHttpRequest;d.open("get",a,!0),d.setRequestHeader("Accept","application/json"),d.onload=c,d.send()}function b(b){a(o,b)}function c(b,c){a(o+"films/"+b,c)}function d(){1===arguments.length?a(o+"films/",arguments[0]):a(o+"films/?page="+arguments[0],arguments[1])}function e(b,c){a(o+"people/"+b,c)}function f(){1===arguments.length?a(o+"people/",arguments[0]):a(o+"people/?page="+arguments[0],arguments[1])}function g(b,c){a(o+"planets/"+b,c)}function h(){1===arguments.length?a(o+"planets/",arguments[0]):a(o+"planets/?page="+arguments[0],arguments[1])}function i(b,c){a(o+"species/"+b,c)}function j(){1===arguments.length?a(o+"species/",arguments[0]):a(o+"species/?page="+arguments[0],arguments[1])}function k(b,c){a(o+"starships/"+b,c)}function l(){1===arguments.length?a(o+"starships/",arguments[0]):a(o+"starships/?page="+arguments[0],arguments[1])}function m(b,c){a(o+"vehicles/"+b,c)}function n(){1===arguments.length?a(o+"vehicles/",arguments[0]):a(o+"vehicles/?page="+arguments[0],arguments[1])}var o="http://swapi.co/api/";return{getResources:b,getPerson:e,getPeople:f,getFilm:c,getFilms:d,getPlanet:g,getPlanets:h,getSpecies:i,getAllSpecies:j,getStarship:k,getStarships:l,getVehicle:m,getVehicles:n}}();