Skip to content

Latest commit

 

History

History
177 lines (103 loc) · 2.75 KB

README.md

File metadata and controls

177 lines (103 loc) · 2.75 KB

npm version

ThmApi

Unofficial TryHackMe Node.js/TypeScript library.

Install

npm i --save-dev thm-api

Usage

import { API, countryEnum } from 'thm-api'
const api = new API()

api.getLeaderboard('0day', 'US', (rank: number) => {
  console.log(rank)
})

Constructors

constructor

new ThmApi()

Accessors

countryList

get countryList(): Object

Returns an object with country code/name pairs.

readonly

memberof ThmApi

Returns

Object

Methods

checkIfUsernameExists

checkIfUsernameExists(username, callback): void

Checks for existence of an user.

Parameters

Name Type Description
username string TryHackMe username
callback Function Data callback function

Returns

void


getLeaderboard

getLeaderboard(username, countryCode, callback): void

Gets rank for an user in a country if provided.

Parameters

Name Type Description
username string TryHackMe username
countryCode string Country code
callback Function Data callback function

Returns

void


getNewRooms

getNewRooms(callback): void

Get a list with the newest released TryHackMe rooms.

Parameters

Name Type Description
callback Function Data callback function

Returns

void


getRoomDetails

getRoomDetails(roomName, callback): void

Get room details.

Parameters

Name Type Description
roomName string TryHackMe roomname
callback Function Data callback function

Returns

void


getRoomVotes

getRoomVotes(roomName, callback): void

Get votes for a given room name.

Parameters

Name Type Description
roomName string TryHackMe roomname
callback Function Data callback function

Returns

void


getSeries

getSeries(callback): void

Get learning paths.

Parameters

Name Type Description
callback Function Data callback function

Returns

void


searchUsername

searchUsername(username, callback): void

Searches for similar usernames. Used to invite users in the platform.

Parameters

Name Type Description
username string TryHackMe username
callback Function Data callback function

Returns

void