fix: make search use v3 everywhere (#6840)

This commit is contained in:
Calum H.
2026-07-23 22:16:23 +00:00
committed by GitHub
parent 5c697f675c
commit 0512e0b62b
17 changed files with 241 additions and 149 deletions
@@ -73,6 +73,30 @@ export class LabrinthProjectsV3Module extends AbstractModule {
})
}
/**
* Search projects (v3)
*
* @param params - Search parameters
* @returns Promise resolving to v3 search results
*/
public async search(
params: Labrinth.Search.SearchParams,
options?: {
headers?: Record<string, string>
},
): Promise<Labrinth.Search.v3.SearchResults> {
return this.client.request<Labrinth.Search.v3.SearchResults>(`/search`, {
api: 'labrinth',
version: 3,
method: 'GET',
headers: options?.headers,
params: {
...params,
facets: params.facets ? JSON.stringify(params.facets) : undefined,
},
})
}
/**
* Edit a project (v3)
*
@@ -1750,6 +1750,17 @@ export namespace Labrinth {
}
export namespace Search {
export type SearchParams = {
query?: string
offset?: string | number
index?: string
limit?: string | number
new_filters?: string
facets?: string[][]
filters?: string
version?: string
}
export namespace v2 {
export interface ResultSearchProject {
project_id: string
@@ -1812,7 +1823,9 @@ export namespace Labrinth {
featured_gallery: string | null
color: number | null
loaders: string[]
project_loader_fields?: Record<string, unknown[]>
project_loader_fields?: Record<string, unknown[]> & {
environment?: Projects.v3.Environment[]
}
minecraft_server?: Projects.v3.MinecraftServer | null
minecraft_java_server?: Projects.v3.MinecraftJavaServer | null
minecraft_bedrock_server?: Projects.v3.MinecraftBedrockServer | null