Skip to content

A Node.js library for interacting with osu!api, written in TypeScript.

License

Notifications You must be signed in to change notification settings

HiZollo/osu-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@hizollo/osu-api

npm version Downloads Last Commit Code Size License

About

This library is a node.js wrapper of osu!api v1.

Documentation

You can look up the documentation here.

Installation

npm install @hizollo/osu-api
yarn add @hizollo/osu-api

Examples

Import the package:

// CommonJS
const { Client } = require('@hizollo/osu-api')

// ESM
import { Client } from '@hizollo/osu-api'

Create a client to interact with osu!api:

const osu = new Client({
    apiKey: 'your-osu-api-key'
})

Get a user's data:

const user = await osu.users.getUser({ 
    user: 'Cookiezi'
})

Get a player's top 5 play:

const bp = await osu.users.getUserBest({
    user: '214187',
    type: UserRequestType.Id,
    mode: GameMode.Catch,
    limit: 5
})

Fetch a player's banner:

// Fetch directly
const bannerURL = await osu.users.fetchBanner({
    id: '7823498'
})

// ... or if you have the user object
const bannerURL = await user.fetchBanner();

License

This package is published under the MIT license.