{"id":20400079,"url":"https://github.com/destinyitemmanager/bungie-api-ts","last_synced_at":"2025-04-06T15:13:08.295Z","repository":{"id":28823517,"uuid":"117199025","full_name":"DestinyItemManager/bungie-api-ts","owner":"DestinyItemManager","description":"TypeScript definitions for the Bungie.net API","archived":false,"fork":false,"pushed_at":"2024-04-14T00:36:10.000Z","size":10015,"stargazers_count":106,"open_issues_count":1,"forks_count":21,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-30T00:57:59.691Z","etag":null,"topics":["bungie","bungie-api","typescript-definitions"],"latest_commit_sha":null,"homepage":"","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/DestinyItemManager.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-01-12T05:56:09.000Z","updated_at":"2024-08-07T14:08:17.000Z","dependencies_parsed_at":"2023-01-14T09:40:29.273Z","dependency_job_id":"22109f3a-0a84-4392-9fe8-8d3fcfc290df","html_url":"https://github.com/DestinyItemManager/bungie-api-ts","commit_stats":{"total_commits":193,"total_committers":8,"mean_commits":24.125,"dds":"0.27461139896373055","last_synced_commit":"bd74e39e063d0e9b844d850f9cbd7239046fde1c"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DestinyItemManager%2Fbungie-api-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DestinyItemManager%2Fbungie-api-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DestinyItemManager%2Fbungie-api-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DestinyItemManager%2Fbungie-api-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DestinyItemManager","download_url":"https://codeload.github.com/DestinyItemManager/bungie-api-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500469,"owners_count":20948880,"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":["bungie","bungie-api","typescript-definitions"],"created_at":"2024-11-15T04:38:20.769Z","updated_at":"2025-04-06T15:13:08.277Z","avatar_url":"https://github.com/DestinyItemManager.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bungie API TypeScript support\n\nThis project implements TypeScript definitions and API helpers for the [Bungie.net API](https://github.com/Bungie-net/api). It's meant for use in [Destiny Item Manager](https://destinyitemmanager.com), but should be general enough to use in any project. The code is completely generated from Bungie's documentation - I considered using something like Swagger Codegen, but instead opted for a custom generator so we could make the result as nice as possible.\n\n# Ports\n\nFeel free to fork this and use it to generate for your favorite language!\n\n- [Dart](https://github.com/marquesinijatinha/bungie-api-dart/)\n\n# Install\n\n```\npnpm add bungie-api-ts\n```\n\n# Interfaces and Enums\n\nAll the interface type definitions and enums are for type info only - everything will compile out. Only the API helpers produce real JavaScript output. You can import types from each service defined on Bungie.net:\n\n```typescript\nimport { DestinyInventoryComponent, DestinyInventoryItemDefinition } from 'bungie-api-ts/destiny2';\n```\n\nThere are definitions for every type defined in the Bungie.net services. See [their documentation](https://bungie-net.github.io/multi/) for a list - the interface names are the last part of the full name (for example, `Destiny.Definitions.DestinyVendorActionDefinition` becomes `DestinyVendorActionDefinition`). There are a few exceptions, like `SingleComponentResponseOfDestinyInventoryComponent`, which have been mapped into nicer forms like `SingleComponentResponse\u003cDestinyInventoryComponent\u003e`, and the server responses, which are now `ServerResponse\u003cT\u003e` instead of something like `DestinyCharacterResponse`.\n\n# API Helpers\n\nIn addition to the types, there are also simple helper functions for each API endpoint. They define the inputs and outputs to that endpoint, and will call a user-provided function with HTTP request info that you can then use to make an HTTP request. This pattern was used so the API helpers could provide full type information. These helpers are not a full API client - they assist in building one. An example:\n\n```typescript\nimport { getProfile, HttpClientConfig } from 'bungie-api-ts/destiny2';\n\nasync function $http(config: HttpClientConfig) {\n  // fill in the API key, handle OAuth, etc., then make an HTTP request using the config.\n  return fetch(config.url, ...);\n}\n\nconst profileInfo: ServerResponse\u003cDestinyProfileResponse\u003e = await getProfile($http, {\n  components: [DestinyComponentType.Profiles, DestinyComponentType.Characters],\n  destinyMembershipId: 12345,\n  membershipType: BungieMembershipType.TigerPsn\n});\n```\n\n# Imports\n\nIt is possible to import all services from `bungie-api-ts` directly, but it's better to import the specific service and pick out what you want:\n\n```typescript\n// good\nimport { getProfile, HttpClientConfig } from 'bungie-api-ts/destiny2';\ngetProfile(...);\n\n// works, but not as good\nimport { Destiny2 } from 'bungie-api-ts';\nDestiny2.getProfile(...);\n```\n\n# Manifest Helpers\n\nThe `destiny2` import also contains helpers for typing and downloading the Destiny manifest:\n\n```typescript\nimport { getDestinyManifestSlice } from 'bungie-api-ts/destiny2';\n\nasync function $http(config: HttpClientConfig) {\n  // fill in the API key, handle OAuth, etc., then make an HTTP request using the config.\n  return fetch(config.url, ...);\n}\n\nconst destinyManifest = await getDestinyManifest($http);\nconst manifestTables = getDestinyManifestSlice($http, {\n  destinyManifest,\n  tableNames: ['DestinyInventoryItemDefinition', 'DestinySocketDefinition'],\n  language: 'en',\n});\n\n// manifestTables is an object with properties DestinyInventoryItemDefinition and DestinySocketDefinition\n```\n\n# Build\n\n```\n# setup\npnpm i \u0026\u0026 pnpm submodule\n# run\npnpm start\n```\n\n# Updating API sources\n\nRun the [update API sources](https://github.com/DestinyItemManager/bungie-api-ts/actions/workflows/update.yml) GitHub Action and it should create a new PR for the updated sources.\n\n# Publishing\n\nUpdate the version in `package.json`, and when the PR merges to `master`, a GitHub workflow will automatically publish to NPM. Don't forget to run `pnpm start` and commit all changed files!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdestinyitemmanager%2Fbungie-api-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdestinyitemmanager%2Fbungie-api-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdestinyitemmanager%2Fbungie-api-ts/lists"}