{"id":14986587,"url":"https://github.com/henrycunh/open-client","last_synced_at":"2025-04-11T21:31:23.994Z","repository":{"id":117038894,"uuid":"534811579","full_name":"henrycunh/open-client","owner":"henrycunh","description":"🖇 Create a HTTP Client/SDK from your API, fully-typed and with amazing DX ","archived":false,"fork":false,"pushed_at":"2022-10-13T05:09:31.000Z","size":76,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T16:13:57.824Z","etag":null,"topics":["client","dx","http","open-api","typescript","vite"],"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/henrycunh.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-09-09T21:30:13.000Z","updated_at":"2023-07-14T05:59:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"ddf1674b-7992-400e-9503-8ac84b09283d","html_url":"https://github.com/henrycunh/open-client","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"7d799ebf7be3605db811d570bf71a40751d713bb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fopen-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fopen-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fopen-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henrycunh%2Fopen-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henrycunh","download_url":"https://codeload.github.com/henrycunh/open-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248482942,"owners_count":21111404,"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":["client","dx","http","open-api","typescript","vite"],"created_at":"2024-09-24T14:13:11.155Z","updated_at":"2025-04-11T21:31:23.547Z","avatar_url":"https://github.com/henrycunh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# open-client\n\n[![npm](https://img.shields.io/npm/v/vite-plugin-open-client.svg)](https://www.npmjs.com/package/vite-plugin-open-client)\n\n\u003e Provides a fully typed HTTP client based on a OpenAPI specification\n\n\u0026nbsp;\n\n### install\n```\npnpm i -D vite-plugin-open-client\n```\n\n### use it\n\n##### `vite.config.ts`\n```ts\nimport OpenClient from 'vite-plugin-open-client'\n\nexport default {\n    plugins: [\n        OpenClient({\n            definition: 'https://petstore.swagger.io/v2/swagger.json',\n            apiName: 'petstore'\n        })\n    ]\n}\n```\n\n##### `main.ts`\n```ts\nimport { defineClient } from 'api:petstore'\nimport type { APISchema } from 'api:petstore'\n\nconst client = defineClient({\n    baseUrl: 'https://api.petstore.com/',\n    headers: {\n        Apikey: 'my-api-key'\n    }\n})\n\n// You can either alias the operations\nconst getPetById = client('/pet/{petId}', 'get')\nconst createPet = client('/pet', 'post')\nconsole.log(\n  await getPetById({ \n    path: { petId: 1 } \n  })\n)\n\n// You can borrow type definitions from the specification\nconst pet: APISchema\u003c'Pet'\u003e = {\n  name: 'dog',\n  photoUrls: ['https://example.com/dog.jpg'],\n}\nawait createPet({ body: { body: pet }})\n\n// Or call them directly through path\nawait client('/pet/{petId}', 'delete')({ \n  path: { petId: 1 } \n})\n\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrycunh%2Fopen-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenrycunh%2Fopen-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenrycunh%2Fopen-client/lists"}