happy-wheels v1.0.3
Classes
HappyWheels
The main class. Used to interact with the api.
- HappyWheels
- .searchLevels(query, [options]) ⇒ Promise.<Array.<Level>>
- .getFeatured(options) ⇒ Promise.<Array.<Level>>
- .getLevel(id) ⇒ Promise.<Level>
- .getReplay(id) ⇒ Promise.<Replay>
- .getUser(id) ⇒ Promise.<User>
HappyWheels.searchLevels(query, options) ⇒ Promise.<Array.<Level>>
Searches levels in happy wheels
Param | Type | Description |
---|---|---|
query | String | query |
?options | Object | options |
HappyWheels.getFeatured(options) ⇒ Promise.<Array.<Level>>
Gets happy wheels featured levels
Param | Type | Description |
---|---|---|
?options | Object | options |
HappyWheels.getLevel(id) ⇒ Promise.<Level>
Gets happy wheels level
Param | Type | Description |
---|---|---|
id | String | level id |
HappyWheels.getReplay(id) ⇒ Promise.<Replay>
Gets happy wheels replay
Param | Type | Description |
---|---|---|
id | String | replay id |
HappyWheels.getUser(id) ⇒ Promise.<User>
Gets happy wheels user
Param | Type | Description |
---|---|---|
id | String | user id |
Level
Represents a level on happy wheels.
- Level
- new Level(data)
- .name : String
- .id : String
- .description : String
- .character : String
- .createdAt : Date
- .author : User
- .playCount : Number
- .votes : Number
- .weightedRating : Number
- .url : String
- .averageRating : Number
- .getReplays(sortBy) ⇒ Promise.<Array.<Replay>>
new Level(data)
Param | Type | Description |
---|---|---|
data | Object | parsed XML data |
level.name : String
The name of the level
level.id : String
The id of the level
level.description : String
The description of the level
level.character : String
The character of the level
level.createdAt : Date
The creation date of the level
level.author : User
The author of the level
level.playCount : Number
The play count of the level
level.votes : Number
The votes of the level
level.weightedRating : Number
The weighted rating of the level
level.url : String
The level URL.
Read only: true
level.averageRating : Number
The average rating of the level.
Read only: true
level.getReplays(sortBy) ⇒ Promise.<Array.<Replay>>
Gets all replays from the level.
Param | Type | Default | Description |
---|---|---|---|
sortBy | String | completion_time | sort by |
Replay
Represents a replay on happy wheels.
- Replay
- new Replay(data)
- .levelID : String
- .level : Object
- .id : String
- .description : String
- .character : String
- .createdAt : Date
- .author : User
- .votes : Number
- .weightedRating : Number
- .url : String
- .averageRating : Number
- .getLevel() ⇒ Promise.<Level>
new Replay(data)
Param | Type | Description |
---|---|---|
data | Object | parsed XML data |
replay.levelID : String
The ID of the replays level
replay.level : Object
The level of the replay
replay.id : String
The ID of the replay
replay.description : String
The description of the replay
replay.character : String
The character used in the replay
replay.createdAt : Date
The creation date of the replay
replay.author : User
The author of the replay
replay.votes : Number
The votes of the replay
replay.weightedRating : Number
The weighted rating of the replay
replay.url : String
The replay URL.
Read only: true
replay.averageRating : Number
The average rating of the replay.
Read only: true
replay.getLevel() ⇒ Promise.<Level>
Gets the level of the replay.
User
Represents a user on happy wheels.
- User
- new User(id)
- .username : String
- .id : String
- .profileURL : String
- .getLevels() ⇒ Promise.<Array.<Level>>
- .getProfile() ⇒ Promise.<User>
new User(id)
Param | Type | Description |
---|---|---|
id | object | parsed XML data |
user.username : String
The username of the user
user.id : String
The ID of the user
user.profileURL : String
The profile URL.
Read only: true
user.getLevels() ⇒ Promise.<Array.<Level>>
Gets all levels created by this user.
user.getProfile() ⇒ Promise.<User>
Fetches the user's profile on totaljerkface.com and applies it to itself.
Options
{
searchBy: 'name|user',
sortBy: 'newest|oldest|plays|rating',
uploaded: 'today|week|month|anytime',
query: 'any',
limit: 50,
levelID: 'id',
userID: 'id',
replayID: 'id'
}