Utility to call the codewars' public api from nodejs.
Not affiliated with codewars.
Using npm:
npm i codewars-node-api
Note: add --save
if you are using npm < 5.0.0
const { CodewarsV1Api } = require('codewars-node-api');
const cwApi = new CodewarsV1Api();
const userId = 'bradtaniguchi';
cwApi.getUser(userId).then((user) => {
console.log(user.name); // Brad
});
import { CodewarsV1Api } from 'codewars-node-api';
const cwApi = new CodewarsV1Api();
const userId = 'bradtaniguchi';
cwApi.getUser(userId).then((user) => {
console.log(user.name); // Brad
});
All code documentation is available here: https://bradtaniguchi.dev/codewars-node-api/
Below is docs on using the tools
scripts directly by using the npm scripts.
Useful for testing, or just getting raw data directly outputted directly into stdout.
These scripts can be used after cloning this repo locally and testing against the actual api calls your making.
note all npm run
commands can be passed the --silent
flag to suppress the first 2 lines printed, leaving only the raw JSON data being printed out to stdout. This could be useful if your want to save
a given request to a file, or "pipe" it in your shell.
Returns a single user.
npm run get:user <username | userId>
Returns the list of completed challenges for the given user. Includes pagination.
npm run get:completed-challenges <username | userId> [page = 0]
Returns a list of authored challenges made by the user.
npm run get:authored-challenges <username | userId>
Returns a single code challenge.
npm run get:code-challenge <challengeId | challenge-slug>
See CONTRIBUTING and review the CODE_OF_CONDUCT.
See LICENSE