{"_id":"@api-wrappers/trakt-wrapper","name":"@api-wrappers/trakt-wrapper","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@api-wrappers/trakt-wrapper","version":"0.1.0","description":"Type-safe TypeScript client for the Trakt API with OAuth helpers, typed endpoints, pagination, retries, and api-core plugins.","module":"./dist/index.mjs","type":"module","main":"./dist/index.cjs","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"publishConfig":{"access":"public"},"sideEffects":false,"scripts":{"build":"tsdown --config tsdown.config.mjs --config-loader native","test":"bun test","typecheck":"tsc --noEmit","typecheck:tests":"tsc --noEmit -p tsconfig.test.json","validate":"bun run typecheck && bun run typecheck:tests && bun test && bun run build","prepublishOnly":"bun run validate"},"keywords":["trakt","trakt-api","trakttv","api-wrapper","api-client","sdk","typescript","type-safe","movies","tv","shows","scrobble","watchlist","nodejs","bun"],"author":{"name":"api-wrappers"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Api-Wrappers/trakt-wrapper.git"},"homepage":"https://github.com/Api-Wrappers/trakt-wrapper#readme","bugs":{"url":"https://github.com/Api-Wrappers/trakt-wrapper/issues"},"engines":{"node":">=18"},"devDependencies":{"@types/bun":"^1.3.13","tsdown":"^0.22.0","typescript":"^6.0.3"},"peerDependencies":{"typescript":"^5 || ^6"},"dependencies":{"@api-wrappers/api-core":"^1.0.1"},"gitHead":"fcef4176ce232904059a99b9fb27a40a40cc59d0","_id":"@api-wrappers/trakt-wrapper@0.1.0","_nodeVersion":"22.17.1","_npmVersion":"11.13.0","dist":{"integrity":"sha512-TfpVMnswss54CtZLumJz6LOmOxq5yFI6+ysE9iguBW0MhUfKzTTQDx8vszred+QiZX0mkIN2DGJtGS03OIt6Lw==","shasum":"7a56f42e52c38b78bbe3282c03161c2df8a62939","tarball":"https://registry.npmjs.org/@api-wrappers/trakt-wrapper/-/trakt-wrapper-0.1.0.tgz","fileCount":10,"unpackedSize":205911,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHPhbDPmQl4hw25ZSJ2fnSFfdmBV9MJWL+BbUpcp6FlJAiBdzdWuhIOTTZcdLrtx6/Vc+MfNXLKvc3eDz9XbnAw6uA=="}]},"_npmUser":{"name":"tdanks2000","email":"tommydanks2000@outlook.com"},"directories":{},"maintainers":[{"name":"tdanks2000","email":"tommydanks2000@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/trakt-wrapper_0.1.0_1778793859640_0.1758067593466741"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-14T21:24:19.548Z","0.1.0":"2026-05-14T21:24:19.790Z","modified":"2026-05-14T21:24:19.987Z"},"maintainers":[{"name":"tdanks2000","email":"tommydanks2000@outlook.com"}],"description":"Type-safe TypeScript client for the Trakt API with OAuth helpers, typed endpoints, pagination, retries, and api-core plugins.","homepage":"https://github.com/Api-Wrappers/trakt-wrapper#readme","keywords":["trakt","trakt-api","trakttv","api-wrapper","api-client","sdk","typescript","type-safe","movies","tv","shows","scrobble","watchlist","nodejs","bun"],"repository":{"type":"git","url":"git+https://github.com/Api-Wrappers/trakt-wrapper.git"},"author":{"name":"api-wrappers"},"bugs":{"url":"https://github.com/Api-Wrappers/trakt-wrapper/issues"},"license":"MIT","readme":"# @api-wrappers/trakt-wrapper\n\n![GitHub Repo stars](https://img.shields.io/github/stars/api-wrappers/trakt-wrapper)\n\nModern TypeScript client for the [Trakt API](https://trakt.docs.apiary.io/).\n\nIt is designed to pair well with `@api-wrappers/tmdb-wrapper`: TMDb covers rich\nmovie and TV metadata, while Trakt covers watch history, watchlists, ratings,\nlists, calendars, scrobbling, and user sync.\n\n## Install\n\n```bash\nbun add @api-wrappers/trakt-wrapper\n```\n\n```bash\nnpm install @api-wrappers/trakt-wrapper\n```\n\n## Quick Start\n\n```ts\nimport { Trakt } from \"@api-wrappers/trakt-wrapper\";\n\nconst trakt = new Trakt({\n\tclientId: process.env.TRAKT_CLIENT_ID,\n\taccessToken: process.env.TRAKT_ACCESS_TOKEN,\n});\n\nconst trending = await trakt.movies.trending({ limit: 10, extended: \"full\" });\n\nfor (const item of trending.data) {\n\tconsole.log(item.watchers, item.movie.title);\n}\n\nconsole.log(trending.pagination.itemCount);\n```\n\n## OAuth\n\n```ts\nconst trakt = new Trakt({\n\tclientId: process.env.TRAKT_CLIENT_ID,\n\tclientSecret: process.env.TRAKT_CLIENT_SECRET,\n\tredirectUri: \"urn:ietf:wg:oauth:2.0:oob\",\n});\n\nconst authorizeUrl = trakt.auth.getAuthorizationUrl({ state: \"state-token\" });\nconsole.log(authorizeUrl);\n\nconst token = await trakt.auth.exchangeCode(\"authorization-code\");\ntrakt.setAccessToken(token.access_token);\n```\n\nDevice code flow is also available:\n\n```ts\nconst code = await trakt.auth.deviceCode();\nconsole.log(code.verification_url, code.user_code);\n\nconst token = await trakt.auth.deviceToken(code.device_code);\n```\n\n## Examples\n\nSearch Trakt by TMDb ID:\n\n```ts\nconst [result] = await trakt.search.id(\"tmdb\", 438631, { type: \"movie\" });\nconsole.log(result.movie?.title);\n```\n\nAdd a TMDb movie to the authenticated user's watchlist:\n\n```ts\nawait trakt.sync.addWatchlist({\n\tmovies: [{ ids: { tmdb: 438631 } }],\n});\n```\n\nScrobble a movie:\n\n```ts\nawait trakt.scrobble.stop({\n\tprogress: 90,\n\tmovie: { ids: { tmdb: 438631 } },\n});\n```\n\nFetch a user's history:\n\n```ts\nconst history = await trakt.users.history(\"me\", \"movies\", undefined, {\n\tlimit: 25,\n});\n\nconsole.log(history.pagination.pageCount);\n```\n\nFetch the authenticated user's movie watchlist:\n\n```ts\nconst watchlist = await trakt.sync.watchlist({\n\ttype: \"movies\",\n\tsort: \"rank\",\n\textended: \"full\",\n});\n```\n\nFetch another user's show watchlist with pagination:\n\n```ts\nconst watchlist = await trakt.users.watchlist(\"sean\", {\n\ttype: \"shows\",\n\tsort: \"added\",\n\tlimit: 20,\n});\n```\n\n## Included Endpoints\n\n- `auth`: OAuth authorization, token exchange, refresh, device flow, revoke\n- `search`: text search and ID lookup\n- `movies`: trending, popular, played, watched, collected, anticipated, details, comments, lists, people, ratings, related, stats, watching\n- `shows`: trending, popular, played, watched, collected, anticipated, details, seasons, comments, lists, people, ratings, related, stats, watching\n- `seasons` and `episodes`: summaries, comments, lists, people, ratings, stats, watching\n- `calendars`: all and authenticated show/movie calendars\n- `users`: profile, watching, watched, history, ratings, watchlist, collection, lists\n- `sync`: last activities, playback, watched, history, collection, watchlist, ratings\n- `scrobble`: start, pause, stop\n- `checkin`: create and remove check-ins\n- `lists`: trending, popular, summary, items, create, update, delete, add/remove items\n\n## Low-Level Requests\n\nUse `trakt.api` when Trakt adds a new endpoint before the wrapper has a typed\nmethod for it.\n\n```ts\nconst data = await trakt.api.get(\"/movies/trending\", {\n\tquery: { limit: 5, extended: \"full\" },\n});\n\nconst page = await trakt.api.paginated(\"/movies/trending\", {\n\tquery: { page: 1, limit: 10 },\n});\n```\n\n## Runtime\n\nThis package uses the shared `@api-wrappers/api-core` HTTP runtime, so custom\n`fetch`, retry configuration, timeouts, transports, and plugins are supported.\n\n```ts\nconst trakt = new Trakt({\n\tclientId: \"client-id\",\n\tfetch: customFetch,\n\tretry: { maxAttempts: 3, delayMs: 250 },\n\ttimeoutMs: 10_000,\n});\n```\n\n## Quality Gates\n\n```bash\nbun run validate\n```\n\n`validate` runs source typechecking, test typechecking, the unit test suite, and\nthe production build.\n","readmeFilename":"README.md","_rev":"1-0e7555ca774fba7ea9dab75d3d6edcef"}