Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/ScreepsHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1826,19 +1826,21 @@ export class ScreepsHttpClient extends EventEmitter {
}

/**
* Query scoreboard results. This appears to only be relevant to
* Query scoreboard user results. This appears to only be relevant to
* {@link https://screeps.com/season/#!/seasons/chronicle | Seasonal World}
* competitions/events.
* competitions.
*
* Endpoint: `GET /api/scoreboard/list`
* @param offset The index (starting at zero) of the first leaderboard
* position that should be included in the response
* @param limit The number of users to return per request.
* @param offset Offset of the first result to return
* @param limit The maximum number of results to return per request.
* The maximum valid value is 20.
* @param search If undefined, returns all users. If defined, results are
* filtered by usernames that include this substring (case sensitive).
* @throws {@link ScreepsApiError} HTTP 404 if called on a non- Seasonal World server
* @category Endpoints: /scoreboard
*/
scoreboardList(offset = 0, limit = 20): Promise<Http.ScoreboardListResponse> {
return this.req(ScreepsHttpMethods.Get, '/api/scoreboard/list', { limit, offset })
scoreboardList(offset = 0, limit = 20, search?: string): Promise<Http.ScoreboardListResponse> {
return this.req(ScreepsHttpMethods.Get, '/api/scoreboard/list', { limit, offset, search })
}

/**
Expand Down
7 changes: 5 additions & 2 deletions src/http/scoreboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import { ScreepsResponse } from './base'
*/
export interface ScoreboardListResponse extends ScreepsResponse {
meta: {
/** The total number of players who have spawned on this season's map */
/** The total number of players in the result set */
length: number
}
/** A page of player leaderboard results */
/**
* A page of player scoreboard results
* ordered by {@link ScoreboardUser.rank} (ascending)
*/
users: ScoreboardUser[]
}

Expand Down