Unofficial Node.js library for interacting with League of Comic Geeks. This provides an API for any system wishing to interact with an account on League of Comic Geeks and supports authentication and all lists. It has a comprehensive integration test setup to detect when the site makes breaking changes. Please create an issue or (better yet) a pull request if you see a problem or need additional features!
- Session -
lofcg.session
- New Comics -
lofcg.newComics
- Search Results -
lofcg.searchResults
- Collection -
lofcg.collection
- Read List -
lofcg.readList
- Wish List -
lofcg.wishList
- Pull List -
lofcg.pullList
All methods on resources are asynchronous and follow the nodejs "error-first callback" pattern. For use with promises, consider using something like Bluebird's promisification functions.
There are examples on using the different resources in the examples
directory.
Methods on the session object:
.create
- Create a new session using the provided username and password. This sets up the session for all subsequent calls..validate
- Validate that the active session is still valid..destroy
- Destroy the current session both locally and on the site..get
- Get the active session object..set
- Set a previously retrieved session object.
Used to log in and out of the application. You can get the current session object for saving, as well as set the current session by setting a previously retrieved session object. The active session can then be validated to confirm it's working.
Calls to get list data all follow a standard format:
list.get(identifier, options, callback);
Where the identifier
can be an issue id, series id, search term, pull list date, etc. depending on the list being accessed.
The options
parameter is optional, but is used to specify the type returned (eg. "series" or "issue") and for any sorting or filtering.
Options support:
type
- Defaults to issue (lofcg.types.ISSUE
).- Use the
lofcg.types
helper for getting type valueslofcg.types.ISSUE
- Single commic issueslofcg.types.SERIES
- Comic series
- Use the
publishers
- an array of publisher names to filter on. Defaults to no filtering.filter
- Defaults to empty array ([]
), all data returned.- Use the
lofcg.filters
helper for getting filter valueslofcg.filters.FIRST_ISSSUES
- Return only first issue comics. Note: This filter only works on the New Comics and Search Results list
- Use the
sort
- Defaults to ascending (lofcg.sort.ASCENDING
).- Use the
lofcg.sort
helper for getting sort valueslofcg.sort.ASCENDING
- Ascending alphabeticallylofcg.sort.DESCENDING
- Descending alphabeticallylofcg.sort.MOST_PULLED
- Descending by how many members have this in their pull listlofcg.sort.PICK_OF_THE_WEEK
- Descending by pick of the week ratinglofcg.sort.CONSENSUS_RATING
- Descending by community consensis rating
- Note: Sorting is performed within the module on the response from the server (ie. not by the server itself) due to sorting bugs in the endpoints. However, the server may provide additional sorting options, depending on the list. Passing a value which is not one of the two supported will be delegated to the server. The server equivalents of the above are
alpha-asc
,alpha-desc
,pulls
,potw
andcommunity
- Use the
const lofcg = require('leagueofcomicgeeks');
const options = {
type: lofcg.types.SERIES,
publishers: ['Marvel Comics', 'DC Comics', 'Other'],
sort: lofcg.sort.DESCENDING
}
lofcg.searchResults.get('detective', options, function (err, results) {
// ...
});
The exception to this is the Pull List, which also requires a date:
const lofcg = require('leagueofcomicgeeks');
const myUserId = 26853; // alistairjcbrown
lofcg.pullList.get(myUserId, '2017-03-29', function (err, pullList) {
// ...
});
Again, additional examples can be found in the examples
directory.
Methods on read-only lists:
.get
- Get a list of comic issues or series for a user
New Comics and Search Results are read-only lists - you can only get data from them, you cannot update them.
Methods on user lists:
.get
- Get a list of comic issues or series for a user.add
- Add a comic issue or series to my list.remove
- Add a comic issue or series to my list
Note: .add
and .remove
require you to be authenticated. .get
does not and can be called on any user.
Just a comic fan and someone who wanted to build on top of the awesome system in place at League of Comic Geeks.
You can see my profile here: https://leagueofcomicgeeks.com/profile/alistairjcbrown