moddex-js
Classes
| Class | Description |
|---|---|
| CatalogApi | API namespace for the catalog vocabulary: every value the projects.list filters take. ModDex caches it for an hour. |
| LookupApi | API namespace for finding ModDex projects from ModDex, CurseForge or Modrinth IDs, slugs, links or files. Lookup resolves every project with a page on ModDex, including delisted ones (available: false). |
| ModDexAmbiguousError | Thrown on 422 with code ambiguous: a slug belongs to a mod and a modpack. Pass type to pick one. |
| ModDexAuthenticationError | Thrown on 401 Unauthorized: the token is invalid (unauthenticated) or expired (token_expired). |
| ModDexClient | Client for the ModDex API v2. Every endpoint is public, so a token is optional. |
| ModDexClientCore | Low-level HTTP client used internally by all API namespace classes. |
| ModDexConflictError | Thrown on 409 Conflict when the identifiers of an explicit lookup match different projects. |
| ModDexError | Base class for every error thrown by the client. Catch this to handle all failures at once. |
| ModDexForbiddenError | Thrown on 403 Forbidden: the client is blocked, or the token can't be used. |
| ModDexNetworkError | Thrown when the request failed before a response was received, e.g. DNS, connection or CORS failures. |
| ModDexNotFoundError | Thrown on 404 Not Found: no such project, review or route. A lookup that finds nothing throws this too. |
| ModDexRateLimitError | Thrown on 429 Too Many Requests. Wait retryAfter seconds before retrying. |
| ModDexServiceUnavailableError | Thrown on 503 Service Unavailable: the API is busy, timed out, or down for maintenance, or search is unavailable. Expensive requests can get this whatever your own rate limit. Wait retryAfter seconds before retrying. |
| ModDexTimeoutError | Thrown when the request did not complete within timeoutMs. |
| ModDexValidationError | Thrown on 422 Unprocessable Content: a parameter is invalid (validation_failed), the page is too deep (page_depth_exceeded), or a sync cursor was edited (invalid_cursor). |
| ProjectsApi | API namespace for projects, addressed by ModDex project ID. Use client.lookup to get the ID from a CurseForge or Modrinth ID, slug or link. |
| ReviewsApi | API namespace for reviews across every project. |
| SyncApi | API namespace for the cursor feeds, for keeping a copy of ModDex data in sync. ModDex's terms require removing content within 7 days of its removal from ModDex: delete tombstoned projects with their reviews, and at least daily delete every stored review that listReviewIds doesn't list. |
| UserApi | API namespace for the user that owns the API token. |
Interfaces
| Interface | Description |
|---|---|
| AmbiguousLookup | A batch value that could mean a mod or a modpack, sent without type. |
| AuthenticatedUser | The user that owns the API token, as returned by GET /api/user. |
| BatchLookupOptions | Query parameters for lookup.batch. Up to 100 values in total. |
| BatchLookupResult | Result of lookup.batch, keyed by each value as sent (trimmed). |
| CacheOptions | In-memory response cache settings. |
| CatalogFilters | Every projects.list parameter and sort, as returned by catalog.getFilters. |
| CatalogParameter | One projects.list parameter. |
| CommunityTag | A tag in a project's community tag panel. |
| CommunityTags | A project's community tags, as returned by projects.getCommunityTags. |
| CurseForgeListing | A project's CurseForge listing, in the full shape. |
| Dependency | A dependency as the project's listing declares it. |
| DependencyListMeta | Extra meta fields of projects.listDependencies and projects.listContents. |
| DependencyListResponse | Response of projects.listDependencies and projects.listContents. |
| Dependent | A project that depends on another. |
| DependentListMeta | Extra meta fields of projects.listDependents. |
| DeveloperResponse | A project developer's public reply to a review. |
| ExplicitLookupMatch | How one parameter of an explicit lookup matched. |
| ExplicitLookupOptions | Query parameters for lookup.find. Pass any combination of the six keys and url. Each is resolved on its own: the response is a 200 when all hits are the same project, even if some keys miss, and a 409 conflict when keys hit different projects. |
| ExplicitLookupResponse | Response of lookup.find. |
| FeaturedInfo | A staff pick. |
| FileBatchLookupOptions | Query parameters for lookup.fileBatch. Up to 100 values in total. |
| FileBatchLookupResult | Result of lookup.fileBatch, keyed by each value as sent. null when unknown, hidden or malformed. |
| FileListMeta | Extra meta fields of projects.listFiles. |
| FileMatch | A file mapped to its project. |
| GetProjectOptions | Query parameters for projects.get. |
| LatestRelease | The newest release on one platform. |
| ListDependenciesOptions | Query parameters for projects.listDependencies and projects.listContents. |
| ListDependentsOptions | Query parameters for projects.listDependents. |
| ListFilesOptions | Query parameters for projects.listFiles. |
| ListMinecraftVersionsOptions | Query parameters for catalog.listMinecraftVersions. |
| ListProjectsOptions | Query parameters for projects.list. catalog.getFilters() lists every parameter and its valid values. A search (q) or any filter counts against a separate, lower rate limit. |
| ListReviewsOptions | Query parameters for reviews.list. |
| ListSimilarProjectsOptions | Query parameters for projects.listSimilar. |
| ListTagsOptions | Query parameters for catalog.listTags. |
| LookupMatch | How a lookup value matched its project. |
| LookupOptions | Query parameters for lookup.get. |
| LookupResponse | Response of lookup.get. |
| LookupReviewsMeta | Extra meta fields of lookup.listReviews. |
| LookupReviewsOptions | Query parameters for lookup.listReviews. |
| MaskingOptions | Query parameter for endpoints that return review text. |
| MinecraftVersion | A Minecraft version the catalog knows. |
| ModDexClientOptions | Options for creating a ModDexClient. |
| ModDexErrorBody | Error body returned by the ModDex API. |
| ModDexErrorOptions | Options accepted by ModDexError and its subclasses. |
| ModDexPaginatedResponse | Envelope returned by paginated ModDex endpoints. M adds endpoint-specific fields to meta. |
| ModDexResponse | Envelope returned by non-paginated ModDex endpoints. |
| ModrinthListing | A project's Modrinth listing, in the full shape. |
| ModrinthOrganization | The Modrinth organization that owns a project. |
| PaginateOptions | Options for paginate, followCursor and the iterate* helpers. |
| PaginationLinks | Links to neighbouring pages included in paginated responses. |
| PaginationMeta | Pagination metadata included in paginated responses. |
| PaginationOptions | Common query parameters for paginated endpoints. page × per_page may not exceed 10,000. |
| PlatformListingSummary | A listing of a project on CurseForge or Modrinth, in the list shape. |
| Project | Full details of a project, as returned by projects.get and the lookups. |
| ProjectAuthor | A credit on a project page. |
| ProjectCounts | Item counts of a project. |
| ProjectFile | One release. A CurseForge row is a file with its server pack attached. A Modrinth row is a version: its primary file's fields at the top level and its other files in secondary_files. |
| ProjectLicense | A project's license. |
| ProjectLinks | Links to a project on ModDex. |
| ProjectListItem | A project in the list shape, as returned by projects.list and other project lists. |
| ProjectPlatformUrls | External links of a project. Each is an https URL or null. |
| ProjectRating | Aggregate rating of a project. |
| ProjectRatings | Rating histograms and ranks, added with include: ['ratings']. |
| ProjectSource | A listing a project is downloaded from, including merged loader-specific listings. |
| ProjectSummary | The smallest project shape, used in lookups, batch lookups, reviews and error candidates. |
| RateLimit | Rate limit state reported by the X-RateLimit-* response headers. |
| RatingStep | How many ratings landed on one star step. |
| Reputation | Reputation of a ModDex user. |
| RequestOptions | Options passed to individual request methods. |
| RetryableErrorOptions | Options accepted by the errors that carry a Retry-After. |
| Review | An approved review or quick rating. |
| ReviewAuthor | A ModDex user who wrote a review or a developer response. |
| ReviewCategories | Category ratings of a review. Each is 0.5 to 5, or null when not rated. |
| ReviewFilterOptions | Filters shared by every review list. |
| ReviewImage | An image attached to a review. |
| Screenshot | A screenshot from a platform listing. |
| SecondaryFile | Another file of a Modrinth version. |
| ServerPack | A CurseForge modpack's server pack. |
| SimilarProjectsResponse | Response of projects.listSimilar. |
| SyncOptions | Where a sync feed starts. Pass cursor to continue, or since (or neither) to start over. |
| SyncProjectsOptions | Query parameters for sync.listProjects. |
| SyncResponse | Envelope of the cursor-paged sync feeds. The feeds only go forward. |
| SyncReviewsOptions | Query parameters for sync.listReviews. |
| Tag | A taxonomy tag. |
| TaxonomyTerm | A taxonomy value. The slug is what the matching projects.list filter takes. |
| TokenExpiry | Token expiry reported by the X-ModDex-Token-Expires response header. |
| UserSocialLinks | Social profile links of the authenticated user. |
Type Aliases
| Type Alias | Description |
|---|---|
| BatchLookupEntry | One batch lookup value: its project, ambiguous candidates, or null when not on ModDex or not valid. |
| CatalogParameterType | Value types of projects.list parameters. boolean takes 1/0/true/false, date takes ISO 8601. |
| FileLookupOptions | Query parameters for lookup.file. Pass exactly one of sha1 or curseforge_file_id. |
| FileSortField | Sort fields accepted by projects.listFiles. |
| FilterMode | How a list filter combines its values. |
| LicenseCategory | License categories. |
| ListProjectReviewsOptions | Query parameters for projects.listReviews. Quick ratings count toward the rating but aren't listed. |
| LookupKey | An identifier a lookup can match on. |
| LookupPlatform | A platform a lookup value can come from. |
| LookupReviewsResponse | Response of lookup.listReviews. |
| ModDexErrorCode | Stable machine-readable error code sent in the code field of every v2 error. |
| PackSize | Modpack sizes by mod count. |
| Platform | A platform ModDex lists projects from. |
| PlayStatus | How far a reviewer got with a project. |
| ProjectInclude | Heavy blocks a project response leaves out unless asked for. |
| ProjectSortField | Sort fields accepted by projects.list. |
| ProjectSyncRow | A row of the projects sync feed: a live project in the list shape, or a tombstone. Tell them apart by removed. |
| ProjectTombstone | A project that no longer resolves. Delete it and its reviews if you store them. |
| ProjectType | Kind of project. |
| QueryValue | A value that can be serialized as a URL query parameter. Booleans are sent as 1 / 0. Arrays are sent as a comma-separated list, each item encoded on its own. |
| RelationSortField | Sort fields accepted by the dependency and dependent lists. |
| RelationType | How one project depends on another. |
| ReleaseType | Release channel of a file. |
| ReviewMediaFilter | Which reviews to keep by attached media. |
| ReviewSort | Sort orders accepted by the review lists. |
| SideSupport | How a project installs, as Modrinth used to report it. Deprecated by Modrinth. |
| SortDirection | Sort direction accepted by list endpoints. |
| TagType | Tag categories. Loaders and Minecraft versions have their own lists. |
| UserRole | Staff badges a profile can show. |
Functions
| Function | Description |
|---|---|
| followCursor | Follows a sync feed's cursor, yielding each page until the feed has no more rows ready. Pages are yielded whole, so the last one's meta.next_cursor can be stored and passed back later to poll for new changes. |
| paginate | Iterates every item of a paginated endpoint, fetching one page at a time as the loop advances. |
References
default
Renames and re-exports ModDexClient