1.4.0 • Published 3 months ago

@osirion/api v1.4.0

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
3 months ago

@osirion/api

A typescript client wrapper for the osirion public api

This package makes it easy to use our public api for fortnite match data.

We recommend checking out the generated docs for our package on tsdocs.dev at https://tsdocs.dev/docs/@osirion/api.

Prerequisites

To use the api, you need to:

Once done, you can use the @osirion/api library.

Each api call costs credits, and 1000 credits is about equal to €1.

  • Uploading replays costs 20 credits (~€0.02).
  • Every other api call costs 1 credit (~€0.001).

Note that this is subject to change as we develop the api further.

Getting started

Install the @osirion/api package with your preferred package manager.

pnpm

pnpm add @osirion/api

npm

npm i @osirion/api

yarn

yarn add @osirion/api

Then, initialize the client:

import OsirionClient from "@osirion/api";

const osirion = new OsirionClient("<OSIRION_API_KEY>");

Once initialized, you can make async calls to request fortnite match data or upload fortnite replays to-be-parsed.

Uploading a replay

You can upload a replay by its filepath or the file buffer.

import fsp from "fs/promises";

const filepath = "/path/to/file.replay";

// buffer
const buffer = await fsp.readFile(filepath);
const trackingId = await osirion.uploadReplay(buffer);

// filepath
const trackingId = await osirion.uploadReplay(filepath);

Upload all replays

This uploads all replays in your demos folder, remember that one replay costs 20 credits, so this will likely cost a lot of credits.

const demoDir = `${process.env.LOCALAPPDATA}/FortniteGame/Saved/Demos`;
const demoDirEntries = await fsp.readdir(demoDir);
const demos = demoDirEntries.filter((f) => f.endsWith(".replay"));

for (const demo of demos) {
	const trackingId = await osirion.uploadReplay(`${demoDir}/${demo}`);
	console.info(`Uploaded ${demo}: ${trackingId}`);
}

Check upload status

You can check the status of a uploaded replay with the returned track id.

const result = await osirion.getUploadStatus("<TrackingId>");

// pending
{
    status: 'PENDING',
    matchId: ''
}

// parsed
{
    status: 'COMPLETE',
    matchId: 'e55969a0a86d7b4e843e912f752c2a35'
}

Get matches

This operation returns a sorted list of the matches for specified Epic IDs. Include options to select from specific time periods, seasons, or to limit the number of returned matches.

const matches = await osirion.getMatches([
	"<EpicAccountId1>",
	"<EpicAccountId2>",
]);

Get match info

You can get basic info about a match using a match ID.

const match = await osirion.getMatchInfo("<MatchId>");

Get match events

You can get specific events from a match.

// here we get all cosmetic and normal player events
const events = await osirion.getMatchEvents("<MatchId>", [
	"cosmetics",
	"players",
]);

Get available credits

You can get the available credits left on your osirion account.

const credits = await osirion.getCredits();

Get tournament player stats

You can get player stats for tournaments with filters (stats from server replays).

// get player stats for that specific event window (tournament session)
const playerStats = await osirion.getTournamentPlayerStats({
	eventId: "epicgames_S27_RankedCupBronzeSolo_EU",
	eventWindowId: "S27_RankedCupBronzeSolo_Event1_EU",
});

Disclaimer

The public api is in its early stages, and it may have periods of downtime. This client wrapper library may also have bugs and issues, and the docs may be outdated.

If you have questions or feedback, please contact the Osirion team on our discord server.

1.4.0

3 months ago

1.3.0

3 months ago

1.2.0

3 months ago

1.1.6

4 months ago

1.1.5

4 months ago

1.1.4

5 months ago

1.1.1

5 months ago

1.1.2

5 months ago

1.1.0

5 months ago

1.0.0

5 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago