Current API
To use the current API (also known as API v2), import the Client
class and instantiate it.
import { Client } from 'osu-web.js';
const api = new Client(accessToken);
Node.js versions prior to 18 don’t have a native fetch API, so you’ll have to use a polyfill instead.
import fetch from 'node-fetch'; // Install this package
import { Client } from 'osu-web.js';
const api = new Client(accessToken, {
polyfillFetch: fetch
});
Parameters
Parameter | Type | Optional | Description |
---|---|---|---|
accessToken | string | An access token | |
options | ✓ |
options
Parameter | Type | Optional | Description |
---|---|---|---|
polyfillFetch | ✓ | In case developing with a Node.js version prior to 18, you need to pass a polyfill for the fetch API. Install node-fetch |
Notice that something is missing? Found a typo? Think something's incomplete? Or think that something can be explained better? Feel free to open a pull request or submit an issue on the library's Github repository .