Skip to content

Instantly share code, notes, and snippets.

@punmechanic
Last active August 29, 2015 14:19
Show Gist options
  • Save punmechanic/37526962498b138bf75d to your computer and use it in GitHub Desktop.
Save punmechanic/37526962498b138bf75d to your computer and use it in GitHub Desktop.
Riot API champion concept
'use strict';
/**
* A factory for creating access to the riot champion API.
* @param {http} http The object to send HTTP GET requests with. This is not a node
* http instance. It must respond to a get method with the signature (region, version, pathname, querystring).
* @param {String} version The version of the API to query.
*/
function champions(http, version) {
/**
* Retrieve all champions from the Riot API.
* @param {String} region The region to query.
* @param {Boolean} freeToPlayOnly Indicate whether champions requested should
* only be free to play champions. Defaults to false.
* @return {Promise<Champion[]>} Returns a promise representing the current
* retrieve operation. Upon success, an array of Champions will be resolved.
*/
function all(region, freeToPlayOnly) {
return http.get(region, version, '/champion', {
freeToPlay: freeToPlayOnly
});
}
return {
all: all
};
}
module.exports = champions;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment