{"_id":"@cinemacove/trakt-client","name":"@cinemacove/trakt-client","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@cinemacove/trakt-client","version":"1.0.0","description":"TypeScript client for the Trakt API.","exports":{".":{"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"}},"./core":{"require":{"types":"./dist/core.d.cts","default":"./dist/core.cjs"},"import":{"types":"./dist/core.d.mts","default":"./dist/core.mjs"}},"./utils":{"require":{"types":"./dist/utils.d.cts","default":"./dist/utils.cjs"},"import":{"types":"./dist/utils.d.mts","default":"./dist/utils.mjs"}}},"imports":{"#core/*":"./src/core/*.ts","#utils/*":"./src/utils/*.ts"},"type":"module","repository":{"type":"git","url":"git+https://github.com/CinemaCove/trakt-client.git"},"keywords":["trakt","api","client","typescript"],"author":{"name":"CinemaCove"},"license":"MIT","bugs":{"url":"https://github.com/CinemaCove/trakt-client/issues"},"homepage":"https://github.com/CinemaCove/trakt-client#readme","dependencies":{"qs":"^6.15.0"},"peerDependencies":{"axios":"^1.13.5"},"gitHead":"1bb0c5b357d73ca5d8a836f320a0fe42fa95dd0e","_id":"@cinemacove/trakt-client@1.0.0","_nodeVersion":"25.4.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-JQ15mfxhNjWKqLnrw/5zTkMgBYLAqTSIskjFFUvKEMElldre+Hj9nCc9wLdcB6kdpG1rf9JuBr+Bc/NCJkelVQ==","shasum":"71e8659bef3114926ef142c18b302b4d19f7910f","tarball":"https://registry.npmjs.org/@cinemacove/trakt-client/-/trakt-client-1.0.0.tgz","fileCount":28,"unpackedSize":516821,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIC30kSbr4shrVJ9msEPs3c60M69aVMRDy4MhJ7NdVXGtAiASHiW9YD/W1YlJ4YHZUkPsdYHE52elULw64igMnMYLmQ=="}]},"_npmUser":{"name":"pfms84","email":"pfms84@gmail.com"},"directories":{},"maintainers":[{"name":"pfms84","email":"pfms84@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/trakt-client_1.0.0_1771559359768_0.7308514912302082"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-20T03:49:19.365Z","1.0.0":"2026-02-20T03:49:19.973Z","modified":"2026-02-20T03:49:20.170Z"},"maintainers":[{"name":"pfms84","email":"pfms84@gmail.com"}],"description":"TypeScript client for the Trakt API.","homepage":"https://github.com/CinemaCove/trakt-client#readme","keywords":["trakt","api","client","typescript"],"repository":{"type":"git","url":"git+https://github.com/CinemaCove/trakt-client.git"},"author":{"name":"CinemaCove"},"bugs":{"url":"https://github.com/CinemaCove/trakt-client/issues"},"license":"MIT","readme":"# @cinemacove/trakt-client\r\n\r\nTypeScript client for the [Trakt API](https://trakt.docs.apiary.io/), with automatic camelCase conversion, dual CJS/ESM output, and full type coverage.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @cinemacove/trakt-client axios\r\n```\r\n\r\n> `axios` is a peer dependency.\r\n\r\n## Usage\r\n\r\n```typescript\r\nimport { TraktClient } from '@cinemacove/trakt-client';\r\n\r\nconst trakt = new TraktClient({\r\n    clientId: 'your_client_id',\r\n    // accessToken: 'your_oauth_token', // optional, required for authenticated endpoints\r\n});\r\n```\r\n\r\n### Public endpoints (client ID only)\r\n\r\n```typescript\r\n// Movies\r\nconst trending = await trakt.movies.getTrending({ limit: 10 });\r\nconst movie = await trakt.movies.getMovie('the-dark-knight-2008');\r\nconst ratings = await trakt.movies.getRatings('the-dark-knight-2008');\r\n\r\n// Shows\r\nconst shows = await trakt.shows.getTrending({ limit: 10 });\r\nconst show = await trakt.shows.getShow('breaking-bad');\r\n\r\n// Seasons & Episodes\r\nconst seasons = await trakt.seasons.getSeasons('breaking-bad');\r\nconst episode = await trakt.episodes.getEpisode('breaking-bad', 1, 1);\r\n\r\n// People\r\nconst person = await trakt.people.getPerson('bryan-cranston');\r\nconst credits = await trakt.people.getMovieCredits('bryan-cranston');\r\n\r\n// Search\r\nconst results = await trakt.search.textSearch('movie', 'batman begins', { limit: 5 });\r\nconst lookup = await trakt.search.idLookup('imdb', 'tt0372784');\r\n\r\n// Calendars (public)\r\nconst airingShows = await trakt.calendars.getAllShows('2024-01-08', 7);\r\nconst releasingMovies = await trakt.calendars.getAllMovies('2024-01-08', 7);\r\n\r\n// Comments, Lists, Countries, Languages, Networks, Genres, Certifications...\r\nconst genres = await trakt.genres.getMovieGenres();\r\nconst networks = await trakt.networks.getNetworks();\r\nconst countries = await trakt.countries.getMovieCountries();\r\n```\r\n\r\n### Authenticated endpoints (OAuth access token)\r\n\r\n```typescript\r\nconst trakt = new TraktClient({\r\n    clientId: 'your_client_id',\r\n    accessToken: 'your_oauth_access_token',\r\n});\r\n\r\n// Sync — your watch data\r\nconst lastActivities = await trakt.sync.getLastActivities();\r\nconst watchedMovies = await trakt.sync.getWatchedMovies();\r\nconst history = await trakt.sync.getHistory('movies', undefined, { limit: 20 });\r\nconst ratings = await trakt.sync.getRatings('movies');\r\nconst watchlist = await trakt.sync.getWatchlist('movies');\r\n\r\n// Users\r\nconst settings = await trakt.users.getSettings();\r\nconst profile = await trakt.users.getProfile('me');\r\nconst myLists = await trakt.users.getLists('me');\r\n\r\n// Recommendations\r\nconst recommended = await trakt.recommendations.getMovies();\r\n```\r\n\r\n### OAuth / Device authentication flow\r\n\r\n```typescript\r\n// 1. Request a device code\r\nconst deviceCode = await trakt.authentication.getDeviceCode(clientId);\r\nconsole.log(`Go to ${deviceCode.verificationUrl} and enter ${deviceCode.userCode}`);\r\n\r\n// 2. Poll until the user authorises\r\nconst token = await trakt.authentication.pollDeviceToken({\r\n    clientId,\r\n    clientSecret,\r\n    deviceCode: deviceCode.deviceCode,\r\n});\r\n\r\n// 3. Use the access token\r\nconst authedClient = new TraktClient({ clientId, accessToken: token.accessToken });\r\n```\r\n\r\n## Extended info\r\n\r\nMost endpoints accept an `extended` option:\r\n\r\n```typescript\r\nconst movie = await trakt.movies.getMovie('the-dark-knight-2008', { extended: 'full' });\r\n// movie.overview, movie.runtime, movie.rating, etc.\r\n\r\nconst person = await trakt.people.getPerson('bryan-cranston', { extended: 'full' });\r\n// person.biography, person.birthday, etc.\r\n```\r\n\r\n## Filters\r\n\r\nMovie/show list endpoints accept filter options:\r\n\r\n```typescript\r\nconst action = await trakt.movies.getTrending({\r\n    genres: ['action', 'thriller'],\r\n    years: '2020-2024',\r\n    limit: 20,\r\n});\r\n```\r\n\r\n## Features\r\n\r\n- **21 API groups** — Movies, Shows, Seasons, Episodes, People, Search, Calendars, Comments, Lists, Sync, Users, Certifications, Genres, Languages, Countries, Networks, Notes, Recommendations, Scrobble, Checkin, Authentication\r\n- **Automatic camelCase conversion** — Trakt's snake_case responses are transparently converted\r\n- **Dual CJS + ESM output** with `.d.ts` declarations\r\n- **Strict TypeScript** — all endpoints and response shapes are fully typed\r\n- **No magic** — thin wrapper around axios with predictable behaviour\r\n\r\n## Development\r\n\r\n```bash\r\n# Install dependencies\r\nnpm install\r\n\r\n# Typecheck\r\nnpm run typecheck\r\n\r\n# Build (CJS + ESM)\r\nnpm run build\r\n\r\n# Integration tests (requires a .env file — see .env.example)\r\nnpx vitest run\r\n```\r\n\r\n### Running integration tests\r\n\r\nCopy `.env.example` to `.env` and fill in your credentials:\r\n\r\n```env\r\nTRAKT_CLIENT_ID=your_client_id_here\r\nTRAKT_ACCESS_TOKEN=your_access_token_here   # optional, needed for sync/user tests\r\n```\r\n\r\nGet a client ID from [trakt.tv/oauth/applications](https://trakt.tv/oauth/applications).\r\n\r\n## License\r\n\r\nMIT\r\n","readmeFilename":"README.md","_rev":"1-8967942ce188eaa0a25eb9dc3f96bc8d"}