{"id":20801089,"url":"https://github.com/kartoffelchipss/typerinth","last_synced_at":"2025-05-07T00:10:43.751Z","repository":{"id":257813733,"uuid":"868259528","full_name":"KartoffelChipss/Typerinth","owner":"KartoffelChipss","description":"A TypeScript library for interacting with the Modrinth API","archived":false,"fork":false,"pushed_at":"2025-04-27T12:48:23.000Z","size":507,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-27T12:51:20.381Z","etag":null,"topics":["api-wrapper","modrinth","modrinth-api","modrinth-downloader","typescript"],"latest_commit_sha":null,"homepage":"https://typerinth.js.org/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KartoffelChipss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-05T22:25:33.000Z","updated_at":"2025-04-27T12:47:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"5ff47329-d588-4fbe-87c1-5672bee35b8c","html_url":"https://github.com/KartoffelChipss/Typerinth","commit_stats":null,"previous_names":["kartoffelchipss/typerinth"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KartoffelChipss%2FTyperinth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KartoffelChipss%2FTyperinth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KartoffelChipss%2FTyperinth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KartoffelChipss%2FTyperinth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KartoffelChipss","download_url":"https://codeload.github.com/KartoffelChipss/Typerinth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788529,"owners_count":21804284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","modrinth","modrinth-api","modrinth-downloader","typescript"],"created_at":"2024-11-17T18:16:30.834Z","updated_at":"2025-05-07T00:10:43.742Z","avatar_url":"https://github.com/KartoffelChipss.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typerinth\n\n[![npm](https://img.shields.io/npm/v/typerinth?label=Version\u0026color=%23366fb4)](https://www.npmjs.com/package/typerinth) [![npm](https://img.shields.io/npm/dt/typerinth?label=Downloads)](https://www.npmjs.com/package/typerinth) [![discord](https://dcbadge.vercel.app/api/server/Cc76tYwXvy?style=flat\u0026theme=default-inverted)](https://strassburger.org/discord)\n\nThis library is a wrapper around the [Modrinth API](https://docs.modrinth.com/), a platform for Minecraft mods, modpacks, and other content. It is not an official package by Modrinth and not affiliated with Modrinth in any way.\n\n[![npm](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/available/npm_vector.svg)](https://www.npmjs.com/package/typerinth) [![ghpages](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/compact/documentation/ghpages_vector.svg)](https://typerinth.js.org/)\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Options](#options)\n    - [Projects](#projects)\n        - [Search](#search)\n        - [Get a project by its ID or slug](#get-a-project-by-its-id-or-slug)\n        - [Get multiple projects by their IDs or slugs](#get-multiple-projects-by-their-ids-or-slugs)\n        - [Get a random selection of projects](#get-a-random-selection-of-projects)\n        - [Check if a project id or slug is valid](#check-if-a-project-id-or-slug-is-valid)\n    - [Versions](#versions)\n        - [Get the versions of a project](#get-the-versions-of-a-project)\n        - [Get a version by its ID](#get-a-version-by-its-id)\n        - [Get multiple versions by their IDs](#get-multiple-versions-by-their-ids)\n        - [Get the version from a file hash](#get-the-version-from-a-file-hash)\n    - [Users](#users)\n        - [Get a user by their ID or username](#get-a-user-by-their-id-or-username)\n        - [Get multiple users by their IDs or usernames](#get-multiple-users-by-their-ids-or-usernames)\n        - [Get a user's projects](#get-a-users-projects)\n        - [Get the authenticated user](#get-the-authenticated-user)\n    - [Teams](#teams)\n        - [Get a project's team members](#get-a-projects-team-members)\n        - [Get a team's members](#get-a-teams-members)\n        - [Get the members of mutliple teams](#get-the-members-of-mutliple-teams)\n    - [Tags](#tags)\n        - [Get tags by its type](#get-tags)\n        - [Get a License by its ID](#get-a-license-by-its-id)\n    - [Auth](#auth)\n        - [Generate an authorization URL to get an authorization code](#generate-an-authorization-URL-to-get-an-authorization-code)\n        - [Get an access token from an authorization code](#get-an-access-token-from-an-authorization-code)\n    - [Miscellanous](#miscellanous)\n        - [Get statistics](#get-statistics)\n- [Coverage](#coverage)\n- [License](#license)\n\n## Installation\n\nSimply execute the following command in your commandline:\n\n```bash\nnpm install typerinth\n```\n\n## Usage\n\nImport the package like this:\n\n```ts\nimport { Modrinth } from 'typerinth';\nconst modrinth = new Modrinth();\n```\n\n### Options\n\nYou can change the options to tune typerinth to your liking:\n\n```ts\nimport { Modrinth } from 'typerinth';\nconst modrinth = new Modrinth({\n    userAgent: 'AppName/Version',\n    cache: {\n        ttl: 600,\n        checkperiod: 120,\n        useCache: true,\n    },\n});\n```\n\nOnce you have done this, you can use all the following functions as you like.\n\nPlease note that these are only some functions. You can find a full list of all functions [here](https://typerinth.js.org/classes/Modrinth.html).\n\n---\n\n### Projects\n\n#### Search\n\n```ts\nimport { SearchIndex } from 'typerinth';\nconst result = await modrinth.search('life', {\n    limit: 3,\n    index: SearchIndex.Downloads,\n});\n```\n\nYou can use Facets to filter search results more precisely.\n\n1. **Facet**: Represents a single filter condition. It consists of:\n    - **FacetType**: The category of the filter (e.g., versions, categories, etc.).\n    - **FacetOperation**: The comparison method (like EQUALS).\n    - **Value**: The actual value to filter by.\n2. **FacetGroup**: Combines multiple Facets with a logical **OR**. If any of the Facets in the group match, the result is included. A FacetGroup can also just have one Facet.\n3. **SearchFacets**: Combines multiple FacetGroups with a logical **AND**.\n\nHere’s an example where we search for projects related to \"life\", filtering them to show only results that:\n\n- Belong to the \"forge\" category **AND**\n- Are compatible with Minecraft version \"1.16.5\" **OR** \"1.20.1\".\n\n```ts\nimport { SearchIndex, SearchFacets, FacetGroup, Facet } from 'typerinth';\nconst result = await modrinth.search('life', {\n    limit: 3,\n    index: SearchIndex.Downloads,\n    facets: new SearchFacets(\n        new FacetGroup(\n            new Facet(FacetType.Categories, FacetOperation.EQUALS, 'forge')\n        ),\n        new FacetGroup(\n            new Facet(FacetType.Versions, FacetOperation.EQUALS, '1.16.5'),\n            new Facet(FacetType.Versions, FacetOperation.EQUALS, '1.17.1')\n        )\n    ),\n});\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#search)\n\n#### Get a project by its ID or slug\n\n```ts\nconst project = await modrinth.getProject('project-id');\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getproject)\n\n#### Get multiple projects by their IDs or slugs\n\n```ts\nconst projects = await modrinth.getProjects(['project-id-1', 'project-id-2']);\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getprojects)\n\n#### Get a random selection of projects\n\n```ts\nconst projects = await modrinth.getRandomProjects(5);\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getrandomprojects)\n\n#### Check if a project ID or slug is valid\n\n```ts\nconst isValid = await modrinth.checkProjectValidity('project-id');\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#checkprojectvalidity)\n\n---\n\n### Versions\n\n#### Get the versions of a project\n\n```ts\nconst versions = await modrinth.getProjectVersions('project-id', {\n    loaders: ['forge'],\n    gameVersions: ['1.16.5'],\n});\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getprojectversions)\n\n#### Get a version by its ID\n\n```ts\nconst version = await modrinth.getVersion('version-id');\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getversion)\n\n#### Get multiple versions by their IDs\n\n```ts\nconst versions = await modrinth.getVersions(['version-id-1', 'version-id-2']);\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getversions)\n\n#### Get the version from a file hash\n\n```ts\nconst version = await modrinth.getVersionFromFileHash('file-hash');\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getversionfromfilehash)\n\n---\n\n### Users\n\n#### Get a user by their ID or username\n\n```ts\nconst user = await modrinth.getUser('user-id');\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getuser)\n\n#### Get multiple users by their IDs or usernames\n\n```ts\nconst users = await modrinth.getUsers(['user-id-1', 'user-id-2']);\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getusers)\n\n#### Get a user's projects\n\n```ts\nconst projects = await modrinth.getUserProjects('user-id');\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getuserprojects)\n\n#### Get the authenticated user\n\nThis method returns the user that is authenticated by the authorization header\n\n```ts\nconst projects = await modrinth.getAuthUser();\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getauthuser)\n\n---\n\n### Teams\n\n#### Get a project's team members\n\n```ts\nconst members = await modrinth.getProjectTeamMembers('project-id');\n```\n\n#### Get a team's members\n\n```ts\nconst members = await modrinth.getTeamMembers('team-id');\n```\n\n#### Get the members of mutliple teams\n\n```ts\nconst members = await modrinth.getMultipleTeamMembers([\n    'team-1-id',\n    'team-2-id',\n]);\n```\n\n---\n\n### Tags\n\n#### Get tags\n\nGets tags as described in the [Modrinth API documentation](https://docs.modrinth.com/#tag/tags/operation/categoryList).\n\n```ts\nimport { TagType } from 'typerinth';\nconst tags = await modrinth.getTag(TagType.Loader);\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#gettag)\n\n#### Get a License by its ID\n\n```ts\nconst license = await modrinth.getLicense('license-id');\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getlicense)\n\n---\n\n### Auth\n\n#### Generate an authorization URL to get an authorization code\n\n```ts\nconst url = modrinth.generateAuthorizationUrl(\n    CLIENT_ID,\n    'http://localhost:3000/callback',\n    [AuthScope.UserRead, AuthScope.PayoutsRead]\n);\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#generateauthorizationurl)\n\n#### Get an access token from an authorization code\n\n```ts\nconst token = await modrinth.getToken(\n    'YNJZ3OPwkgC7B4svVFv6PTDWdLNajGZx,\n    CLIENT_ID,\n    'http://localhost:3000/callback'\n);\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#gettoken)\n\n---\n\n### Miscellanous\n\n#### Get statistics\n\n```ts\nconst stats = await modrinth.getStatistics();\n```\n\n[\u003e Typedoc](https://typerinth.js.org/classes/Modrinth.html#getstatistics)\n\n## Coverage\n\nYou can find a list of the endpoints covered by this library in the [coverage.md](https://github.com/KartoffelChipss/Typerinth/blob/main/coverage.md) file.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/KartoffelChipss/Typerinth/blob/main/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartoffelchipss%2Ftyperinth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkartoffelchipss%2Ftyperinth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartoffelchipss%2Ftyperinth/lists"}