mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
fix: make search use v3 everywhere (#6840)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user