{"id":25065488,"url":"https://github.com/steamgriddb/node-steamgriddb","last_synced_at":"2025-04-14T18:31:02.030Z","repository":{"id":34979491,"uuid":"192601317","full_name":"SteamGridDB/node-steamgriddb","owner":"SteamGridDB","description":"JavaScript Wrapper for the SteamGridDB API","archived":false,"fork":false,"pushed_at":"2025-02-16T20:19:49.000Z","size":317,"stargazers_count":17,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T06:51:14.619Z","etag":null,"topics":["api","javascript","steam"],"latest_commit_sha":null,"homepage":"https://www.steamgriddb.com/api/v2","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/SteamGridDB.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":"2019-06-18T19:34:37.000Z","updated_at":"2025-02-16T20:19:52.000Z","dependencies_parsed_at":"2024-05-30T14:42:56.013Z","dependency_job_id":null,"html_url":"https://github.com/SteamGridDB/node-steamgriddb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteamGridDB%2Fnode-steamgriddb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteamGridDB%2Fnode-steamgriddb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteamGridDB%2Fnode-steamgriddb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SteamGridDB%2Fnode-steamgriddb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SteamGridDB","download_url":"https://codeload.github.com/SteamGridDB/node-steamgriddb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248936541,"owners_count":21186044,"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","javascript","steam"],"created_at":"2025-02-06T19:27:25.054Z","updated_at":"2025-04-14T18:31:01.978Z","avatar_url":"https://github.com/SteamGridDB.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SteamGridDB API\n[![npm](https://img.shields.io/npm/v/steamgriddb.svg?color=%23CB3837\u0026logo=npm\u0026style=for-the-badge)](https://www.npmjs.com/package/steamgriddb)\n[![license](https://img.shields.io/npm/l/steamgriddb.svg?style=for-the-badge\u0026logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGFyaWEtaGlkZGVuPSJ0cnVlIiB2aWV3Qm94PSIwIDAgMTQgMTYiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik03IDRhMS41IDEuNSAwIDEgMSAwLTMgMS41IDEuNSAwIDAgMSAwIDN6bTcgNmEyIDIgMCAwIDEtMiAyaC0xYTIgMiAwIDAgMS0yLTJsMi00aC0xYTEgMSAwIDAgMS0xLTFIOHY4Yy40MiAwIDEgLjQ1IDEgMWgxYy40MiAwIDEgLjQ1IDEgMUgzYzAtLjU1LjU4LTEgMS0xaDFjMC0uNTUuNTgtMSAxLTFoLjAzTDYgNUg1YTEgMSAwIDAgMS0xIDFIM2wyIDRhMiAyIDAgMCAxLTIgMkgyYTIgMiAwIDAgMS0yLTJsMi00SDFWNWgzYTEgMSAwIDAgMSAxLTFoNGExIDEgMCAwIDEgMSAxaDN2MWgtMWwyIDR6TTIuNSA3TDEgMTBoM0wyLjUgN3pNMTMgMTBsLTEuNS0zLTEuNSAzaDN6Ii8+PC9zdmc+)](/LICENSE.md)\n[![license](https://img.shields.io/discord/488621078302949377.svg?color=%237289DA\u0026label=Discord\u0026logo=discord\u0026logoColor=%238ea7ff\u0026style=for-the-badge)](https://discord.gg/2jYnUej)  \n\n## Installation\n```bash\nnpm install steamgriddb\n```\n\n## Getting Started\n#### Get your API key\n[You can generate an API key on the preferences page.](https://www.steamgriddb.com/profile/preferences)\n\n#### Require the library into your project.\n```ts\nimport SGDB from \"steamgriddb\";\n```\n\n#### Pass your API key into the constructor:\n```ts\nconst client = new SGDB('your_api_key');\n```\n\nOptionally, you can pass an object with some settings:\n```ts\nconst client = new SGDB({\n    key: 'your_api_key',\n    headers: {\n        'X-Some-Header': 'Some Value',\n    },\n    baseURL: 'https://www.steamgriddb.com/api/v2'\n});\n```\n\n## Usage\nAlthough these code examples use [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await),\nSteamGridDB can also be used with `.then()` and `.catch()`.\n\n\u003cdetails\u003e\n    \u003csummary\u003eExample\u003c/summary\u003e\n\n```js\n    client.getGrids({type: 'game', id: 2254})\n        .then((grids) =\u003e {\n            console.log(grids);\n        })\n        .catch((error) =\u003e {\n            console.error(error);\n        });\n```\n\u003c/details\u003e\n\n### Search for a game:\n```ts\nconst games = await client.searchGame('Half-Life 2');\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eOutput\u003c/summary\u003e\n\n```json\n[\n  {\n    \"id\": 2254,\n    \"name\": \"Half-Life 2\",\n    \"types\": [\n      \"steam\"\n    ],\n    \"verified\": true\n  },\n  {\n    \"id\": 21207,\n    \"name\": \"Half-Life\",\n    \"types\": [\n      \"steam\"\n    ],\n    \"verified\": true\n  },\n  {\n    \"id\": 1417,\n    \"name\": \"Half-Life: Blue Shift\",\n    \"types\": [\n      \"steam\"\n    ],\n    \"verified\": true\n  },\n  {\n    \"id\": 3868,\n    \"name\": \"Half-Life: Source\",\n    \"types\": [\n      \"steam\"\n    ],\n    \"verified\": true\n  }\n]\n```\n\u003c/details\u003e\n\n### Get grids By Game ID\n```ts\n// 2254 = Game ID we got from searchGame()\nconst grids = await client.getGrids({type: 'game', id: 2254}); \n```\n\n```ts\n// 2254 = Game ID we got from searchGame()\nconst grids = await client.getGridsById(2254);\n```\n\n### Get grids by Steam App ID\n```ts\n// Get grid by Steam App Id\n// 220 = https://store.steampowered.com/app/220/HalfLife_2/\nconst grids = await client.getGrids({type: 'steam', id: 220});\n```\n\n```ts\n// 220 = https://store.steampowered.com/app/220/HalfLife_2/\nconst grids = await client.getGridsBySteamAppId(220);\n```\n\n### Filter styles:\n```ts\nconst grids = await client.getGrids({type: 'game', id: 2590, styles: ['material','blurred']});\n```\n\n```ts\nclient.getGridsBySteamAppId(220, ['material','blurred'])\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eOutput\u003c/summary\u003e\n\n```json\n[\n  {\n    \"id\": 80,\n    \"score\": 1,\n    \"style\": \"blurred\",\n    \"url\": \"https://s3.amazonaws.com/steamgriddb/grid/f033ab37c30201f73f142449d037028d.png\",\n    \"thumb\": \"https://s3.amazonaws.com/steamgriddb/thumb/f033ab37c30201f73f142449d037028d.png\",\n    \"tags\": [],\n    \"author\": {\n      \"name\": \"EpicWolverine\",\n      \"steam64\": \"76561198025674497\",\n      \"avatar\": \"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/76/764911aeb96ae312c2819780f4107396d3b5ac38.jpg\"\n    }\n  },\n  {\n    \"id\": 120,\n    \"score\": 1,\n    \"style\": \"blurred\",\n    \"url\": \"https://s3.amazonaws.com/steamgriddb/grid/da4fb5c6e93e74d3df8527599fa62642.png\",\n    \"thumb\": \"https://s3.amazonaws.com/steamgriddb/thumb/da4fb5c6e93e74d3df8527599fa62642.png\",\n    \"tags\": [],\n    \"author\": {\n      \"name\": \"Tiederian\",\n      \"steam64\": \"76561197997534033\",\n      \"avatar\": \"https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/bc/bc893073b7e2e60ad412c6fd2af39d3204a5f26a.jpg\"\n    }\n  }\n]\n```\n\u003c/details\u003e\n\n### Delete grids:\n```ts\n// Delete a grid\nconst success = await client.deleteGrids(80);\n```\n\n```ts\n// Delete multiple grids\nconst success = client.deleteGrids([80,81,82,83]);\n```\n\n#### Handling errors:\nSteamGridDB throws an [AxiosError](https://axios-http.com/docs/handling_errors) when an error occurs, with the message \naltered to contain the message returned from SteamGridDB. All methods and properties available in an AxiosError\nare available, such as `error.request` and `error.response`.\n\n```ts\n// Get grids for a game that doesn't exist\nlet grids;\n\ntry {\n    grids = await SGDB.getGrids({dimensions: [\"460x215\", \"920x430\"], ...{type, id: 0}});\n} catch (error) {\n    console.log(error.message); // \"Game not found.\"\n    console.log(err.response.status); // 404\n};\n```\n\n```ts\n// Try to delete a grid you don't own\ntry {\n    await client.deleteGrids(34312);\n} catch (error) {\n    console.log(error.message); // \"This grid isn't yours.\"\n    console.log(err.response.status); // 403\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamgriddb%2Fnode-steamgriddb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteamgriddb%2Fnode-steamgriddb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteamgriddb%2Fnode-steamgriddb/lists"}