Codeforces API
NodeJS Client Library forcodeforces-api-node is a simple NodeJS library for Codeforces Api with streaming support.
Install
$ npm install codeforces-api
Usage
codeforces-api-node supports both ES5 and ES6.
Basic
//ES5var Codeforces = ; //ES2015; //set API keys for authenticationCodeforces; Codeforcesmethod parameters callback ;
Usage
Codeforcesuser;
Methods & Parameters
Full description of the API can be found on : Official API Doc
Method | Parameters | Description |
---|---|---|
blogEntry.comments | *blogEntryId | More |
blogEntry.view | *blogEntryId | More |
contest.hacks | contestId | More |
contest.list | gym | More |
contest.ratingChanges | *contestId | More |
contest.standings | *contestId , from , count , handles , room , showUnofficial | More |
contest.status | *contestId , handle , from , count | More |
problemset.problems | tags | More |
problemset.recentStatus | *count | More |
recentActions | *maxCount | More |
user.blogEntries | *handle | More |
user.friends | onlyOnline | More |
user.info | *handles | More |
user.ratedList | activeOnly | More |
user.rating | *handle | More |
user.status | *handle , from , count | More |
*required parameters
Note
handles and tags can be multiple.There are two different ways to set:
- Semicilon-separated string:
tags: 'greedy;dp;graphs'
- As array:
tags: 'greedy''dp''graphs'
Authorization
Although most of the method of the API supports anonymously request, codeforces-api-node
does not allow anonymous request yet.To access API data, must set API and SECRET key before calling methods.To generate API and SECRET KEY visit: API Settings
Return Data
All data return in JSON format.For full description of data format visit: Return Objects
Streaming
This feature and example from npm request package. For more have a look : Request Package Doc
You can stream responses to a file stream.When json data is huge, you may need this feature.
Codeforcesuser ; //version >= 1.0.2 (with or without callback)Codeforcesuser ;
Also emits response events.
Codeforcesuser
Contributing
Everyone wellcome!
- Create an issue > Fork > Create own branch > Commit changes > Push the branch > Creat pull request
Test
Before running test, must set API and SECRET key in environment variable.Keys are:
CFK = API KeyCFS = API Secret
After setting keys, simply run
npm test