@@ -2,6 +2,7 @@ import qs from "qs";
22
33import { BEATMAPS_SEARCH_MAX_RESULTS_LIMIT } from "../../../types/general/api" ;
44import type { Beatmap , Beatmapset } from "../../../types/general/beatmap" ;
5+ import { RankStatus , RankStatusInt } from "../../../types/general/rankStatus" ;
56import logger from "../../../utils/logger" ;
67import { BaseClient } from "../../abstracts/client/base-client.abstract" ;
78import type {
@@ -190,10 +191,11 @@ export class BanchoClient extends BaseClient {
190191 Authorization : `Bearer ${ await this . osuApiKey } ` ,
191192 } ,
192193 params : {
193- query : ctx . query ,
194+ q : ctx . query ,
194195 page,
195- status : ctx . status ,
196- mode : ctx . mode ,
196+ s : ctx . status ? ctx . status . map ( status => this . mapStatusToRankStatus ( status ) . toString ( ) ) : undefined ,
197+ m : ctx . mode ,
198+ nsfw : true , // TODO: Maybe make this configurable?
197199 } ,
198200 paramsSerializer : params =>
199201 qs . stringify ( params , { indices : false } ) ,
@@ -229,6 +231,25 @@ export class BanchoClient extends BaseClient {
229231 } ;
230232 }
231233
234+ private mapStatusToRankStatus ( status : RankStatusInt ) : RankStatus {
235+ switch ( status ) {
236+ case RankStatusInt . PENDING :
237+ return RankStatus . PENDING ;
238+ case RankStatusInt . QUALIFIED :
239+ return RankStatus . QUALIFIED ;
240+ case RankStatusInt . LOVED :
241+ return RankStatus . LOVED ;
242+ case RankStatusInt . GRAVEYARD :
243+ return RankStatus . GRAVEYARD ;
244+ case RankStatusInt . WIP :
245+ return RankStatus . WIP ;
246+ case RankStatusInt . APPROVED :
247+ return RankStatus . APPROVED ;
248+ }
249+
250+ return RankStatus . PENDING ;
251+ }
252+
232253 private async getBeatmapSetById (
233254 beatmapSetId : number ,
234255 ) : Promise < ResultWithStatus < Beatmapset > > {
0 commit comments