A wrapper to work with the Marvel Web API.
This library relies on Fetch API. And this API is supported in the following browsers.
39+ ✔ | 42+ ✔ | 29+ ✔ | 10.1+ ✔ | Nope ✘ |
This library depends on fetch to make requests to the Marvel Web API. For environments that don't support fetch, you'll need to provide a polyfill to browser or polyfill to Node.
$ npm install marvel-wrapper --save
// to import a specific method
import MarvelWrapper from 'marvel-wrapper';
const marvel = new MarvelWrapper({
privateKey: 'YOUR_PRIVATEKEY_HERE',
publicKey: 'YOUR_PUBLICKEY_HERE',
limit: 'OPTIONAL_LIMIT'
});
// using method
marvel.comic.getComics();
const MarvelWrapper = require('marvel-wrapper').default;
const marvel = new MarvelWrapper({
privateKey: 'YOUR_PRIVATEKEY_HERE',
publicKey: 'YOUR_PUBLICKEY_HERE',
limit: 'OPTIONAL_LIMIT'
});
<!-- to import non-minified version -->
<script src="marvel-wrapper.js"></script>
<!-- to import minified version -->
<script src="marvel-wrapper.min.js"></script>
After that the library will be available to the Global as MarvelWrapper
. Follow an example:
const marvel = new MarvelWrapper({
privateKey: 'YOUR_PRIVATEKEY_HERE',
publicKey: 'YOUR_PUBLICKEY_HERE',
limit: 'OPTIONAL_LIMIT'
});
const comics = marvel.comic.getComics();
Follow the methods that the library provides.
Fetches lists of comics. Test in Marvel Web Console.
--
Example
marvel.comic.getComics()
.then(reponse => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetch one comic by id. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.comic.getComic('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetched list characters by id references comic. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.comic.getCharacters('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list events by id references comic. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.comic.getEvents('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list creators by id references comic. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.comic.getCreators('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list stories by id references comic. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.comic.search('spider')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetched list stories by id references comic. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.comic.getStories('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list comics by start name of search. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
startname |
string | 'Any search letter' |
Example
marvel.comic.search('spider')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetches lists of characters. Test in Marvel Web Console.
--
Example
marvel.character.getCharacters()
.then(reponse => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetch one character by id. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.character.getCharacter('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetched list comics by id references character. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.character.getComics('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list events by id references character. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.character.getEvents('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list creators by id references character. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.character.getSeries('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list stories by id references character. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.character.getStories('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list characters by start name of search. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
startname |
string | 'Any search letter' |
Example
marvel.character.search('spider')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetches lists of creators. Test in Marvel Web Console.
--
Example
marvel.creator.getCreators()
.then(reponse => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetch one creator by id. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.creator.getCreator('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetched list comics by id references creator. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.creator.getComics('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list events by id references creator. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.creator.getEvents('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list creators by id references creator. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.creator.getSeries('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list stories by id references creator. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.creator.getStories('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list creators by start name of search. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
startname |
string | 'Any search letter' |
Example
marvel.creator.search('spider')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetches lists of Events. Test in Marvel Web Console.
--
Example
marvel.event.getEvents()
.then(reponse => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetch one event by id. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.event.getEvent('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetched list characters by id references event. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.event.getCharacters('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list comics by id references event. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.event.getComics('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list creators by id references event. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.event.getCreators('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list events by id references event. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.event.getSeries('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list stories by id references event. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.event.getStories('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list events by start name of search. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
startname |
string | 'Any search letter' |
Example
marvel.event.search('spider')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetches lists of series. Test in Marvel Web Console.
--
Example
marvel.serie.getSeries()
.then(reponse => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetch one serie by id. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.serie.getSerie('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetched list characters by id references serie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.serie.getCharacters('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list comics by id references serie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.serie.getComics('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list creators by id references serie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.serie.getCreators('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list events by id references serie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.serie.getEvents('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list stories by id references serie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.serie.getStories('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list series by start name of search. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
startname |
string | 'Any search letter' |
Example
marvel.serie.search('spider')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetches lists of stories. Test in Marvel Web Console.
--
Example
marvel.storie.getStories()
.then(reponse => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetch one storie by id. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.storie.getStorie('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Fetched list characters by id references storie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.storie.getCharacters('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list comics by id references storie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.storie.getComics('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list creators by id references storie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.storie.getCreators('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list events by id references storie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.storie.getEvents('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list series by id references storie. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
id |
string | 'Any search id' |
Example
marvel.storie.getStories('37504')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item.name))
})
Fetched list stories by start name of search. Test in Marvel Web Console.
Arguments
Argument | Type | Options |
---|---|---|
startname |
string | 'Any search letter' |
Example
marvel.storie.search('spider')
.then(response => {
// do what you want with the response
response => response.data.results.map(item => console.log(item))
})
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Jhones Gonçalves |
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details