Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CodewarsV1Api

Main interface class to interface with the codewars v1 public api.

example
import { CodewarsV1Api } from 'codewars-node-api';

const cwApi = new CodewarsV1Api();

const userId = 'bradtaniguchi';
cwApi.getUser(userId).then((user) => {
console.log(user.name); // Brad
});

Hierarchy

  • CodewarsV1Api

Index

Constructors

Properties

BASE_URL: "https://www.codewars.com/api/v1" = ...

The base URL for the API

Methods

  • _request<T>(url: string): Promise<T>
  • Returns the list of completed challenges for the given user. Will throw a CodewarsError depending on the non-200 response status code.

    Parameters

    • user: string

      the username or userId

    • page: number = 0

      the page offset,

    Returns Promise<CompletedChallengeResponse>

    response object with number of pages, items and data.

  • getUser(user: string): Promise<User>
  • Return the user for the given username or userId. Will throw a CodewarsError depending on the non-200 response status code.

    Parameters

    • user: string

      the username or userId

    Returns Promise<User>

    the user found relative to the username or userId.

Generated using TypeDoc