@@ -2,8 +2,9 @@ import { CachedPlayerName } from "./types/cache/cached-player-name";
22import { Page } from "./types/pagination/pagination" ;
33import { Cape } from "./types/player/cape/cape" ;
44import type { BasicPlayer , FullPlayer , PlayerType } from "./types/player/player" ;
5- import { Skin } from "./types/player/skin/skin" ;
65import type { RecentUsernameChange } from "./types/player/recent-username-change" ;
6+ import { Skin } from "./types/player/skin/skin" ;
7+ import { SkinLookupSort } from "./types/player/skin/skin-lookup-sort" ;
78import type { ErrorResponse } from "./types/response/error-response" ;
89import type { IpLookup } from "./types/response/ip-lookup-response" ;
910import type { ServerBlockedResponse } from "./types/response/server-blocked-response" ;
@@ -288,8 +289,10 @@ export class McUtilsAPI {
288289 * @param page the page to fetch (default: 1)
289290 * @returns the list of skins or the error (if one occurred)
290291 */
291- async fetchSkins ( page : number = 1 ) : Promise < { skins ?: Page < Skin > ; error ?: ErrorResponse } > {
292- const { data, error } = await this . request < Page < Skin > > ( `/skins${ this . buildParams ( { page : String ( page ) } ) } ` ) ;
292+ async fetchSkins ( page : number = 1 , type ?: SkinLookupSort ) : Promise < { skins ?: Page < Skin > ; error ?: ErrorResponse } > {
293+ const { data, error } = await this . request < Page < Skin > > (
294+ `/skins${ this . buildParams ( { page : String ( page ) , sort : type ?? "trending" } ) } ` ,
295+ ) ;
293296 return error ? { error } : { skins : data } ;
294297 }
295298
0 commit comments