1.1.1 • Published 4 years ago

happywheels.js v1.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Node.js Happy Wheels API Wrapper

Installation

npm i happywheels.js

Searching levels

const HappyWheels = require('happywheels.js');

HappyWheels.searchLevels('rope swing', 'rating').then(([ level ]) => {
    console.log(level);
});

/*
Level {
    name: 'ROPE SWING',
    description: 'Hello everyone! =)\nThis is my first Rope Swing\n\nI Hope You Like It!\nHave A Nice Day!',
    id: '10037145',
    createdAt: 2018-09-01T00:00:00.000Z,
    author: User {
        name: 'Guy Incognito',
        id: '9716036'
    },
    character: 'Segway Guy',
    playCount: '1421695',
    votes: '6321',
    weightedRating: '4.6916',
    averageRating: 5
}
*/

//OBS: the second parameter can also be an object with:

{
    searchBy: 'name', // (name|user)
    sortBy: 'newest', // (newest|oldest|plays|rating)
    uploaded: 'week', // (today|week|month|anytime)
    page: 1 // int
}

Getting levels by ID

const HappyWheels = require('happywheels.js');

HappyWheels.getLevel('10037145').then((level) => {    
    console.log(level.author);

    level.author.fetchProfile().then(console.log);
});

/*
first log:

User {
    name: 'Guy Incognito',
    id: '9716036'
}

second log:

User {
    name: 'Guy Incognito',
    id: '9716036',
    createdAt: 2018-07-19T00:00:00.000Z,
    website: 'https://www.youtube.com/channel/UCjbZibo8nc6reBHCyJeYHxA',
    location: 'ec1f8d',
    gender: 'Male'
}
*/

Getting users by ID

const HappyWheels = require('happywheels.js');

HappyWheels.getUser('9716036').then((user) => {
    console.log(user.name);

    user.getLevels().then(console.log);
});

Getting replays by ID

const HappyWheels = require('happywheels.js');

HappyWheels.getReplay('62083428').then((replay) => {
    console.log(replay);
});

/*
Replay {
    level: Level {
        name: 'ROPE SWING',
        description: 'Hello everyone! =)\nThis is my first Rope Swing\n\nI Hope You Like It!\nHave A Nice Day!',
        id: '10037145',
        createdAt: 2018-09-01T00:00:00.000Z,
        author: User {
            name: 'Guy Incognito',
            id: '9716036'
        },
        character: 'Segway Guy',
        playCount: '1421695',
        votes: '6321',
        weightedRating: '4.6916',
        averageRating: 5
    }
    description: 'New Record!! =)',
    id: '62083428',
    createdAt: 2019-06-18T00:00:00.000Z,
    author: User { name: 'Guy Incognito', id: '9716036' },
    character: 'Segway Guy',
    votes: '10',
    weightedRating: '3.31',
    averageRating: 5
}
*/
1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago