From f0ad21f1e27485d16518189e68ececf8d64ce197 Mon Sep 17 00:00:00 2001 From: Austin-Wahl Date: Wed, 19 Jun 2024 10:53:57 -0500 Subject: [PATCH] added function outlines and updated docs --- docs/BeatLeader.Clans.html | 2 +- docs/BeatLeader.Leaderboards.html | 2 +- docs/BeatLeader.Modifiers.html | 2 +- docs/BeatLeader.Players.Player.html | 3 + docs/BeatLeader.Players.html | 3 + docs/BeatLeader.html | 2 +- docs/BeatLeader_Clan.js.html | 28 +++--- docs/BeatLeader_Leaderboard.js.html | 32 +++---- docs/BeatLeader_Modifiers.js.html | 6 +- docs/BeatLeader_Player.js.html | 125 +++++++++++++++++++++++++++ docs/BeatLeader_Players.js.html | 59 +++++++++++++ docs/ScoreSaber.Leaderboard.html | 2 +- docs/ScoreSaber.Players.html | 2 +- docs/ScoreSaber.Ranking.Public.html | 2 +- docs/ScoreSaber.Ranking.html | 2 +- docs/ScoreSaber.html | 2 +- docs/Scoresaber_leaderboard.js.html | 4 +- docs/Scoresaber_player.js.html | 4 +- docs/Scoresaber_ranking.js.html | 4 +- docs/data/search.json | 2 +- docs/global.html | 3 + docs/index.html | 4 +- docs/index.js.html | 4 +- package.json | 2 +- src/BeatLeader/Clan.js | 24 ++--- src/BeatLeader/Leaderboard.js | 28 +++--- src/BeatLeader/Modifiers.js | 2 +- src/BeatLeader/Player.js | 122 +++++++++++++++++++++++++- src/BeatLeader/Players.js | 56 +++++++++++- src/BeatLeader/types/BeatLeader.d.ts | 2 +- src/index.d.ts | 3 +- 31 files changed, 452 insertions(+), 86 deletions(-) create mode 100644 docs/BeatLeader.Players.Player.html create mode 100644 docs/BeatLeader.Players.html create mode 100644 docs/BeatLeader_Player.js.html create mode 100644 docs/BeatLeader_Players.js.html create mode 100644 docs/global.html diff --git a/docs/BeatLeader.Clans.html b/docs/BeatLeader.Clans.html index 5760ca4..cca3345 100644 --- a/docs/BeatLeader.Clans.html +++ b/docs/BeatLeader.Clans.html @@ -1,3 +1,3 @@ Namespace: Clans
On this page

BeatLeader. Clans

Interact with the BeatLeader Clan API endpoints

Methods

(static) get(searchOptions) → {Promise}

Retrieves a list of clans based on filters

Parameters:
NameTypeDescription
searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number.
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criterianame, pp, acc, rank, count, captures
orderOrder(Optional) Sorting orderdesc, asc
searchstring(Optional) Search query
Returns:

A promise with a list of clans

Type: 
Promise

(static) getById(id, searchOptions, primary) → {Promise}

Fetches details of a specific clan identified by its ID.

Parameters:
NameTypeDescription
idnumber

ID of the clan to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteriapp, topPp, name, rank, acc, weightedAcc, top1Count, top1Score, weightedRank, topAcc, hmd, playCount, score, lastplay, maxStreak, replaysWatched, dailyImprovements, timing
orderOrder(Optional) Sorting orderdesc, asc
primaryboolean

Whether to include only players for whom this clan is primary, default is false

Returns:

A promise with a clan

Type: 
Promise

(static) getByTag(tag, searchOptions, primary) → {Promise}

Retrieves details of a specific clan by tag

Parameters:
NameTypeDescription
tagstring

Tag of the clans to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteriapp, topPp, name, rank, acc, weightedAcc, top1Count, top1Score, weightedRank, topAcc, hmd, playCount, score, lastplay, maxStreak, replaysWatched, dailyImprovements, timing
orderOrder(Optional) Sorting orderdesc, asc
searchstring(Optional) Search query
primaryboolean

Whether to include only players for whom this clan is primary, default is false

Returns:

A promise with a clan

Type: 
Promise

(static) getGlobalMap() → {Promise}

Fetches a global map showing clan captured maps and rankings.

Returns:

A promise with the Global Map

Type: 
Promise

(static) getMapsById(id, searchOptions) → {Promise}

Fetches ranked maps(maps that can be captured on the global map) for where players of clan made scores identified by its ID, with optional sorting and filtering.

Parameters:
NameTypeDescription
idstring

ID of the clans to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteriapp, acc, rank, date, tohold, toconquer
leaderboardContextLeaderboardContext(Optional) Context of leaderboard. Default is Generalnone, general, noMods, noPause, golf, sCPM, speedrun, speedrunBackup
orderOrder(Optional) Sorting orderdesc, asc
Returns:

A promise with a list of ranked maps

Type: 
Promise

(static) getMapsByTag(tag, searchOptions) → {Promise}

Retrieves a list of clans based on filters

Parameters:
NameTypeDescription
tagstring

Tag of the clans to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteriapp, acc, rank, date, tohold, toconquer
leaderboardContextLeaderboardContext(Optional) Context of leaderboard. Default is Generalnone, general, noMods, noPause, golf, sCPM, speedrun, speedrunBackup
orderOrder(Optional) Sorting orderdesc, asc
Returns:

A promise with a list of ranked maps

Type: 
Promise
\ No newline at end of file +
On this page

BeatLeader. Clans

Interact with the BeatLeader Clan API endpoints

Methods

(static) get(searchOptions) → {Promise}

Retrieves a list of clans based on filters

Parameters:
NameTypeDescription
searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number.
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteria"name", "pp", "acc", "rank", "count", "captures"
orderOrder(Optional) Sorting order"desc", "asc"
searchstring(Optional) Search query
Returns:

A promise with a list of clans

Type: 
Promise

(static) getById(id, searchOptions, primary) → {Promise}

Fetches details of a specific clan identified by its ID.

Parameters:
NameTypeDescription
idnumber

ID of the clan to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteria"pp", "topPp", "name", "rank", "acc", "weightedAcc", "top1Count", "top1Score", "weightedRank", "topAcc", "hmd", "playCount", "score", "lastplay", "maxStreak", "replaysWatched", "dailyImprovements", "timing"
orderOrder(Optional) Sorting order"desc", "asc"
primaryboolean

Whether to include only players for whom this clan is primary, default is false

Returns:

A promise with a clan

Type: 
Promise

(static) getByTag(tag, searchOptions, primary) → {Promise}

Retrieves details of a specific clan by tag

Parameters:
NameTypeDescription
tagstring

Tag of the clans to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteria"pp", "topPp", "name", "rank", "acc", "weightedAcc", "top1Count", "top1Score", "weightedRank", "topAcc", "hmd", "playCount", "score", "lastplay", "maxStreak", "replaysWatched", "dailyImprovements", "timing"
orderOrder(Optional) Sorting order"desc", "asc"
searchstring(Optional) Search query
primaryboolean

Whether to include only players for whom this clan is primary, default is false

Returns:

A promise with a clan

Type: 
Promise

(static) getGlobalMap() → {Promise}

Fetches a global map showing clan captured maps and rankings.

Returns:

A promise with the Global Map

Type: 
Promise

(static) getMapsById(id, searchOptions) → {Promise}

Fetches ranked maps(maps that can be captured on the global map) for where players of clan made scores identified by its ID, with optional sorting and filtering.

Parameters:
NameTypeDescription
idstring

ID of the clans to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteria"pp", "topPp", "name", "rank", "acc", "weightedAcc", "top1Count", "top1Score", "weightedRank", "topAcc", "hmd", "playCount", "score", "lastplay", "maxStreak", "replaysWatched", "dailyImprovements", "timing"
leaderboardContextLeaderboardContext(Optional) Context of leaderboard. Default is General"none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup"
orderOrder(Optional) Sorting order"desc", "asc"
Returns:

A promise with a list of ranked maps

Type: 
Promise

(static) getMapsByTag(tag, searchOptions) → {Promise}

Retrieves a list of clans based on filters

Parameters:
NameTypeDescription
tagstring

Tag of the clans to retrieve details for

searchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page number
countnumber(Optional) Number of items per page
sortByClanSortBy(Optional) Sorting criteria"pp", "topPp", "name", "rank", "acc", "weightedAcc", "top1Count", "top1Score", "weightedRank", "topAcc", "hmd", "playCount", "score", "lastplay", "maxStreak", "replaysWatched", "dailyImprovements", "timing"
leaderboardContextLeaderboardContext(Optional) Context of leaderboard. Default is General"none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup"
orderOrder(Optional) Sorting order"desc", "asc"
Returns:

A promise with a list of ranked maps

Type: 
Promise
\ No newline at end of file diff --git a/docs/BeatLeader.Leaderboards.html b/docs/BeatLeader.Leaderboards.html index d3b2ddd..54264a8 100644 --- a/docs/BeatLeader.Leaderboards.html +++ b/docs/BeatLeader.Leaderboards.html @@ -1,3 +1,3 @@ Namespace: Leaderboards
On this page

BeatLeader. Leaderboards

Interact with the BeatLeader Leaderboard API endpoints

Methods

(static) get(leaderboardSearchOptions) → {Promise}

Retrieves a list of leaderboards

Parameters:
NameTypeDescription
leaderboardSearchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page numberN/A
countnumber(Optional) Number of items per pageN/A
sortByLeaderboardSortBy(Optional) Sorting criteria0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp"
orderOrderSorting order"asc", "desc"
searchstring(Optional) Search queryN/A
typeType(Optional) Type of itemN/A
modestring(Optional) Mode of itemN/A
difficultyDifficulties(Optional) Difficulty level"Standard", "OneSaber", "90Degree", "360Degree"
mapTypeMapsType(Optional) Map type0, 1, 2, "ranked", "unranked", "all"
allTypesOperation(Optional) Operation for all types0, 1, 2, "any", "all", "not"
mapRequirementsRequirementsString(Optional) Map requirements"none", "chroma", "noodles", "mappingExtensions", "cinema", "v3", "optionalProperties", "ignore"
allRequirementsOperation(Optional) Operation for all requirements0, 1, 2, "any", "all", "not"
songStatusSongStatus(Optional) Status of the song0, 2, 4, 8, 16, 32, "none", "curated", "mapOfTheWeek", "noodleMonday", "featuredOnCC", "beastSaberAwarded"
leaderboardContextLeaderboardContexts(Optional) Context of the leaderboard0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup"
mytypeMyType(Optional) Custom type0, 1, 2, 3, 4, 5, 6, "none", "played", "unplayed", "myNominated", "othersNominated", "myMaps"
stars_fromnumber(Optional) Minimum starsN/A
stars_tonumber(Optional) Maximum starsN/A
accrating_fromnumber(Optional) Minimum accuracy ratingN/A
accrating_tonumber(Optional) Maximum accuracy ratingN/A
passrating_fromnumber(Optional) Minimum pass ratingN/A
passrating_tonumber(Optional) Maximum pass ratingN/A
techrating_fromnumber(Optional) Minimum tech ratingN/A
techrating_tonumber(Optional) Maximum tech ratingN/A
date_fromnumber(Optional) Start dateN/A
mappernumber(Optional) Mapper IDN/A
overrideCurrentIdstring(Optional) Override current IDN/A
Returns:

A promise with a list of leaderboards

Type: 
Promise

(static) getById(id, leaderboardSearchOptions) → {Promise}

Retrieves a list of leaderboards

Parameters:
NameTypeDescription
idstring

ID of the leaderboard to retrieve details for

leaderboardSearchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page numberN/A
countnumber(Optional) Number of items per pageN/A
sortByLeaderboardSortBy(Optional) Sorting criteria0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp"
orderOrderSorting order"asc", "desc"
scoreStatusScoreFilterStatus(Optional) Score status filter0, 1, "none", "suspicious"
leaderboardContextLeaderboardContexts(Optional) Context of the leaderboard0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup"
countriesArray(Optional) List of country codesN/A
searchstring(Optional) Search queryN/A
modifiersstring(Optional) ModifiersN/A
friendsboolean(Optional) Filter by friendsN/A
votersboolean(Optional) Filter by votersN/A
predictionboolean(Optional) Prediction filterN/A
Returns:

A promise with leaderboard details

Type: 
Promise

(static) getClanRankingsById(id, page, count) → {Promise}

Retrieves clan rankings for a leaderboard

Parameters:
NameTypeDescription
idstring

ID of the leaderboard to retrieve clan rankings for

pagenumber

Page number for pagination, default is 1

countnumber

Number of rankings per page, default is 10

Returns:

A promise with clan rankings

Type: 
Promise

(static) getScoregraphById(id) → {Promise}

Retrieves the score graph for a leaderboard

Parameters:
NameTypeDescription
idstring

ID of the leaderboard to retrieve the score graph for

Returns:

A promise with score graph data

Type: 
Promise
\ No newline at end of file +
On this page

BeatLeader. Leaderboards

Interact with the BeatLeader Leaderboard API endpoints

Methods

(static) get(leaderboardSearchOptions) → {Promise}

Retrieves a list of leaderboards

Parameters:
NameTypeDescription
leaderboardSearchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page numberN/A
countnumber(Optional) Number of items per pageN/A
sortByLeaderboardSortBy(Optional) Sorting criteria0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp"
orderOrderSorting order"asc", "desc"
searchstring(Optional) Search queryN/A
typeType(Optional) Type of itemN/A
modestring(Optional) Mode of itemN/A
difficultyDifficulties(Optional) Difficulty level"Standard", "OneSaber", "90Degree", "360Degree"
mapTypeMapsType(Optional) Map type0, 1, 2, "ranked", "unranked", "all"
allTypesOperation(Optional) Operation for all types0, 1, 2, "any", "all", "not"
mapRequirementsRequirementsString(Optional) Map requirements"none", "chroma", "noodles", "mappingExtensions", "cinema", "v3", "optionalProperties", "ignore"
allRequirementsOperation(Optional) Operation for all requirements0, 1, 2, "any", "all", "not"
songStatusSongStatus(Optional) Status of the song0, 2, 4, 8, 16, 32, "none", "curated", "mapOfTheWeek", "noodleMonday", "featuredOnCC", "beastSaberAwarded"
leaderboardContextLeaderboardContexts(Optional) Context of the leaderboard0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup"
mytypeMyType(Optional) Custom type0, 1, 2, 3, 4, 5, 6, "none", "played", "unplayed", "myNominated", "othersNominated", "myMaps"
stars_fromnumber(Optional) Minimum starsN/A
stars_tonumber(Optional) Maximum starsN/A
accrating_fromnumber(Optional) Minimum accuracy ratingN/A
accrating_tonumber(Optional) Maximum accuracy ratingN/A
passrating_fromnumber(Optional) Minimum pass ratingN/A
passrating_tonumber(Optional) Maximum pass ratingN/A
techrating_fromnumber(Optional) Minimum tech ratingN/A
techrating_tonumber(Optional) Maximum tech ratingN/A
date_fromnumber(Optional) Start dateN/A
mappernumber(Optional) Mapper IDN/A
overrideCurrentIdstring(Optional) Override current IDN/A
Returns:

A promise with a list of leaderboards

Type: 
Promise

(static) getById(id, leaderboardSearchOptions) → {Promise}

Retrieves a list of leaderboards

Parameters:
NameTypeDescription
idstring

ID of the leaderboard to retrieve details for

leaderboardSearchOptionsObject

Filters to narrow search. See options in table below

ParameterTypeDescriptionValid Values
pagenumber(Optional) Page numberN/A
countnumber(Optional) Number of items per pageN/A
sortByLeaderboardSortBy(Optional) Sorting criteria0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp"
orderOrderSorting order"asc", "desc"
scoreStatusScoreFilterStatus(Optional) Score status filter0, 1, "none", "suspicious"
leaderboardContextLeaderboardContexts(Optional) Context of the leaderboard0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup"
countriesArray(Optional) List of country codesN/A
searchstring(Optional) Search queryN/A
modifiersstring(Optional) ModifiersN/A
friendsboolean(Optional) Filter by friendsN/A
votersboolean(Optional) Filter by votersN/A
predictionboolean(Optional) Prediction filterN/A
Returns:

A promise with leaderboard details

Type: 
Promise

(static) getClanRankingsById(id, page, count) → {Promise}

Retrieves clan rankings for a leaderboard

Parameters:
NameTypeDescription
idstring

ID of the leaderboard to retrieve clan rankings for

pagenumber

Page number for pagination, default is 1

countnumber

Number of rankings per page, default is 10

Returns:

A promise with clan rankings

Type: 
Promise

(static) getScoregraphById(id) → {Promise}

Retrieves the score graph for a leaderboard

Parameters:
NameTypeDescription
idstring

ID of the leaderboard to retrieve the score graph for

Returns:

A promise with score graph data

Type: 
Promise
\ No newline at end of file diff --git a/docs/BeatLeader.Modifiers.html b/docs/BeatLeader.Modifiers.html index a38cf29..7ac1fd3 100644 --- a/docs/BeatLeader.Modifiers.html +++ b/docs/BeatLeader.Modifiers.html @@ -1,3 +1,3 @@ Namespace: Modifiers
On this page

BeatLeader. Modifiers

Interact with BeatLeader Modifiers API endpoints

Methods

(static) get() → {Promise}

Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy support, for the recent values please use modifierValues and modifierRatings on leaderboards.

Returns:

Score multiplier values.

Type: 
Promise
\ No newline at end of file +
On this page

BeatLeader. Modifiers

Interact with BeatLeader Modifiers API endpoints

Methods

(static) get() → {Promise}

Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy support, for the recent values please use modifierValues and modifierRatings on leaderboards.

Returns:

Score multiplier values.

Type: 
Promise
\ No newline at end of file diff --git a/docs/BeatLeader.Players.Player.html b/docs/BeatLeader.Players.Player.html new file mode 100644 index 0000000..773b0fb --- /dev/null +++ b/docs/BeatLeader.Players.Player.html @@ -0,0 +1,3 @@ +Namespace: Player
On this page

BeatLeader.Players. Player

Interact with the BeatLeader Player API endpoints

Methods

(static) getByBeatSaverId(beatsaverId) → {Promise}

Get profile data for a specific user based on their BeatSaver ID

Parameters:
NameTypeDescription
beatsaverIdstring

BeatSaver ID of user to get data for

Returns:

Returns a promise with profile data on a specific user

Type: 
Promise

(static) getByDiscordId(discordId) → {Promise}

Get profile data for a specific user based on their Discord ID

Parameters:
NameTypeDescription
discordIdstring

Discord ID of user to get data for

Returns:

Returns a promise with profile data on a specific user

Type: 
Promise

(static) getByPatreonId(patreonId) → {Promise}

Get profile data for a specific user based on their Patreon ID

Parameters:
NameTypeDescription
patreonIdstring

Patreon ID of user to get data for

Returns:

Returns a promise with profile data on a specific user

Type: 
Promise

(static) getFollowerInfoById(id) → {Promise}

Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most followed players this player follows

Parameters:
NameTypeDescription
idstring

ID of user to get data for

Returns:

Returns a promise with follower data

Type: 
Promise

(static) getFollowersById(id, page, count, relationship) → {Promise}

Retrieves a full list of player' followers and players this player follow.

Parameters:
NameTypeDescription
idstring

ID of user to get data for

pagenumber

Page to get data from. Default is 1

countnumber

Number of players to return. Default is 10

relationshipstring

Relationship type: followers or following Available values : followers, following

Returns:

Returns a promise with followers

Type: 
Promise

(static) getFoundedClanById(id) → {Promise}

Retrieves an information about the clan this player created and manage.

Parameters:
NameTypeDescription
idstring

ID of user to get data for

Returns:

Returns a promise with info on a specific clan

Type: 
Promise

(static) getParticipatedEventsById(id) → {Promise}

Get events a user has participated in based on their ID

Parameters:
NameTypeDescription
idstring

ID of user to get data for

Returns:

Returns a promise with a list of events a user has participated in

Type: 
Promise

(static) getRankedMapsById(id) → {Promise}

Returns brief stats about maps this player ranked, like count, total PP gained, etc...

Parameters:
NameTypeDescription
idstring

ID of user to get data for

Returns:

Returns a promise with ranked map data

Type: 
Promise
\ No newline at end of file diff --git a/docs/BeatLeader.Players.html b/docs/BeatLeader.Players.html new file mode 100644 index 0000000..c258e39 --- /dev/null +++ b/docs/BeatLeader.Players.html @@ -0,0 +1,3 @@ +Namespace: Players
On this page

BeatLeader. Players

Interact with the BeatLeader Players API endpoints

Namespaces

Player

Methods

(static) get(playerSearchOptions) → {Promise}

Retrieves a list of players based on filters

Parameters:
NameTypeDescription
playerSearchOptionsobject

Optional filters to help narrow search. See table below for valid parameters.

ParameterTypeDescriptionValid Values
sortByPlayerSortBy(Optional) Sorting criteria0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, "pp", "topPp", "name", "rank", "acc", "weightedAcc", "top1Count", "top1Score", "weightedRank", "topAcc", "hmd", "playCount", "score", "lastplay", "maxStreak", "replaysWatched", "dailyImprovements", "timing"
pagenumber(Optional) Page numberN/A
countnumber(Optional) Number of items per pageN/A
searchstring(Optional) Search queryN/A
orderOrder(Optional) Sorting order"asc", "desc"
countriesArray(Optional) List of country codesN/A
mapsTypeMapsType(Optional) Map type0, 1, 2, "ranked", "unranked", "all"
ppTypePpTypePP typeN/A
leaderboardContextLeaderboardContexts(Optional) Context of the leaderboard0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup"
friendsboolean(Optional) Filter by friendsN/A
pp_rangeArray(Optional) PP rangeN/A
score_rangeArray(Optional) Score rangeN/A
platformArray(Optional) Platform filterN/A
roleArray(Optional) Role filterN/A
hmdArray(Optional) HMD filter0, 1, 2, 4, 8, 16, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 128, 256, 512, "unknown", "rift", "vive", "vivePro", "wmr", "riftS", "quest", "picoNeo3", "picoNeo2", "vivePro2", "viveElite", "miramar", "pimax8k", "pimax5k", "pimaxArtisan", "hpReverb", "samsungWmr", "qiyuDream", "disco", "lenovoExplorer", "acerWmr", "viveFocus", "arpara", "dellVisor", "e3", "viveDvt", "glasses20", "hedy", "vaporeon", "huaweivr", "asusWmr", "cloudxr", "vridge", "medion", "picoNeo4", "questPro", "pimaxCrystal", "e4", "index", "controllable", "bigscreenbeyond", "nolosonic", "hypereal", "varjoaero", "viveCosmos", "quest2", "quest3"
clansArray(Optional) Clan filterN/A
activityPeriodnumber(Optional) Activity periodN/A
bannedboolean(Optional) Ban filterN/A
Returns:

Returns a promise with a list of players

Type: 
Promise
\ No newline at end of file diff --git a/docs/BeatLeader.html b/docs/BeatLeader.html index 06a9f00..23eec19 100644 --- a/docs/BeatLeader.html +++ b/docs/BeatLeader.html @@ -1,3 +1,3 @@ Namespace: BeatLeader
On this page

BeatLeader

\ No newline at end of file +
On this page

BeatLeader

\ No newline at end of file diff --git a/docs/BeatLeader_Clan.js.html b/docs/BeatLeader_Clan.js.html index 8613ab2..d4f1d0c 100644 --- a/docs/BeatLeader_Clan.js.html +++ b/docs/BeatLeader_Clan.js.html @@ -1,6 +1,6 @@ Source: BeatLeader/Clan.js
On this page

BeatLeader_Clan.js

const {beatleader} = require('../api_urls.json').urls
+    
On this page

BeatLeader_Clan.js

const {beatleader} = require('../api_urls.json').urls
 const {parseSearchOptions} = require('./utility/parseSearchOptions')
 
 /**
@@ -18,8 +18,8 @@
  * |-----------|-------------|-----------------------              |---------------|
  * | page      | number      | (Optional) Page number.             |        |
  * | count     | number      | (Optional) Number of items per page |        |
- * | sortBy    | ClanSortBy  | (Optional) Sorting criteria         | name, pp, acc, rank, count, captures |
- * | order     | Order       | (Optional) Sorting order            | desc, asc     |
+ * | sortBy    | ClanSortBy  | (Optional) Sorting criteria         | `"name"`, `"pp"`, `"acc"`, `"rank"`, `"count"`, `"captures"` |
+ * | order     | Order       | (Optional) Sorting order            | `"desc"`, `"asc"`     |
  * | search    | string      | (Optional) Search query             |        |
  * @returns {Promise} A promise with a list of clans
  */
@@ -52,8 +52,8 @@
  * |-----------|-------------|-------------------------------------|---------------|
  * | page      | number      | (Optional) Page number              |        |
  * | count     | number      | (Optional) Number of items per page |        |
- * | sortBy    | ClanSortBy  | (Optional) Sorting criteria         | pp, topPp, name, rank, acc, weightedAcc, top1Count, top1Score, weightedRank, topAcc, hmd, playCount, score, lastplay, maxStreak, replaysWatched, dailyImprovements, timing |
- * | order     | Order       | (Optional) Sorting order            | desc, asc     |
+ * | sortBy    | ClanSortBy  | (Optional) Sorting criteria         | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` |
+ * | order     | Order       | (Optional) Sorting order            | `"desc"`, `"asc"`     |
  * | search    | string      | (Optional) Search query             |        |
  * @param {boolean} primary Whether to include only players for whom this clan is primary, default is false
  * @returns {Promise} A promise with a clan
@@ -87,8 +87,8 @@
  * |-----------|-------------|-------------------------------------|---------------|
  * | page      | number      | (Optional) Page number              |        |
  * | count     | number      | (Optional) Number of items per page |        |
- * | sortBy    | ClanSortBy  | (Optional) Sorting criteria         | pp, topPp, name, rank, acc, weightedAcc, top1Count, top1Score, weightedRank, topAcc, hmd, playCount, score, lastplay, maxStreak, replaysWatched, dailyImprovements, timing |
- * | order     | Order       | (Optional) Sorting order            | desc, asc     |
+ * | sortBy    | ClanSortBy  | (Optional) Sorting criteria         | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` |
+ * | order     | Order       | (Optional) Sorting order            | `"desc"`, `"asc"`     |
  * @param {boolean} primary Whether to include only players for whom this clan is primary, default is false
  * @returns {Promise} A promise with a clan
  */
@@ -121,9 +121,9 @@
  * |--------------------|--------------------|-------------------------------------                 |---------------|
  * | page               | number             | (Optional) Page number                               |        |
  * | count              | number             | (Optional) Number of items per page                  |        |
- * | sortBy             | ClanSortBy         | (Optional) Sorting criteria                          | pp, acc, rank, date, tohold, toconquer |
- * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| none, general, noMods, noPause, golf, sCPM, speedrun, speedrunBackup |
- * | order              | Order              | (Optional) Sorting order                             | desc, asc     |
+ * | sortBy             | ClanSortBy         | (Optional) Sorting criteria                          | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` |
+ * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` |
+ * | order              | Order              | (Optional) Sorting order                             | `"desc"`, `"asc"`     |
  * @returns {Promise} A promise with a list of ranked maps 
  */
 async function getMapsByTag(tag, searchOptions = {}) {
@@ -154,9 +154,9 @@
  * |--------------------|--------------------|-------------------------------------                 |---------------|
  * | page               | number             | (Optional) Page number                               |        |
  * | count              | number             | (Optional) Number of items per page                  |        |
- * | sortBy             | ClanSortBy         | (Optional) Sorting criteria                          | pp, acc, rank, date, tohold, toconquer |
- * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| none, general, noMods, noPause, golf, sCPM, speedrun, speedrunBackup |
- * | order              | Order              | (Optional) Sorting order                             | desc, asc     |
+ * | sortBy             | ClanSortBy         | (Optional) Sorting criteria                          | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` |
+ * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` |
+ * | order              | Order              | (Optional) Sorting order                             | `"desc"`, `"asc"`     |
  * @returns {Promise} A promise with a list of ranked maps
  */
 async function getMapsById(id, searchOptions = {}) {
@@ -205,4 +205,4 @@
     getMapsByTag: getMapsByTag,
     getMapsById: getMapsById,
     getGlobalMap: getGlobalMap
-}
\ No newline at end of file +}
\ No newline at end of file diff --git a/docs/BeatLeader_Leaderboard.js.html b/docs/BeatLeader_Leaderboard.js.html index 9ef9964..8ed8615 100644 --- a/docs/BeatLeader_Leaderboard.js.html +++ b/docs/BeatLeader_Leaderboard.js.html @@ -1,6 +1,6 @@ Source: BeatLeader/Leaderboard.js
On this page

BeatLeader_Leaderboard.js

const {beatleader} = require('../api_urls.json').urls
+    
On this page

BeatLeader_Leaderboard.js

const {beatleader} = require('../api_urls.json').urls
 const {parseSearchOptions} = require('./utility/parseSearchOptions')
 
 /**
@@ -18,19 +18,19 @@
  * |---------------------|-------------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------|
  * | page                | number                  | (Optional) Page number               | N/A                                                                                                 |
  * | count               | number                  | (Optional) Number of items per page  | N/A                                                                                                 |
- * | sortBy              | LeaderboardSortBy       | (Optional) Sorting criteria          | 0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp" |
- * | order               | Order                   | Sorting order                        | "asc", "desc"                                                                                       |
+ * | sortBy              | LeaderboardSortBy       | (Optional) Sorting criteria          | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `"date"`, `"pp"`, `"acc"`, `"pauses"`, `"rank"`, `"maxStreak"`, `"mistakes"`, `"weight"`, `"weightedPp"` |
+ * | order               | Order                   | Sorting order                        | `"asc"`, `"desc"`                                                                                       |
  * | search              | string                  | (Optional) Search query              | N/A                                                                                                 |
  * | type                | Type                    | (Optional) Type of item              | N/A                                                                                                 |
  * | mode                | string                  | (Optional) Mode of item              | N/A                                                                                                 |
- * | difficulty          | Difficulties            | (Optional) Difficulty level          | "Standard", "OneSaber", "90Degree", "360Degree"                                                     |
- * | mapType             | MapsType                | (Optional) Map type                  | 0, 1, 2, "ranked", "unranked", "all"                                                                |
- * | allTypes            | Operation               | (Optional) Operation for all types   | 0, 1, 2, "any", "all", "not"                                                                        |
- * | mapRequirements     | RequirementsString      | (Optional) Map requirements          | "none", "chroma", "noodles", "mappingExtensions", "cinema", "v3", "optionalProperties", "ignore"    |
- * | allRequirements     | Operation               | (Optional) Operation for all requirements | 0, 1, 2, "any", "all", "not"                                                                    |
- * | songStatus          | SongStatus              | (Optional) Status of the song        | 0, 2, 4, 8, 16, 32, "none", "curated", "mapOfTheWeek", "noodleMonday", "featuredOnCC", "beastSaberAwarded" |
- * | leaderboardContext  | LeaderboardContexts     | (Optional) Context of the leaderboard | 0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup" |
- * | mytype              | MyType                  | (Optional) Custom type               | 0, 1, 2, 3, 4, 5, 6, "none", "played", "unplayed", "myNominated", "othersNominated", "myMaps"      |
+ * | difficulty          | Difficulties            | (Optional) Difficulty level          |`"Standard"`, `"OneSaber"`, `"90Degree"`, `"360Degree"`                                              |
+ * | mapType             | MapsType                | (Optional) Map type                  | `0`, `1`, `2`, `"ranked"`, `"unranked"`, `"all"`                                                                |
+ * | allTypes            | Operation               | (Optional) Operation for all types   | `0`, `1`, `2`, `"any"`, `"all"`, `"not"`                                                                        |
+ * | mapRequirements     | RequirementsString      | (Optional) Map requirements          | `"none"`, `"chroma"`, `"noodles"`, `"mappingExtensions"`, `"cinema"`, `"v3"`, `"optionalProperties"`, `"ignore"`    |
+ * | allRequirements     | Operation               | (Optional) Operation for all requirements | `0`, `1`, `2`, `"any"`, `"all"`, `"not"`                                                                    |
+ * | songStatus          | SongStatus              | (Optional) Status of the song        | `0`, `2`, `4`, `8`, `16`, `32`, `"none"`, `"curated"`, `"mapOfTheWeek"`, `"noodleMonday"`, `"featuredOnCC"`, `"beastSaberAwarded"` |
+ * | leaderboardContext  | LeaderboardContexts     | (Optional) Context of the leaderboard | `0`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` |
+ * | mytype              | MyType                  | (Optional) Custom type               | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `"none"`, `"played"`, `"unplayed"`, `"myNominated"`, `"othersNominated"`, `"myMaps"`      |
  * | stars_from          | number                  | (Optional) Minimum stars             | N/A                                                                                                 |
  * | stars_to            | number                  | (Optional) Maximum stars             | N/A                                                                                                 |
  * | accrating_from      | number                  | (Optional) Minimum accuracy rating   | N/A                                                                                                 |
@@ -71,10 +71,10 @@
  * |---------------------|-------------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------|
  * | page                | number                  | (Optional) Page number               | N/A                                                                                                 |
  * | count               | number                  | (Optional) Number of items per page  | N/A                                                                                                 |
- * | sortBy              | LeaderboardSortBy       | (Optional) Sorting criteria          | 0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp" |
- * | order               | Order                   | Sorting order                        | "asc", "desc"                                                                                       |
- * | scoreStatus         | ScoreFilterStatus       | (Optional) Score status filter       | 0, 1, "none", "suspicious"                                                                                                 |
- * | leaderboardContext  | LeaderboardContexts     | (Optional) Context of the leaderboard | 0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup" |
+ * | sortBy              | LeaderboardSortBy       | (Optional) Sorting criteria          | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `"date"`, `"pp"`, `"acc"`, `"pauses"`, `"rank"`, `"maxStreak"`, `"mistakes"`, `"weight"`, `"weightedPp"` |
+ * | order               | Order                   | Sorting order                        | `"asc"`, `"desc"`                                                                                       |
+ * | scoreStatus         | ScoreFilterStatus       | (Optional) Score status filter       | `0`, `1`, `"none"`, `"suspicious"`                                                                                                 |
+ * | leaderboardContext  | LeaderboardContexts     | (Optional) Context of the leaderboard | `0`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` |
  * | countries           | Array<string>           | (Optional) List of country codes     | N/A                                                                                                 |
  * | search              | string                  | (Optional) Search query              | N/A                                                                                                 |
  * | modifiers           | string                  | (Optional) Modifiers                 | N/A                                                                                                 |
@@ -158,4 +158,4 @@
     getById: getById,
     getClanRankingsById: getClanRankingsById,
     getScoregraphById: getScoregraphById
-}
\ No newline at end of file +}
\ No newline at end of file diff --git a/docs/BeatLeader_Modifiers.js.html b/docs/BeatLeader_Modifiers.js.html index 82efc8e..99af886 100644 --- a/docs/BeatLeader_Modifiers.js.html +++ b/docs/BeatLeader_Modifiers.js.html @@ -1,6 +1,6 @@ Source: BeatLeader/Modifiers.js
On this page

BeatLeader_Modifiers.js

const {beatleader} = require('../api_urls.json').urls
+    
On this page

BeatLeader_Modifiers.js

const {beatleader} = require('../api_urls.json').urls
 
 /**
  * Interact with BeatLeader Modifiers API endpoints
@@ -17,7 +17,7 @@
 async function get() {
     try {
         let route = new URL(beatleader + 'modifiers').href
-        let res = await fetch(route)
+        let res = await fetch(encodeURI(route))
 
         if(res.status != 200)
             return Promise.reject(new Error("Undocumented error: " + res.status))
@@ -30,4 +30,4 @@
 
 exports.BeatLeaderModifiers = {
   get: get  
-}
\ No newline at end of file +}
\ No newline at end of file diff --git a/docs/BeatLeader_Player.js.html b/docs/BeatLeader_Player.js.html new file mode 100644 index 0000000..ab8ceec --- /dev/null +++ b/docs/BeatLeader_Player.js.html @@ -0,0 +1,125 @@ +Source: BeatLeader/Player.js
On this page

BeatLeader_Player.js

const {beatleader} = require('../api_urls.json').urls
+
+/**
+ * Interact with the BeatLeader Player API endpoints
+ * @namespace BeatLeader.Players.Player
+ * @memberof BeatLeader.Players
+ */
+
+/**
+ * Get profile data for a specific user based on their ID
+ * @function get
+ * @param {string} id ID of user to get data for
+ * @param {boolean} stats Include stats in the response. Default is true
+ * @param {boolean} keepOriginalId Whether to keep original ID (for migrated players). Default is false
+ * @param {string} leaderboardContext. Leaderboard context, 'general' by default. Available values : `none`, `general`, `noMods`, `noPause`, `golf`, `sCPM`, `speedrun`, `speedrunBackup`
+ * @returns {Promise} Returns a promise with profile data on a specific user
+ */
+async function get(id, stats = true, keepOriginalId = false, leaderboardContext = "general") {
+
+}
+
+/**
+ * Get profile data for a specific user based on their Discord ID
+ * @function getByDiscordId
+ * @memberof BeatLeader.Players.Player
+ * @param {string} discordId Discord ID of user to get data for
+ * @returns {Promise} Returns a promise with profile data on a specific user
+ */
+async function getByDiscordId(discordId) {
+
+}
+
+/**
+ * Get profile data for a specific user based on their BeatSaver ID
+ * @function getByBeatSaverId
+ * @memberof BeatLeader.Players.Player
+ * @param {string} beatsaverId BeatSaver ID of user to get data for
+ * @returns {Promise} Returns a promise with profile data on a specific user
+ */
+async function getByBeatSaverId(beatsaverId) {
+
+}
+
+/**
+ * Get profile data for a specific user based on their Patreon ID
+ * @function getByPatreonId
+ * @memberof BeatLeader.Players.Player
+ * @param {string} patreonId Patreon ID of user to get data for
+ * @returns {Promise} Returns a promise with profile data on a specific user
+ */
+async function getByPatreonId(patreonId) {
+
+}
+
+/**
+ * Get events a user has participated in based on their ID
+ * @function getParticipatedEventsById
+ * @memberof BeatLeader.Players.Player
+ * @param {string} id ID of user to  get data for
+ * @returns {Promise} Returns a promise with a list of events a user has participated in
+ */
+async function getParticipatedEventsById(id) {
+
+}
+
+/**
+ * Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most followed players this player follows
+ * @function getFollowerInfoById
+ * @memberof BeatLeader.Players.Player
+ * @param {string} id ID of user to  get data for
+ * @returns {Promise} Returns a promise with follower data
+ */
+async function getFollowerInfoById(id) {
+
+}
+
+/**
+ * Retrieves a full list of player' followers and players this player follow.
+ * @function getFollowersById
+ * @memberof BeatLeader.Players.Player
+ * @param {string} id ID of user to get data for
+ * @param {number} page Page to get data from. Default is 1
+ * @param {number} count Number of players to return. Default is 10
+ * @param {string} relationship Relationship type: followers or following Available values : `followers`, `following`
+ * @returns {Promise} Returns a promise with followers
+ */
+async function getFollowersById(id, page = 1, count = 10) {
+
+}
+
+/**
+ * Retrieves an information about the clan this player created and manage.
+ * @function getFoundedClanById
+ * @memberof BeatLeader.Players.Player
+ * @param {string} id ID of user to  get data for
+ * @returns {Promise} Returns a promise with info on a specific clan
+ */
+async function getFoundedClanById(id) {
+
+}
+
+/**
+ * Returns brief stats about maps this player ranked, like count, total PP gained, etc...
+ * @function getRankedMapsById
+ * @memberof BeatLeader.Players.Player
+ * @param {string} id ID of user to  get data for
+ * @returns {Promise} Returns a promise with ranked map data
+ */
+async function getRankedMapsById(id) {
+
+}
+
+exports.BeatleaderPlayer = {
+    get: get,
+    getByDiscordId: getByDiscordId,
+    getByBeatSaverId: getByBeatSaverId,
+    getByPatreonId: getByPatreonId,
+    getParticipatedEventsById: getParticipatedEventsById,
+    getFollowerInfoById: getFollowerInfoById,
+    getFollowersById: getFollowersById,
+    getFoundedClanById: getFoundedClanById,
+    getRankedMapsById: getRankedMapsById
+}
\ No newline at end of file diff --git a/docs/BeatLeader_Players.js.html b/docs/BeatLeader_Players.js.html new file mode 100644 index 0000000..556c2de --- /dev/null +++ b/docs/BeatLeader_Players.js.html @@ -0,0 +1,59 @@ +Source: BeatLeader/Players.js
On this page

BeatLeader_Players.js

const { beatleader } = require('../api_urls.json').urls
+const { parseSearchOptions } = require('./utility/parseSearchOptions')
+
+/**
+ * Interact with the BeatLeader Players API endpoints
+ * @namespace BeatLeader.Players
+ * @memberof BeatLeader
+ */
+
+/**
+ * Retrieves a list of players based on filters
+ * @function get 
+ * @memberof BeatLeader.Players
+ * @param {object} playerSearchOptions Optional filters to help narrow search. See table below for valid parameters.
+ * | Parameter           | Type                    | Description                          | Valid Values                                                                                       |
+ * |---------------------|-------------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------|
+ * | sortBy              | PlayerSortBy            | (Optional) Sorting criteria          | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` |
+ * | page                | number                  | (Optional) Page number               | N/A                                                                                                 |
+ * | count               | number                  | (Optional) Number of items per page  | N/A                                                                                                 |
+ * | search              | string                  | (Optional) Search query              | N/A                                                                                                 |
+ * | order               | Order                   | (Optional) Sorting order             | `"asc"`, `"desc"`                                                                                       |
+ * | countries           | Array<string>           | (Optional) List of country codes     | N/A                                                                                                 |
+ * | mapsType            | MapsType                | (Optional) Map type                  | `0`, `1`, `2`, `"ranked"`, `"unranked"`, `"all"`                                                                |
+ * | ppType              | PpType                  | PP type                              | N/A                                                                                                 |
+ * | leaderboardContext  | LeaderboardContexts     | (Optional) Context of the leaderboard | `0`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` |
+ * | friends             | boolean                 | (Optional) Filter by friends         | N/A                                                                                                 |
+ * | pp_range            | Array<string>           | (Optional) PP range                  | N/A                                                                                                 |
+ * | score_range         | Array<string>           | (Optional) Score range               | N/A                                                                                                 |
+ * | platform            | Array<string>           | (Optional) Platform filter           | N/A                                                                                                 |
+ * | role                | Array<string>           | (Optional) Role filter               | N/A                                                                                                 |
+ * | hmd                 | Array<string>           | (Optional) HMD filter                | `0`, `1`, `2`, `4`, `8`, `16`, `32`, `33`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `41`, `42`, `43`, `44`, `45`, `46`, `47`, `48`, `49`, `50`, `51`, `52`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `62`, `63`, `64`, `65`, `66`, `67`, `68`, `69`, `128`, `256`, `512`, `"unknown"`, `"rift"`, `"vive"`, `"vivePro"`, `"wmr"`, `"riftS"`, `"quest"`, `"picoNeo3"`, `"picoNeo2"`, `"vivePro2"`, `"viveElite"`, `"miramar"`, `"pimax8k"`, `"pimax5k"`, `"pimaxArtisan"`, `"hpReverb"`, `"samsungWmr"`, `"qiyuDream"`, `"disco"`, `"lenovoExplorer"`, `"acerWmr"`, `"viveFocus"`, `"arpara"`, `"dellVisor"`, `"e3"`, `"viveDvt"`, `"glasses20"`, `"hedy"`, `"vaporeon"`, `"huaweivr"`, `"asusWmr"`, `"cloudxr"`, `"vridge"`, `"medion"`, `"picoNeo4"`, `"questPro"`, `"pimaxCrystal"`, `"e4"`, `"index"`, `"controllable"`, `"bigscreenbeyond"`, `"nolosonic"`, `"hypereal"`, `"varjoaero"`, `"viveCosmos"`, `"quest2"`, `"quest3"` |
+ * | clans               | Array<string>           | (Optional) Clan filter               | N/A                                                                                                 |
+ * | activityPeriod      | number                  | (Optional) Activity period           | N/A                                                                                                 |
+ * | banned              | boolean                 | (Optional) Ban filter                | N/A                                                                                                 |
+ * @returns {Promise} Returns a promise with a list of players
+ */
+async function get(playerSearchOptions = {}) {
+    try {
+        let route = new URL(beatleader + 'players')
+        let parsedSearchOptions = parseSearchOptions(playerSearchOptions)
+        route += parsedSearchOptions
+        let res = await fetch(encodeURI(route))
+
+        if (res.status == 400)
+            return Promise.reject(new Error("Invalid request parameters"))
+        if (res.status == 404)
+            return Promise.reject(new Error("Players not found"))
+        if (res.status != 200)
+            return Promise.reject(new Error("Undocumented error: " + res.status))
+
+        return res.json()
+    } catch (error) {
+        throw new Error(error)
+    }
+}
+
+exports.BeatLeaderGetAllPlayers = get
\ No newline at end of file diff --git a/docs/ScoreSaber.Leaderboard.html b/docs/ScoreSaber.Leaderboard.html index d104828..0222d1a 100644 --- a/docs/ScoreSaber.Leaderboard.html +++ b/docs/ScoreSaber.Leaderboard.html @@ -1,3 +1,3 @@ Namespace: Leaderboard
On this page

ScoreSaber. Leaderboard

Allows interaction with the ScoreSaber Leaderboard API endpoints

Methods

(static) difficultiesByHash(mapHash) → {Promise.<Array>}

Gets a maps difficulties based on hash

Parameters:
NameTypeDescription
mapHashstring

Map hash

Returns:

Difficulties offered on by a map

Type: 
Promise.<Array>

(static) get(query, page, options) → {Promise.<Array>}

Gets a list of leaderboards based on filters

Parameters:
NameTypeDescription
querystring

Query for specific terms

pagenumber

Page of result

optionsobject

More Filters

PropertyTypeDescription
verifiedbooleanFilter by verified (️deprecation notice)
rankedbooleanIndicates if only ranked songs should be included.
qualifiedbooleanIndicates if only qualified songs should be included.
lovedbooleanIndicates if only loved songs should be included.
minStarnumberThe minimum star rating of songs to include.
maxStarnumberThe maximum star rating of songs to include.
category0 | 1 | 2 | 3 | 4Which category to sort by (0 = trending, date ranked = 1,
scores set = 2, star difficulty = 3, author = 4)
sort0 | 1The sorting order: 0 (Descending) or 1 (Ascending).
uniquebooleanOnly return one leaderboard of each id.
Returns:
Type: 
Promise.<Array>

(static) infoByHash(mapHash, difficulty, gameMode) → {Promise}

Gets leaderboard info based on map hash

Parameters:
NameTypeDescription
mapHashstring

Map hash

difficultynumber

(1 = Easy, 3 = Normal, 5 = Hard, 7 = Expert, 9 = Expert+)

gameModenumber

SoloStandard by default. Only supported mode by ScoreSaber

Returns:

Information on queried leaderboard

Type: 
Promise

(static) infoById(leaderboardId) → {Promise}

Gets leaderboard information based on leaderboard id

Parameters:
NameTypeDescription
leaderboardIdnumber

Leaderboard ID

Returns:

Information on queried leaderboard

Type: 
Promise

(static) scoresByHash(mapHash, difficulty, countries, search, page, gameMode, withMetadata) → {Promise.<Array>}

Gets a list of scores for a given hash

Parameters:
NameTypeDescription
mapHashstring

Map hash

difficultynumber

(1 = Easy, 3 = Normal, 5 = Hard, 7 = Expert, 9 = Expert+)

countriesArray

Filter by ISO 3166-1 alpha-2 code

searchstring

Query for specific terms

pagenumber

Page of result

gameModenumber

SoloStandard by default. Only supported mode by ScoreSaber

withMetadataboolean

True by default. Returns total number of results, page number, and items per page

Returns:

Scores on queried leaderboard

Type: 
Promise.<Array>

(static) scoresById(leaderboardId, countries, search, page, withMetadata) → {Promise.<Array>}

Gets a list of scores for a given map

Parameters:
NameTypeDescription
leaderboardIdnumber

Leaderboard ID

countriesArray

Filter by ISO 3166-1 alpha-2 code

searchstring

Query for specific terms

pagenumber

Page of result

withMetadataboolean

True by default. Returns total number of results, page number, and items per page

Returns:

Scores on queried leaderboard

Type: 
Promise.<Array>
\ No newline at end of file +
On this page

ScoreSaber. Leaderboard

Allows interaction with the ScoreSaber Leaderboard API endpoints

Methods

(static) difficultiesByHash(mapHash) → {Promise.<Array>}

Gets a maps difficulties based on hash

Parameters:
NameTypeDescription
mapHashstring

Map hash

Returns:

Difficulties offered on by a map

Type: 
Promise.<Array>

(static) get(query, page, options) → {Promise.<Array>}

Gets a list of leaderboards based on filters

Parameters:
NameTypeDescription
querystring

Query for specific terms

pagenumber

Page of result

optionsobject

More Filters

PropertyTypeDescription
verifiedbooleanFilter by verified (️deprecation notice)
rankedbooleanIndicates if only ranked songs should be included.
qualifiedbooleanIndicates if only qualified songs should be included.
lovedbooleanIndicates if only loved songs should be included.
minStarnumberThe minimum star rating of songs to include.
maxStarnumberThe maximum star rating of songs to include.
category0 | 1 | 2 | 3 | 4Which category to sort by (0 = trending, date ranked = 1,
scores set = 2, star difficulty = 3, author = 4)
sort0 | 1The sorting order: 0 (Descending) or 1 (Ascending).
uniquebooleanOnly return one leaderboard of each id.
Returns:
Type: 
Promise.<Array>

(static) infoByHash(mapHash, difficulty, gameMode) → {Promise}

Gets leaderboard info based on map hash

Parameters:
NameTypeDescription
mapHashstring

Map hash

difficultynumber

(1 = Easy, 3 = Normal, 5 = Hard, 7 = Expert, 9 = Expert+)

gameModenumber

SoloStandard by default. Only supported mode by ScoreSaber

Returns:

Information on queried leaderboard

Type: 
Promise

(static) infoById(leaderboardId) → {Promise}

Gets leaderboard information based on leaderboard id

Parameters:
NameTypeDescription
leaderboardIdnumber

Leaderboard ID

Returns:

Information on queried leaderboard

Type: 
Promise

(static) scoresByHash(mapHash, difficulty, countries, search, page, gameMode, withMetadata) → {Promise.<Array>}

Gets a list of scores for a given hash

Parameters:
NameTypeDescription
mapHashstring

Map hash

difficultynumber

(1 = Easy, 3 = Normal, 5 = Hard, 7 = Expert, 9 = Expert+)

countriesArray

Filter by ISO 3166-1 alpha-2 code

searchstring

Query for specific terms

pagenumber

Page of result

gameModenumber

SoloStandard by default. Only supported mode by ScoreSaber

withMetadataboolean

True by default. Returns total number of results, page number, and items per page

Returns:

Scores on queried leaderboard

Type: 
Promise.<Array>

(static) scoresById(leaderboardId, countries, search, page, withMetadata) → {Promise.<Array>}

Gets a list of scores for a given map

Parameters:
NameTypeDescription
leaderboardIdnumber

Leaderboard ID

countriesArray

Filter by ISO 3166-1 alpha-2 code

searchstring

Query for specific terms

pagenumber

Page of result

withMetadataboolean

True by default. Returns total number of results, page number, and items per page

Returns:

Scores on queried leaderboard

Type: 
Promise.<Array>
\ No newline at end of file diff --git a/docs/ScoreSaber.Players.html b/docs/ScoreSaber.Players.html index 9947236..16db3bd 100644 --- a/docs/ScoreSaber.Players.html +++ b/docs/ScoreSaber.Players.html @@ -1,3 +1,3 @@ Namespace: Players
On this page

ScoreSaber. Players

Allows interaction with the ScoreSaber Player API endpoints

Methods

(static) basicInfoById(playerId) → {Promise.<Array>}

Returns basic player info

Parameters:
NameTypeDescription
playerIdstring

Player ID

Returns:

Returns a Promise with basic info on a player

Type: 
Promise.<Array>

(static) count(search, countries) → {Promise.<Array>}

Returns an integer value of the number of players based on filters

Parameters:
NameTypeDescription
searchstring

Query for specific terms

countriesArray

Filter by ISO 3166-1 alpha-2 code

Returns:

Returns a Promise with a integer of the number of players found matching filtered results

Type: 
Promise.<Array>

(static) fullInfoById(playerId) → {Promise.<Array>}

Returns full player info

Parameters:
NameTypeDescription
playerIdstring

Player ID

Returns:

Returns a Promise with full info on a player

Type: 
Promise.<Array>

(static) get(search, page, countries, withMetadata) → {Promise.<Array>}

Gets a list of players based on filters

Parameters:
NameTypeDescription
searchstring

Query for specific terms

pagenumber

Page of result

countriesArray

Filter by ISO 3166-1 alpha-2 code

withMetadataboolean

True by default. Returns total number of results, page number, and items per page

Returns:

Returns a Promise with a list of players based on filters

Type: 
Promise.<Array>

(static) scoresById(playerId, limit, sort) → {Promise.<Array>}

Returns a list of a players scores

Parameters:
NameTypeDescription
playerIdstring

Player ID

limitnumber

Maximum number of results to be returned

sortstring

The sort order. Valid values are "top" and "recent".

Returns:

Returns a Promise with full info on a player

Type: 
Promise.<Array>
\ No newline at end of file +
On this page

ScoreSaber. Players

Allows interaction with the ScoreSaber Player API endpoints

Methods

(static) basicInfoById(playerId) → {Promise.<Array>}

Returns basic player info

Parameters:
NameTypeDescription
playerIdstring

Player ID

Returns:

Returns a Promise with basic info on a player

Type: 
Promise.<Array>

(static) count(search, countries) → {Promise.<Array>}

Returns an integer value of the number of players based on filters

Parameters:
NameTypeDescription
searchstring

Query for specific terms

countriesArray

Filter by ISO 3166-1 alpha-2 code

Returns:

Returns a Promise with a integer of the number of players found matching filtered results

Type: 
Promise.<Array>

(static) fullInfoById(playerId) → {Promise.<Array>}

Returns full player info

Parameters:
NameTypeDescription
playerIdstring

Player ID

Returns:

Returns a Promise with full info on a player

Type: 
Promise.<Array>

(static) get(search, page, countries, withMetadata) → {Promise.<Array>}

Gets a list of players based on filters

Parameters:
NameTypeDescription
searchstring

Query for specific terms

pagenumber

Page of result

countriesArray

Filter by ISO 3166-1 alpha-2 code

withMetadataboolean

True by default. Returns total number of results, page number, and items per page

Returns:

Returns a Promise with a list of players based on filters

Type: 
Promise.<Array>

(static) scoresById(playerId, limit, sort) → {Promise.<Array>}

Returns a list of a players scores

Parameters:
NameTypeDescription
playerIdstring

Player ID

limitnumber

Maximum number of results to be returned

sortstring

The sort order. Valid values are "top" and "recent".

Returns:

Returns a Promise with full info on a player

Type: 
Promise.<Array>
\ No newline at end of file diff --git a/docs/ScoreSaber.Ranking.Public.html b/docs/ScoreSaber.Ranking.Public.html index 97ec6cf..32ba2ad 100644 --- a/docs/ScoreSaber.Ranking.Public.html +++ b/docs/ScoreSaber.Ranking.Public.html @@ -1,3 +1,3 @@ Namespace: Public
On this page

ScoreSaber.Ranking. Public

Allows interaction with the publically available ScoreSaber Ranking API endpoints (not ranking team related functions)

Methods

(static) belowTop() → {Promise.<Array>}

Gets the rest of the rank requests

Returns:

Returns a Promise with the rest of the rank requests

Type: 
Promise.<Array>

(static) getRequestInfoByLeaderboardId(leaderboardId) → {Promise.<Array>}

Gets rank request info based on a Leaderboard ID

Parameters:
NameTypeDescription
leaderboardIdnumber

Leaderboard ID of map

Returns:

Returns a Promise with the rank request information

Type: 
Promise.<Array>

(static) getRequestInfoByRequestId(requestId) → {Promise.<Array>}

Gets rank request info based on request ID

Parameters:
NameTypeDescription
requestIdnumber

Rank request ID

Returns:

Returns a Promise with the rank request information

Type: 
Promise.<Array>

(static) top() → {Promise.<Array>}

Gets the top 6 rank requests

Returns:

Returns a Promise with the top 6 rank requests

Type: 
Promise.<Array>
\ No newline at end of file +
On this page

ScoreSaber.Ranking. Public

Allows interaction with the publically available ScoreSaber Ranking API endpoints (not ranking team related functions)

Methods

(static) belowTop() → {Promise.<Array>}

Gets the rest of the rank requests

Returns:

Returns a Promise with the rest of the rank requests

Type: 
Promise.<Array>

(static) getRequestInfoByLeaderboardId(leaderboardId) → {Promise.<Array>}

Gets rank request info based on a Leaderboard ID

Parameters:
NameTypeDescription
leaderboardIdnumber

Leaderboard ID of map

Returns:

Returns a Promise with the rank request information

Type: 
Promise.<Array>

(static) getRequestInfoByRequestId(requestId) → {Promise.<Array>}

Gets rank request info based on request ID

Parameters:
NameTypeDescription
requestIdnumber

Rank request ID

Returns:

Returns a Promise with the rank request information

Type: 
Promise.<Array>

(static) top() → {Promise.<Array>}

Gets the top 6 rank requests

Returns:

Returns a Promise with the top 6 rank requests

Type: 
Promise.<Array>
\ No newline at end of file diff --git a/docs/ScoreSaber.Ranking.html b/docs/ScoreSaber.Ranking.html index 962678f..fb86250 100644 --- a/docs/ScoreSaber.Ranking.html +++ b/docs/ScoreSaber.Ranking.html @@ -1,3 +1,3 @@ Namespace: Ranking
On this page

ScoreSaber. Ranking

\ No newline at end of file +
On this page

ScoreSaber. Ranking

\ No newline at end of file diff --git a/docs/ScoreSaber.html b/docs/ScoreSaber.html index 8983586..5e89f6c 100644 --- a/docs/ScoreSaber.html +++ b/docs/ScoreSaber.html @@ -1,3 +1,3 @@ Namespace: ScoreSaber
On this page

ScoreSaber

Interact with the ScoreSaber API using this NPM wrapper library. Currently supports all ScoreSaber endpoints except for authenticated routes to include: Website User, Website Auth, and Ranking Team, QAT, and NAT routes.

Namespaces

Leaderboard
Players
Ranking
\ No newline at end of file +
On this page

ScoreSaber

Interact with the ScoreSaber API using this NPM wrapper library. Currently supports all ScoreSaber endpoints except for authenticated routes to include: Website User, Website Auth, and Ranking Team, QAT, and NAT routes.

Namespaces

Leaderboard
Players
Ranking
\ No newline at end of file diff --git a/docs/Scoresaber_leaderboard.js.html b/docs/Scoresaber_leaderboard.js.html index b621fe1..e6bdd52 100644 --- a/docs/Scoresaber_leaderboard.js.html +++ b/docs/Scoresaber_leaderboard.js.html @@ -1,6 +1,6 @@ Source: Scoresaber/leaderboard.js
On this page

Scoresaber_leaderboard.js

let {scoresaber} = require('../api_urls.json').urls
+    
On this page

Scoresaber_leaderboard.js

let {scoresaber} = require('../api_urls.json').urls
 
 /**
  * Allows interaction with the ScoreSaber Leaderboard API endpoints
@@ -149,4 +149,4 @@
     scoresById: scoresById,
     scoresByHash: scoresByHash,
     difficultiesByHash: difficultiesByHash
-}
\ No newline at end of file +}
\ No newline at end of file diff --git a/docs/Scoresaber_player.js.html b/docs/Scoresaber_player.js.html index ffeff72..40971d2 100644 --- a/docs/Scoresaber_player.js.html +++ b/docs/Scoresaber_player.js.html @@ -1,6 +1,6 @@ Source: Scoresaber/player.js
On this page

Scoresaber_player.js

let {scoresaber} = require('../api_urls.json').urls
+    
On this page

Scoresaber_player.js

let {scoresaber} = require('../api_urls.json').urls
 
 /**
  * Allows interaction with the ScoreSaber Player API endpoints
@@ -108,4 +108,4 @@
     basicInfoById: basicInfoById,
     fullInfoById: fullInfoById,
     scoresById: scoresById
-}
\ No newline at end of file +}
\ No newline at end of file diff --git a/docs/Scoresaber_ranking.js.html b/docs/Scoresaber_ranking.js.html index 36895a7..decaa2a 100644 --- a/docs/Scoresaber_ranking.js.html +++ b/docs/Scoresaber_ranking.js.html @@ -1,6 +1,6 @@ Source: Scoresaber/ranking.js
On this page

Scoresaber_ranking.js

const {scoresaber} = require('../api_urls.json').urls
+    
On this page

Scoresaber_ranking.js

const {scoresaber} = require('../api_urls.json').urls
 /**
  * Allows interaction with the publically available ScoreSaber Ranking API endpoints (not ranking team related functions)
  * @namespace Ranking.Public
@@ -74,4 +74,4 @@
     belowTop: belowTop,
     getRequestInfoByRequestId: getRequestInfoByRequestId,
     getRequestInfoByLeaderboardId: getRequestInfoByLeaderboardId
-}
\ No newline at end of file +}
\ No newline at end of file diff --git a/docs/data/search.json b/docs/data/search.json index 1cfe2e3..fd67564 100644 --- a/docs/data/search.json +++ b/docs/data/search.json @@ -1 +1 @@ -{"list":[{"title":"BeatLeader","link":"BeatLeader","description":"

Interact with the BeatLeader API using this NPM wrapper library. Currently supports all BeatLeader endpoints found under BeatLeaderAPI v1.

"},{"title":"BeatLeader.Clans","link":"Clans","description":"

Interact with the BeatLeader Clan API endpoints

"},{"title":"BeatLeader.Clans.get","link":"get","description":"

Retrieves a list of clans based on filters

"},{"title":"BeatLeader.Clans.getById","link":"getById","description":"

Fetches details of a specific clan identified by its ID.

"},{"title":"BeatLeader.Clans.getByTag","link":"getByTag","description":"

Retrieves details of a specific clan by tag

"},{"title":"BeatLeader.Clans.getGlobalMap","link":"getGlobalMap","description":"

Fetches a global map showing clan captured maps and rankings.

"},{"title":"BeatLeader.Clans.getMapsById","link":"getMapsById","description":"

Fetches ranked maps(maps that can be captured on the global map) for where players of clan made scores identified by its ID, with optional sorting and filtering.

"},{"title":"BeatLeader.Clans.getMapsByTag","link":"getMapsByTag","description":"

Retrieves a list of clans based on filters

"},{"title":"BeatLeader.Leaderboards","link":"Leaderboards","description":"

Interact with the BeatLeader Leaderboard API endpoints

"},{"title":"BeatLeader.Leaderboards.get","link":"get","description":"

Retrieves a list of leaderboards

"},{"title":"BeatLeader.Leaderboards.getById","link":"getById","description":"

Retrieves a list of leaderboards

"},{"title":"BeatLeader.Leaderboards.getClanRankingsById","link":"getClanRankingsById","description":"

Retrieves clan rankings for a leaderboard

"},{"title":"BeatLeader.Leaderboards.getScoregraphById","link":"getScoregraphById","description":"

Retrieves the score graph for a leaderboard

"},{"title":"BeatLeader.Modifiers","link":"Modifiers","description":"

Interact with BeatLeader Modifiers API endpoints

"},{"title":"BeatLeader.Modifiers.get","link":"get","description":"

Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy support, for the recent values please use modifierValues and modifierRatings on leaderboards.

"},{"title":"ScoreSaber","link":"ScoreSaber","description":"

Interact with the ScoreSaber API using this NPM wrapper library. Currently supports all ScoreSaber endpoints except for authenticated\nroutes to include: Website User, Website Auth, and Ranking Team, QAT, and NAT routes.

"},{"title":"ScoreSaber.Leaderboard","link":"Leaderboard","description":"

Allows interaction with the ScoreSaber Leaderboard API endpoints

"},{"title":"ScoreSaber.Leaderboard.difficultiesByHash","link":"difficultiesByHash","description":"

Gets a maps difficulties based on hash

"},{"title":"ScoreSaber.Leaderboard.get","link":"get","description":"

Gets a list of leaderboards based on filters

"},{"title":"ScoreSaber.Leaderboard.infoByHash","link":"infoByHash","description":"

Gets leaderboard info based on map hash

"},{"title":"ScoreSaber.Leaderboard.infoById","link":"infoById","description":"

Gets leaderboard information based on leaderboard id

"},{"title":"ScoreSaber.Leaderboard.scoresByHash","link":"scoresByHash","description":"

Gets a list of scores for a given hash

"},{"title":"ScoreSaber.Leaderboard.scoresById","link":"scoresById","description":"

Gets a list of scores for a given map

"},{"title":"ScoreSaber.Players","link":"Players","description":"

Allows interaction with the ScoreSaber Player API endpoints

"},{"title":"ScoreSaber.Players.basicInfoById","link":"basicInfoById","description":"

Returns basic player info

"},{"title":"ScoreSaber.Players.count","link":"count","description":"

Returns an integer value of the number of players based on filters

"},{"title":"ScoreSaber.Players.fullInfoById","link":"fullInfoById","description":"

Returns full player info

"},{"title":"ScoreSaber.Players.get","link":"get","description":"

Gets a list of players based on filters

"},{"title":"ScoreSaber.Players.scoresById","link":"scoresById","description":"

Returns a list of a players scores

"},{"title":"ScoreSaber.Ranking","link":"Ranking","description":"

Allows interaction with the ScoreSaber Ranking API endpoints

"},{"title":"ScoreSaber.Ranking.Public","link":"Public","description":"

Allows interaction with the publically available ScoreSaber Ranking API endpoints (not ranking team related functions)

"},{"title":"ScoreSaber.Ranking.Public.belowTop","link":"belowTop","description":"

Gets the rest of the rank requests

"},{"title":"ScoreSaber.Ranking.Public.getRequestInfoByLeaderboardId","link":"getRequestInfoByLeaderboardId","description":"

Gets rank request info based on a Leaderboard ID

"},{"title":"ScoreSaber.Ranking.Public.getRequestInfoByRequestId","link":"getRequestInfoByRequestId","description":"

Gets rank request info based on request ID

"},{"title":"ScoreSaber.Ranking.Public.top","link":"top","description":"

Gets the top 6 rank requests

"}]} \ No newline at end of file +{"list":[{"title":"BeatLeader","link":"BeatLeader","description":"

Interact with the BeatLeader API using this NPM wrapper library. Currently supports all BeatLeader endpoints found under BeatLeaderAPI v1.

"},{"title":"BeatLeader.Clans","link":"Clans","description":"

Interact with the BeatLeader Clan API endpoints

"},{"title":"BeatLeader.Clans.get","link":"get","description":"

Retrieves a list of clans based on filters

"},{"title":"BeatLeader.Clans.getById","link":"getById","description":"

Fetches details of a specific clan identified by its ID.

"},{"title":"BeatLeader.Clans.getByTag","link":"getByTag","description":"

Retrieves details of a specific clan by tag

"},{"title":"BeatLeader.Clans.getGlobalMap","link":"getGlobalMap","description":"

Fetches a global map showing clan captured maps and rankings.

"},{"title":"BeatLeader.Clans.getMapsById","link":"getMapsById","description":"

Fetches ranked maps(maps that can be captured on the global map) for where players of clan made scores identified by its ID, with optional sorting and filtering.

"},{"title":"BeatLeader.Clans.getMapsByTag","link":"getMapsByTag","description":"

Retrieves a list of clans based on filters

"},{"title":"BeatLeader.Leaderboards","link":"Leaderboards","description":"

Interact with the BeatLeader Leaderboard API endpoints

"},{"title":"BeatLeader.Leaderboards.get","link":"get","description":"

Retrieves a list of leaderboards

"},{"title":"BeatLeader.Leaderboards.getById","link":"getById","description":"

Retrieves a list of leaderboards

"},{"title":"BeatLeader.Leaderboards.getClanRankingsById","link":"getClanRankingsById","description":"

Retrieves clan rankings for a leaderboard

"},{"title":"BeatLeader.Leaderboards.getScoregraphById","link":"getScoregraphById","description":"

Retrieves the score graph for a leaderboard

"},{"title":"BeatLeader.Modifiers","link":"Modifiers","description":"

Interact with BeatLeader Modifiers API endpoints

"},{"title":"BeatLeader.Modifiers.get","link":"get","description":"

Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy support, for the recent values please use modifierValues and modifierRatings on leaderboards.

"},{"title":"BeatLeader.Players","link":"Players","description":"

Interact with the BeatLeader Players API endpoints

"},{"title":"BeatLeader.Players.Player","link":"Player","description":"

Interact with the BeatLeader Player API endpoints

"},{"title":"BeatLeader.Players.Player.getByBeatSaverId","link":"getByBeatSaverId","description":"

Get profile data for a specific user based on their BeatSaver ID

"},{"title":"BeatLeader.Players.Player.getByDiscordId","link":"getByDiscordId","description":"

Get profile data for a specific user based on their Discord ID

"},{"title":"BeatLeader.Players.Player.getByPatreonId","link":"getByPatreonId","description":"

Get profile data for a specific user based on their Patreon ID

"},{"title":"BeatLeader.Players.Player.getFollowerInfoById","link":"getFollowerInfoById","description":"

Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most followed players this player follows

"},{"title":"BeatLeader.Players.Player.getFollowersById","link":"getFollowersById","description":"

Retrieves a full list of player' followers and players this player follow.

"},{"title":"BeatLeader.Players.Player.getFoundedClanById","link":"getFoundedClanById","description":"

Retrieves an information about the clan this player created and manage.

"},{"title":"BeatLeader.Players.Player.getParticipatedEventsById","link":"getParticipatedEventsById","description":"

Get events a user has participated in based on their ID

"},{"title":"BeatLeader.Players.Player.getRankedMapsById","link":"getRankedMapsById","description":"

Returns brief stats about maps this player ranked, like count, total PP gained, etc...

"},{"title":"BeatLeader.Players.get","link":"get","description":"

Retrieves a list of players based on filters

"},{"title":"ScoreSaber","link":"ScoreSaber","description":"

Interact with the ScoreSaber API using this NPM wrapper library. Currently supports all ScoreSaber endpoints except for authenticated\nroutes to include: Website User, Website Auth, and Ranking Team, QAT, and NAT routes.

"},{"title":"ScoreSaber.Leaderboard","link":"Leaderboard","description":"

Allows interaction with the ScoreSaber Leaderboard API endpoints

"},{"title":"ScoreSaber.Leaderboard.difficultiesByHash","link":"difficultiesByHash","description":"

Gets a maps difficulties based on hash

"},{"title":"ScoreSaber.Leaderboard.get","link":"get","description":"

Gets a list of leaderboards based on filters

"},{"title":"ScoreSaber.Leaderboard.infoByHash","link":"infoByHash","description":"

Gets leaderboard info based on map hash

"},{"title":"ScoreSaber.Leaderboard.infoById","link":"infoById","description":"

Gets leaderboard information based on leaderboard id

"},{"title":"ScoreSaber.Leaderboard.scoresByHash","link":"scoresByHash","description":"

Gets a list of scores for a given hash

"},{"title":"ScoreSaber.Leaderboard.scoresById","link":"scoresById","description":"

Gets a list of scores for a given map

"},{"title":"ScoreSaber.Players","link":"Players","description":"

Allows interaction with the ScoreSaber Player API endpoints

"},{"title":"ScoreSaber.Players.basicInfoById","link":"basicInfoById","description":"

Returns basic player info

"},{"title":"ScoreSaber.Players.count","link":"count","description":"

Returns an integer value of the number of players based on filters

"},{"title":"ScoreSaber.Players.fullInfoById","link":"fullInfoById","description":"

Returns full player info

"},{"title":"ScoreSaber.Players.get","link":"get","description":"

Gets a list of players based on filters

"},{"title":"ScoreSaber.Players.scoresById","link":"scoresById","description":"

Returns a list of a players scores

"},{"title":"ScoreSaber.Ranking","link":"Ranking","description":"

Allows interaction with the ScoreSaber Ranking API endpoints

"},{"title":"ScoreSaber.Ranking.Public","link":"Public","description":"

Allows interaction with the publically available ScoreSaber Ranking API endpoints (not ranking team related functions)

"},{"title":"ScoreSaber.Ranking.Public.belowTop","link":"belowTop","description":"

Gets the rest of the rank requests

"},{"title":"ScoreSaber.Ranking.Public.getRequestInfoByLeaderboardId","link":"getRequestInfoByLeaderboardId","description":"

Gets rank request info based on a Leaderboard ID

"},{"title":"ScoreSaber.Ranking.Public.getRequestInfoByRequestId","link":"getRequestInfoByRequestId","description":"

Gets rank request info based on request ID

"},{"title":"ScoreSaber.Ranking.Public.top","link":"top","description":"

Gets the top 6 rank requests

"},{"title":"get","link":"get","description":"

Get profile data for a specific user based on their ID

"}]} \ No newline at end of file diff --git a/docs/global.html b/docs/global.html new file mode 100644 index 0000000..bf16751 --- /dev/null +++ b/docs/global.html @@ -0,0 +1,3 @@ +Global
On this page

Methods

get(id, stats, keepOriginalId) → {Promise}

Get profile data for a specific user based on their ID

Parameters:
NameTypeDescription
idstring

ID of user to get data for

statsboolean

Include stats in the response. Default is true

keepOriginalIdboolean

Whether to keep original ID (for migrated players). Default is false

leaderboardContext.string

Leaderboard context, 'general' by default. Available values : none, general, noMods, noPause, golf, sCPM, speedrun, speedrunBackup

Returns:

Returns a promise with profile data on a specific user

Type: 
Promise
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 4d5d98d..1a11f0d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,6 +1,6 @@ Home
On this page

BeatSaberAPI-Node

Currently in development. BeatSaberAPI-Node is a Open Source Library that allows for easy interaction with different BeatSaber API's through a well documented Node.JS library.

Supported API's

  • ScoreSaber

Planned Support

  • BeatLeader
  • AccSaber
  • Challenge Saber

Installing

Run the following command

npm install beatsaberapi-node
+    
On this page

BeatSaberAPI-Node

Currently in development. BeatSaberAPI-Node is a Open Source Library that allows for easy interaction with different BeatSaber API's through a well documented Node.JS library.

Supported API's

  • ScoreSaber

Planned Support

  • BeatLeader
  • AccSaber
  • Challenge Saber

Installing

Run the following command

npm install beatsaberapi-node
 

After installing, besure to install dependencies

npm install
 

Implementing in your code

const BeatSaberNode = require('beatsaberapi-node');
 
@@ -11,4 +11,4 @@
     console.log(data)
 })
 

Documentation

You can build the documentation yourself by running the following command or visit the docs

npm run docs
-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/index.js.html b/docs/index.js.html index 0ed0285..e563140 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -1,6 +1,6 @@ Source: index.js
On this page

index.js

// scoresaber
+    
On this page

index.js

// scoresaber
 const {ScoreSaberLeaderboard} = require('./Scoresaber/leaderboard')
 const {ScoreSaberPlayers} = require('./Scoresaber/player')
 const {ScoreSaberRankingPublic} = require('./Scoresaber/ranking')
@@ -43,4 +43,4 @@
         Player: BeatLeaderPlayer,
         Scores: BeatLeaderPlayerScores,
     },
-}
\ No newline at end of file +}
\ No newline at end of file diff --git a/package.json b/package.json index f10b988..d01a6c9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "typescript": "^5.4.5" }, "name": "beatsaberapi-node", - "version": "0.1.3", + "version": "0.1.4", "main": "./src/index.js", "types": "./src/index.d.ts", "scripts": { diff --git a/src/BeatLeader/Clan.js b/src/BeatLeader/Clan.js index f4ead00..37bb501 100644 --- a/src/BeatLeader/Clan.js +++ b/src/BeatLeader/Clan.js @@ -16,8 +16,8 @@ const {parseSearchOptions} = require('./utility/parseSearchOptions') * |-----------|-------------|----------------------- |---------------| * | page | number | (Optional) Page number. | | * | count | number | (Optional) Number of items per page | | - * | sortBy | ClanSortBy | (Optional) Sorting criteria | name, pp, acc, rank, count, captures | - * | order | Order | (Optional) Sorting order | desc, asc | + * | sortBy | ClanSortBy | (Optional) Sorting criteria | `"name"`, `"pp"`, `"acc"`, `"rank"`, `"count"`, `"captures"` | + * | order | Order | (Optional) Sorting order | `"desc"`, `"asc"` | * | search | string | (Optional) Search query | | * @returns {Promise} A promise with a list of clans */ @@ -50,8 +50,8 @@ async function get(searchOptions = {}) { * |-----------|-------------|-------------------------------------|---------------| * | page | number | (Optional) Page number | | * | count | number | (Optional) Number of items per page | | - * | sortBy | ClanSortBy | (Optional) Sorting criteria | pp, topPp, name, rank, acc, weightedAcc, top1Count, top1Score, weightedRank, topAcc, hmd, playCount, score, lastplay, maxStreak, replaysWatched, dailyImprovements, timing | - * | order | Order | (Optional) Sorting order | desc, asc | + * | sortBy | ClanSortBy | (Optional) Sorting criteria | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` | + * | order | Order | (Optional) Sorting order | `"desc"`, `"asc"` | * | search | string | (Optional) Search query | | * @param {boolean} primary Whether to include only players for whom this clan is primary, default is false * @returns {Promise} A promise with a clan @@ -85,8 +85,8 @@ async function getByTag(tag, searchOptions = {}, primary = false) { * |-----------|-------------|-------------------------------------|---------------| * | page | number | (Optional) Page number | | * | count | number | (Optional) Number of items per page | | - * | sortBy | ClanSortBy | (Optional) Sorting criteria | pp, topPp, name, rank, acc, weightedAcc, top1Count, top1Score, weightedRank, topAcc, hmd, playCount, score, lastplay, maxStreak, replaysWatched, dailyImprovements, timing | - * | order | Order | (Optional) Sorting order | desc, asc | + * | sortBy | ClanSortBy | (Optional) Sorting criteria | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` | + * | order | Order | (Optional) Sorting order | `"desc"`, `"asc"` | * @param {boolean} primary Whether to include only players for whom this clan is primary, default is false * @returns {Promise} A promise with a clan */ @@ -119,9 +119,9 @@ async function getById(id, searchOptions = {}, primary = false) { * |--------------------|--------------------|------------------------------------- |---------------| * | page | number | (Optional) Page number | | * | count | number | (Optional) Number of items per page | | - * | sortBy | ClanSortBy | (Optional) Sorting criteria | pp, acc, rank, date, tohold, toconquer | - * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| none, general, noMods, noPause, golf, sCPM, speedrun, speedrunBackup | - * | order | Order | (Optional) Sorting order | desc, asc | + * | sortBy | ClanSortBy | (Optional) Sorting criteria | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` | + * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` | + * | order | Order | (Optional) Sorting order | `"desc"`, `"asc"` | * @returns {Promise} A promise with a list of ranked maps */ async function getMapsByTag(tag, searchOptions = {}) { @@ -152,9 +152,9 @@ async function getMapsByTag(tag, searchOptions = {}) { * |--------------------|--------------------|------------------------------------- |---------------| * | page | number | (Optional) Page number | | * | count | number | (Optional) Number of items per page | | - * | sortBy | ClanSortBy | (Optional) Sorting criteria | pp, acc, rank, date, tohold, toconquer | - * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| none, general, noMods, noPause, golf, sCPM, speedrun, speedrunBackup | - * | order | Order | (Optional) Sorting order | desc, asc | + * | sortBy | ClanSortBy | (Optional) Sorting criteria | `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` | + * | leaderboardContext | LeaderboardContext | (Optional) Context of leaderboard. Default is General| `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` | + * | order | Order | (Optional) Sorting order | `"desc"`, `"asc"` | * @returns {Promise} A promise with a list of ranked maps */ async function getMapsById(id, searchOptions = {}) { diff --git a/src/BeatLeader/Leaderboard.js b/src/BeatLeader/Leaderboard.js index 8b658bd..c6cbe0f 100644 --- a/src/BeatLeader/Leaderboard.js +++ b/src/BeatLeader/Leaderboard.js @@ -16,19 +16,19 @@ const {parseSearchOptions} = require('./utility/parseSearchOptions') * |---------------------|-------------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------| * | page | number | (Optional) Page number | N/A | * | count | number | (Optional) Number of items per page | N/A | - * | sortBy | LeaderboardSortBy | (Optional) Sorting criteria | 0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp" | - * | order | Order | Sorting order | "asc", "desc" | + * | sortBy | LeaderboardSortBy | (Optional) Sorting criteria | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `"date"`, `"pp"`, `"acc"`, `"pauses"`, `"rank"`, `"maxStreak"`, `"mistakes"`, `"weight"`, `"weightedPp"` | + * | order | Order | Sorting order | `"asc"`, `"desc"` | * | search | string | (Optional) Search query | N/A | * | type | Type | (Optional) Type of item | N/A | * | mode | string | (Optional) Mode of item | N/A | - * | difficulty | Difficulties | (Optional) Difficulty level | "Standard", "OneSaber", "90Degree", "360Degree" | - * | mapType | MapsType | (Optional) Map type | 0, 1, 2, "ranked", "unranked", "all" | - * | allTypes | Operation | (Optional) Operation for all types | 0, 1, 2, "any", "all", "not" | - * | mapRequirements | RequirementsString | (Optional) Map requirements | "none", "chroma", "noodles", "mappingExtensions", "cinema", "v3", "optionalProperties", "ignore" | - * | allRequirements | Operation | (Optional) Operation for all requirements | 0, 1, 2, "any", "all", "not" | - * | songStatus | SongStatus | (Optional) Status of the song | 0, 2, 4, 8, 16, 32, "none", "curated", "mapOfTheWeek", "noodleMonday", "featuredOnCC", "beastSaberAwarded" | - * | leaderboardContext | LeaderboardContexts | (Optional) Context of the leaderboard | 0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup" | - * | mytype | MyType | (Optional) Custom type | 0, 1, 2, 3, 4, 5, 6, "none", "played", "unplayed", "myNominated", "othersNominated", "myMaps" | + * | difficulty | Difficulties | (Optional) Difficulty level |`"Standard"`, `"OneSaber"`, `"90Degree"`, `"360Degree"` | + * | mapType | MapsType | (Optional) Map type | `0`, `1`, `2`, `"ranked"`, `"unranked"`, `"all"` | + * | allTypes | Operation | (Optional) Operation for all types | `0`, `1`, `2`, `"any"`, `"all"`, `"not"` | + * | mapRequirements | RequirementsString | (Optional) Map requirements | `"none"`, `"chroma"`, `"noodles"`, `"mappingExtensions"`, `"cinema"`, `"v3"`, `"optionalProperties"`, `"ignore"` | + * | allRequirements | Operation | (Optional) Operation for all requirements | `0`, `1`, `2`, `"any"`, `"all"`, `"not"` | + * | songStatus | SongStatus | (Optional) Status of the song | `0`, `2`, `4`, `8`, `16`, `32`, `"none"`, `"curated"`, `"mapOfTheWeek"`, `"noodleMonday"`, `"featuredOnCC"`, `"beastSaberAwarded"` | + * | leaderboardContext | LeaderboardContexts | (Optional) Context of the leaderboard | `0`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` | + * | mytype | MyType | (Optional) Custom type | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `"none"`, `"played"`, `"unplayed"`, `"myNominated"`, `"othersNominated"`, `"myMaps"` | * | stars_from | number | (Optional) Minimum stars | N/A | * | stars_to | number | (Optional) Maximum stars | N/A | * | accrating_from | number | (Optional) Minimum accuracy rating | N/A | @@ -69,10 +69,10 @@ async function get(leaderboardSearchOptions = {}) { * |---------------------|-------------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------| * | page | number | (Optional) Page number | N/A | * | count | number | (Optional) Number of items per page | N/A | - * | sortBy | LeaderboardSortBy | (Optional) Sorting criteria | 0, 1, 2, 3, 4, 5, 6, 7, 8, "date", "pp", "acc", "pauses", "rank", "maxStreak", "mistakes", "weight", "weightedPp" | - * | order | Order | Sorting order | "asc", "desc" | - * | scoreStatus | ScoreFilterStatus | (Optional) Score status filter | 0, 1, "none", "suspicious" | - * | leaderboardContext | LeaderboardContexts | (Optional) Context of the leaderboard | 0, 2, 4, 8, 16, 32, 64, 128, "none", "general", "noMods", "noPause", "golf", "sCPM", "speedrun", "speedrunBackup" | + * | sortBy | LeaderboardSortBy | (Optional) Sorting criteria | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `"date"`, `"pp"`, `"acc"`, `"pauses"`, `"rank"`, `"maxStreak"`, `"mistakes"`, `"weight"`, `"weightedPp"` | + * | order | Order | Sorting order | `"asc"`, `"desc"` | + * | scoreStatus | ScoreFilterStatus | (Optional) Score status filter | `0`, `1`, `"none"`, `"suspicious"` | + * | leaderboardContext | LeaderboardContexts | (Optional) Context of the leaderboard | `0`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` | * | countries | Array | (Optional) List of country codes | N/A | * | search | string | (Optional) Search query | N/A | * | modifiers | string | (Optional) Modifiers | N/A | diff --git a/src/BeatLeader/Modifiers.js b/src/BeatLeader/Modifiers.js index 4a45645..5a09376 100644 --- a/src/BeatLeader/Modifiers.js +++ b/src/BeatLeader/Modifiers.js @@ -15,7 +15,7 @@ const {beatleader} = require('../api_urls.json').urls async function get() { try { let route = new URL(beatleader + 'modifiers').href - let res = await fetch(route) + let res = await fetch(encodeURI(route)) if(res.status != 200) return Promise.reject(new Error("Undocumented error: " + res.status)) diff --git a/src/BeatLeader/Player.js b/src/BeatLeader/Player.js index 79f9d18..aeb7a26 100644 --- a/src/BeatLeader/Player.js +++ b/src/BeatLeader/Player.js @@ -1,3 +1,123 @@ +const {beatleader} = require('../api_urls.json').urls + +/** + * Interact with the BeatLeader Player API endpoints + * @namespace BeatLeader.Players.Player + * @memberof BeatLeader.Players + */ + +/** + * Get profile data for a specific user based on their ID + * @function get + * @param {string} id ID of user to get data for + * @param {boolean} stats Include stats in the response. Default is true + * @param {boolean} keepOriginalId Whether to keep original ID (for migrated players). Default is false + * @param {string} leaderboardContext. Leaderboard context, 'general' by default. Available values : `none`, `general`, `noMods`, `noPause`, `golf`, `sCPM`, `speedrun`, `speedrunBackup` + * @returns {Promise} Returns a promise with profile data on a specific user + */ +async function get(id, stats = true, keepOriginalId = false, leaderboardContext = "general") { + +} + +/** + * Get profile data for a specific user based on their Discord ID + * @function getByDiscordId + * @memberof BeatLeader.Players.Player + * @param {string} discordId Discord ID of user to get data for + * @returns {Promise} Returns a promise with profile data on a specific user + */ +async function getByDiscordId(discordId) { + +} + +/** + * Get profile data for a specific user based on their BeatSaver ID + * @function getByBeatSaverId + * @memberof BeatLeader.Players.Player + * @param {string} beatsaverId BeatSaver ID of user to get data for + * @returns {Promise} Returns a promise with profile data on a specific user + */ +async function getByBeatSaverId(beatsaverId) { + +} + +/** + * Get profile data for a specific user based on their Patreon ID + * @function getByPatreonId + * @memberof BeatLeader.Players.Player + * @param {string} patreonId Patreon ID of user to get data for + * @returns {Promise} Returns a promise with profile data on a specific user + */ +async function getByPatreonId(patreonId) { + +} + +/** + * Get events a user has participated in based on their ID + * @function getParticipatedEventsById + * @memberof BeatLeader.Players.Player + * @param {string} id ID of user to get data for + * @returns {Promise} Returns a promise with a list of events a user has participated in + */ +async function getParticipatedEventsById(id) { + +} + +/** + * Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most followed players this player follows + * @function getFollowerInfoById + * @memberof BeatLeader.Players.Player + * @param {string} id ID of user to get data for + * @returns {Promise} Returns a promise with follower data + */ +async function getFollowerInfoById(id) { + +} + +/** + * Retrieves a full list of player' followers and players this player follow. + * @function getFollowersById + * @memberof BeatLeader.Players.Player + * @param {string} id ID of user to get data for + * @param {number} page Page to get data from. Default is 1 + * @param {number} count Number of players to return. Default is 10 + * @param {string} relationship Relationship type: followers or following Available values : `followers`, `following` + * @returns {Promise} Returns a promise with followers + */ +async function getFollowersById(id, page = 1, count = 10) { + +} + +/** + * Retrieves an information about the clan this player created and manage. + * @function getFoundedClanById + * @memberof BeatLeader.Players.Player + * @param {string} id ID of user to get data for + * @returns {Promise} Returns a promise with info on a specific clan + */ +async function getFoundedClanById(id) { + +} + +/** + * Returns brief stats about maps this player ranked, like count, total PP gained, etc... + * @function getRankedMapsById + * @memberof BeatLeader.Players.Player + * @param {string} id ID of user to get data for + * @returns {Promise} Returns a promise with ranked map data + */ +async function getRankedMapsById(id) { + +} + exports.BeatleaderPlayer = { - + get: get, + getByDiscordId: getByDiscordId, + getByBeatSaverId: getByBeatSaverId, + getByPatreonId: getByPatreonId, + getParticipatedEventsById: getParticipatedEventsById, + getFollowerInfoById: getFollowerInfoById, + getFollowersById: getFollowersById, + getFoundedClanById: getFoundedClanById, + getRankedMapsById: getRankedMapsById } \ No newline at end of file diff --git a/src/BeatLeader/Players.js b/src/BeatLeader/Players.js index 895754d..de65712 100644 --- a/src/BeatLeader/Players.js +++ b/src/BeatLeader/Players.js @@ -1,5 +1,57 @@ -async function get() { +const { beatleader } = require('../api_urls.json').urls +const { parseSearchOptions } = require('./utility/parseSearchOptions') +/** + * Interact with the BeatLeader Players API endpoints + * @namespace BeatLeader.Players + * @memberof BeatLeader + */ + +/** + * Retrieves a list of players based on filters + * @function get + * @memberof BeatLeader.Players + * @param {object} playerSearchOptions Optional filters to help narrow search. See table below for valid parameters. + * | Parameter | Type | Description | Valid Values | + * |---------------------|-------------------------|--------------------------------------|-----------------------------------------------------------------------------------------------------| + * | sortBy | PlayerSortBy | (Optional) Sorting criteria | `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `"pp"`, `"topPp"`, `"name"`, `"rank"`, `"acc"`, `"weightedAcc"`, `"top1Count"`, `"top1Score"`, `"weightedRank"`, `"topAcc"`, `"hmd"`, `"playCount"`, `"score"`, `"lastplay"`, `"maxStreak"`, `"replaysWatched"`, `"dailyImprovements"`, `"timing"` | + * | page | number | (Optional) Page number | N/A | + * | count | number | (Optional) Number of items per page | N/A | + * | search | string | (Optional) Search query | N/A | + * | order | Order | (Optional) Sorting order | `"asc"`, `"desc"` | + * | countries | Array | (Optional) List of country codes | N/A | + * | mapsType | MapsType | (Optional) Map type | `0`, `1`, `2`, `"ranked"`, `"unranked"`, `"all"` | + * | ppType | PpType | PP type | N/A | + * | leaderboardContext | LeaderboardContexts | (Optional) Context of the leaderboard | `0`, `2`, `4`, `8`, `16`, `32`, `64`, `128`, `"none"`, `"general"`, `"noMods"`, `"noPause"`, `"golf"`, `"sCPM"`, `"speedrun"`, `"speedrunBackup"` | + * | friends | boolean | (Optional) Filter by friends | N/A | + * | pp_range | Array | (Optional) PP range | N/A | + * | score_range | Array | (Optional) Score range | N/A | + * | platform | Array | (Optional) Platform filter | N/A | + * | role | Array | (Optional) Role filter | N/A | + * | hmd | Array | (Optional) HMD filter | `0`, `1`, `2`, `4`, `8`, `16`, `32`, `33`, `34`, `35`, `36`, `37`, `38`, `39`, `40`, `41`, `42`, `43`, `44`, `45`, `46`, `47`, `48`, `49`, `50`, `51`, `52`, `53`, `54`, `55`, `56`, `57`, `58`, `59`, `60`, `61`, `62`, `63`, `64`, `65`, `66`, `67`, `68`, `69`, `128`, `256`, `512`, `"unknown"`, `"rift"`, `"vive"`, `"vivePro"`, `"wmr"`, `"riftS"`, `"quest"`, `"picoNeo3"`, `"picoNeo2"`, `"vivePro2"`, `"viveElite"`, `"miramar"`, `"pimax8k"`, `"pimax5k"`, `"pimaxArtisan"`, `"hpReverb"`, `"samsungWmr"`, `"qiyuDream"`, `"disco"`, `"lenovoExplorer"`, `"acerWmr"`, `"viveFocus"`, `"arpara"`, `"dellVisor"`, `"e3"`, `"viveDvt"`, `"glasses20"`, `"hedy"`, `"vaporeon"`, `"huaweivr"`, `"asusWmr"`, `"cloudxr"`, `"vridge"`, `"medion"`, `"picoNeo4"`, `"questPro"`, `"pimaxCrystal"`, `"e4"`, `"index"`, `"controllable"`, `"bigscreenbeyond"`, `"nolosonic"`, `"hypereal"`, `"varjoaero"`, `"viveCosmos"`, `"quest2"`, `"quest3"` | + * | clans | Array | (Optional) Clan filter | N/A | + * | activityPeriod | number | (Optional) Activity period | N/A | + * | banned | boolean | (Optional) Ban filter | N/A | + * @returns {Promise} Returns a promise with a list of players + */ +async function get(playerSearchOptions = {}) { + try { + let route = new URL(beatleader + 'players') + let parsedSearchOptions = parseSearchOptions(playerSearchOptions) + route += parsedSearchOptions + let res = await fetch(encodeURI(route)) + + if (res.status == 400) + return Promise.reject(new Error("Invalid request parameters")) + if (res.status == 404) + return Promise.reject(new Error("Players not found")) + if (res.status != 200) + return Promise.reject(new Error("Undocumented error: " + res.status)) + + return res.json() + } catch (error) { + throw new Error(error) + } } -exports.BeatLeaderGetAllPlayers = get() \ No newline at end of file +exports.BeatLeaderGetAllPlayers = get \ No newline at end of file diff --git a/src/BeatLeader/types/BeatLeader.d.ts b/src/BeatLeader/types/BeatLeader.d.ts index 7b862e5..c6c2cd3 100644 --- a/src/BeatLeader/types/BeatLeader.d.ts +++ b/src/BeatLeader/types/BeatLeader.d.ts @@ -395,7 +395,7 @@ type HMD = | 0 | 1 | 2 | 4 | 8 | 16 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | "hedy" | "vaporeon" | "huaweivr" | "asusWmr" | "cloudxr" | "vridge" | "medion" | "picoNeo4" | "questPro" | "pimaxCrystal" | "e4" | "index" | "controllable" | "bigscreenbeyond" | "nolosonic" | "hypereal" | "varjoaero" | "viveCosmos" | "quest2" -| "quest3"; ; +| "quest3" interface HistoryCompactResponse { timestamp: number, diff --git a/src/index.d.ts b/src/index.d.ts index b35a4d7..afc953d 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -7,7 +7,7 @@ import { ClanTagSearchOptions, ClanGlobalMap, ClanRankingResponseClanResponseFul import { LeaderboardByIdSearchOption, LeaderboardClanRankingResponse, LeaderboardContexts, LeaderboardInfoResponseResponseWithMetadata, LeaderboardResponse, LeaderboardSearchOptions, ScoreResponseWithMyScoreResponseWithMetadata } from './BeatLeader/types/BeatLeader'; import { LegacyModifiers } from './BeatLeader/types/BeatLeader'; import { ParticipatingEventResponse, PlayerFollowersInfoResponse, PlayerResponseWithStatsResponseWithMetadata, RankedMapperResponse, ScoreGraphEntry, PlayerResponseFull, ClanBiggerResponse } from './BeatLeader/types/BeatLeader' -import { ScoresSearchOptions, CompactScoreResponseResponseWithMetadata, Difficulties, AccGraphOptions, HistoryCompactResponse, ScoreResponseWithMyScore } from './BeatLeader/types/BeatLeader' +import { PlayerFollower, PlayerSearchOptions, ScoresSearchOptions, CompactScoreResponseResponseWithMetadata, Difficulties, AccGraphOptions, HistoryCompactResponse, ScoreResponseWithMyScore } from './BeatLeader/types/BeatLeader' export namespace ScoreSaber { export namespace Leaderboard { @@ -68,6 +68,7 @@ export namespace BeatLeader { function getByPatreonId(patreonId: string): Promise function getParticipatedEventsById(id: string): Promise function getFollowerInfoById(id: string): Promise + function getFollowersById(id: string, page?: number, count?: number, relationship: "following" | "followers"): Promise> function getFoundedClanById(id: string): Promise function getRankedMapsById(id: string): Promise }