/** * @module @xmcl/modrinth */ import { Category, Collection, GameVersion, License, Loader, Project, ProjectVersion, TeamMember, User } from './types'; export * from './types'; export interface SearchResultHit { /** * The slug of project, e.g. "my_project" */ slug: string; /** * The id of the project; prefixed with local- */ project_id: string; /** * The project type of the project. * @enum "mod" "modpack" * */ project_type: string; /** * The username of the author of the project */ author: string; /** * The name of the project. */ title: string; /** * A short description of the project */ description: string; /** * A list of the categories the project is in. */ categories: Array; /** * A list of the minecraft versions supported by the project. */ versions: Array; /** * The total number of downloads for the project */ downloads: number; follows: number; /** * A link to the project's main page; */ page_url: string; /** * The url of the project's icon */ icon_url: string; /** * The url of the project's author */ author_url: string; /** * The date that the project was originally created */ date_created: string; /** * The date that the project was last modified */ date_modified: string; /** * The latest version of minecraft that this project supports */ latest_version: string; /** * The id of the license this project follows */ license: string; /** * The side type id that this project is on the client */ client_side: string; /** * The side type id that this project is on the server */ server_side: string; /** * The host that this project is from, always modrinth */ host: string; gallery: string[]; featured_gallery: string; monetization_status: string; } export interface SearchProjectOptions { /** * The query to search */ query?: string; /** * The recommended way of filtering search results. [Learn more about using facets](https://docs.modrinth.com/docs/tutorials/search). * * @enum "categories" "versions" "license" "project_type" * @example [["categories:forge"],["versions:1.17.1"],["project_type:mod"]] */ facets?: string; /** * A list of filters relating to the properties of a project. Use filters when there isn't an available facet for your needs. [More information](https://docs.meilisearch.com/reference/features/filtering.html) * * @example filter=categories="fabric" AND (categories="technology" OR categories="utility") */ filter?: string; /** * What the results are sorted by * * @enum "relevance" "downloads" "follows" "newest" "updated" * @example "downloads" * @default relevance */ index?: string; /** * The offset into the search; skips this number of results * @default 0 */ offset?: number; /** * The number of mods returned by the search * @default 10 */ limit?: number; } export interface SearchResult { /** * The list of results */ hits: Array; /** * The number of results that were skipped by the query */ offset: number; /** * The number of mods returned by the query */ limit: number; /** * The total number of mods that the query found */ total_hits: number; } export interface GetProjectVersionsOptions { id: string; loaders?: Array; /** * Minecraft version filtering */ game_versions?: Array; featured?: boolean; } export declare class ModerinthApiError extends Error { readonly url: string; readonly status: number; readonly body: string; constructor(url: string, status: number, body: string); } export interface ModrinthClientOptions { baseUrl?: string; /** * The extra headers */ headers?: Record; /** * The fetch function to use */ fetch?: typeof fetch; } /** * @see https://docs.modrinth.com/api-spec */ export declare class ModrinthV2Client { private baseUrl; private fetch; headers: Record; constructor(options?: ModrinthClientOptions); /** * @see https://docs.modrinth.com/#tag/projects/operation/searchProjects */ searchProjects(options: SearchProjectOptions, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/projects/operation/getProject */ getProject(projectId: string, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/projects/operation/getProject */ getProjects(projectIds: string[], signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/versions/operation/getProjectVersions */ getProjectVersions(projectId: string, { loaders, gameVersions, featured }?: { loaders?: string[]; gameVersions?: string[]; featured?: boolean; }, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/versions/operation/getVersion */ getProjectVersion(versionId: string, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/versions/operation/getVersions */ getProjectVersionsById(ids: string[], signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/version-files/operation/versionsFromHashes */ getProjectVersionsByHash(hashes: string[], algorithm?: string, signal?: AbortSignal): Promise>; /** * @see https://docs.modrinth.com/api-spec#tag/version-files/operation/getLatestVersionsFromHashes */ getLatestVersionsFromHashes(hashes: string[], { algorithm, loaders, gameVersions }?: { algorithm?: string; loaders?: string[]; gameVersions?: string[]; }, signal?: AbortSignal): Promise>; /** * @see https://docs.modrinth.com/#tag/version-files/operation/getLatestVersionFromHash */ getLatestProjectVersion(sha1: string, { algorithm, loaders, gameVersions }?: { algorithm?: string; loaders?: string[]; gameVersions?: string[]; }, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/tags/operation/licenseList */ getLicenseTags(signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/tags/operation/categoryList */ getCategoryTags(signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/tags/operation/versionList */ getGameVersionTags(signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/tags/operation/loaderList */ getLoaderTags(signal?: AbortSignal): Promise; getCollections(userId: string, signal?: AbortSignal): Promise; uppdateCollectionIcon(collectionId: string, iconData: ArrayBuffer, mimeType: string, signal?: AbortSignal): Promise; createCollection(name: string, description: string, projectIds: string[], signal?: AbortSignal): Promise; updateCollection(collectionId: string, projectIds: string[], signal?: AbortSignal): Promise; getAuthenticatedUser(signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/api/operations/followproject/#_top */ followProject(id: string, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/api/operations/unfollowproject/ */ unfollowProject(id: string, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/api/operations/getfollowedprojects/#_top */ getUserFollowedProjects(userId: string, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/teams/operation/getProjectTeamMembers */ getProjectTeamMembers(projectId: string, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/users/operation/getUser */ getUser(id: string, signal?: AbortSignal): Promise; /** * @see https://docs.modrinth.com/#tag/users/operation/getUserProjects */ getUserProjects(id: string, signal?: AbortSignal): Promise; } //# sourceMappingURL=index.d.ts.map