{"id":17677510,"url":"https://github.com/dvcol/trakt-http-client","last_synced_at":"2025-05-12T21:29:06.776Z","repository":{"id":239433844,"uuid":"799324191","full_name":"dvcol/trakt-http-client","owner":"dvcol","description":"Fetch based http client for trakt.tv API","archived":false,"fork":false,"pushed_at":"2025-03-25T15:55:43.000Z","size":825,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-27T21:37:51.129Z","etag":null,"topics":["api","client","fetch","http","trakt"],"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/dvcol.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-05-11T19:38:43.000Z","updated_at":"2025-04-23T04:32:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"4472442e-d44e-4ef1-a7f1-35960c4d4ce1","html_url":"https://github.com/dvcol/trakt-http-client","commit_stats":null,"previous_names":["dvcol/trakt-http-client"],"tags_count":31,"template":false,"template_full_name":"dvcol/typescript-lib-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcol%2Ftrakt-http-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcol%2Ftrakt-http-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcol%2Ftrakt-http-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvcol%2Ftrakt-http-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvcol","download_url":"https://codeload.github.com/dvcol/trakt-http-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253824740,"owners_count":21970067,"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","client","fetch","http","trakt"],"created_at":"2024-10-24T07:28:53.976Z","updated_at":"2025-05-12T21:29:06.737Z","avatar_url":"https://github.com/dvcol.png","language":"TypeScript","funding_links":["https://paypal.me/dvcol/5"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e@dvcol/trakt-http-client\u003c/h1\u003e\n\u003cp\u003e\n  \u003cimg src=\"https://img.shields.io/badge/pnpm-%3E%3D9.0.0-blue.svg\" /\u003e\n  \u003cimg src=\"https://img.shields.io/badge/node-%3E%3D20.0.0-blue.svg\" /\u003e\n  \u003ca href=\"https://paypal.me/dvcol/5\" target=\"_blank\"\u003e\n    \u003cimg alt=\"donate\" src=\"https://img.shields.io/badge/Donate%20€-PayPal-brightgreen.svg\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003e Simple fetch based http client for trakt.tv API with full typescript support (request and response).\n\n## Prerequisites\n\n- pnpm \u003e=9.0.0\n- node \u003e=20.0.0\n\n## Install\n\n```sh\npnpm install\n```\n\n## Usage\n\n```sh\npnpm add @dvcol/trakt-http-client\n```\n\n### Modular endpoint bundling\n\nTrakt-http-client is designed to be modular and flexible. Although it uses static classes, endpoints are instantiated at runtime and can be easily omitted, extended or overridden.\nIf your bundler does not support tree-shaking, you can omit unused endpoints by only importing the ones you need.\n\nBy default we provide a [full api](https://github.com/dvcol/trakt-http-client/blob/main/lib/api/trakt-api.endpoints.ts#L25) object with all supported endpoints, as well as a [minimal api](https://github.com/dvcol/trakt-http-client/blob/main/lib/api/trakt-api-minimal.endpoints.ts) object with only the essential authentication endpoints.\nYou can also import any [endpoint by common scope](https://github.com/dvcol/trakt-http-client/tree/main/lib/api/endpoints).\n\n```ts\n\nimport { TraktClient } from '@dvcol/trakt-http-client';\nimport { calendars } from '@dvcol/trakt-http-client/api/calendar';\nimport { episodes } from '@dvcol/trakt-http-client/api/episodes';\nimport { minimalTraktApi } from '@dvcol/trakt-http-client/api/minimal';\n \nimport { Config } from '@dvcol/trakt-http-client/config';\n\nimport type { TraktClientSettings } from '@dvcol/trakt-http-client/models';\n\n\nconst traktUsedApi = {\n  ...minimalTraktApi,\n  calendars,\n  episodes,\n};\n\nconst traktClientSettings: TraktClientSettings = {\n  client_id: '\u003cYour trakt ID\u003e',\n  client_secret: '\u003cYour trakt secret\u003e',\n  redirect_uri: '\u003cYour trakt redirect uri\u003e',\n  endpoint: Config.endpoint.Production,\n\n  useragent: '\u003cYour user Agent\u003e',\n  corsProxy: '\u003cOptional cors Proxy\u003e',\n  corsPrefix: '\u003cOptional cors Proxy prefix\u003e',\n};\n\nconst initAuthentication = {}\n\n\nconst traktClient = new TraktClient(traktClientSettings, initAuthentication, traktUsedApi);\n```\n\n### Features\n\n* [Built-in cache support](https://github.com/dvcol/trakt-http-client/blob/8d9e2fc00154eb50428393cea06b6b69c45282c3/lib/clients/trakt-client.test.ts#L69-L145) (per client, endpoint, or query)\n* [Extensible cache store](https://github.com/dvcol/trakt-http-client/blob/8d9e2fc00154eb50428393cea06b6b69c45282c3/lib/clients/trakt-client.test.ts#L125-L144) (in-memory, local storage, etc.)\n* [Event observer](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/client/base-client.test.ts#L486-L575) (request, query, auth)\n* [Built-in cancellation support](https://github.com/dvcol/base-http-client/blob/ed17c369f3cdf93656568373fc2dba841050e427/lib/client/base-client.test.ts#L691-L758)\n* [Code polling authentication](https://github.com/dvcol/trakt-http-client/blob/8d9e2fc00154eb50428393cea06b6b69c45282c3/lib/clients/trakt-client.test.ts#L147-L237)\n* [Code redirect authentication](https://github.com/dvcol/trakt-http-client/blob/8d9e2fc00154eb50428393cea06b6b69c45282c3/lib/clients/trakt-client.test.ts#L239-L285)\n* [Token refresh](https://github.com/dvcol/trakt-http-client/blob/8d9e2fc00154eb50428393cea06b6b69c45282c3/lib/clients/trakt-client.test.ts#L306-L361)\n\n### Documentation\n\nSee [Trakt API documentation](https://trakt.docs.apiary.io/) for more information.\n\n## Author\n\n* Github: [@dvcol](https://github.com/dvcol)\n\n## 📝 License\n\nThis project is [MIT](https://github.com/dvcol/trakt-http-client/blob/master/LICENSE) licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvcol%2Ftrakt-http-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvcol%2Ftrakt-http-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvcol%2Ftrakt-http-client/lists"}