{"id":24455419,"url":"https://github.com/reactwaylabs/api-builder","last_synced_at":"2025-12-28T17:44:55.343Z","repository":{"id":40748921,"uuid":"179532376","full_name":"reactwaylabs/api-builder","owner":"reactwaylabs","description":"An easy api client builder for applications with identity.","archived":false,"fork":false,"pushed_at":"2023-01-03T19:06:56.000Z","size":960,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-13T23:45:53.340Z","etag":null,"topics":["api-builder","api-client","identity-client","oauth2"],"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/reactwaylabs.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}},"created_at":"2019-04-04T16:07:04.000Z","updated_at":"2021-11-29T19:19:46.000Z","dependencies_parsed_at":"2023-02-01T09:00:23.860Z","dependency_job_id":null,"html_url":"https://github.com/reactwaylabs/api-builder","commit_stats":null,"previous_names":["reactway/api-builder"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactwaylabs%2Fapi-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactwaylabs%2Fapi-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactwaylabs%2Fapi-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactwaylabs%2Fapi-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactwaylabs","download_url":"https://codeload.github.com/reactwaylabs/api-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243500781,"owners_count":20300771,"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-builder","api-client","identity-client","oauth2"],"created_at":"2025-01-21T02:13:22.618Z","updated_at":"2025-12-28T17:44:50.294Z","avatar_url":"https://github.com/reactwaylabs.png","language":"TypeScript","readme":"[![NPM version](https://img.shields.io/npm/v/@reactway/api-builder.svg?logo=npm)](https://www.npmjs.com/package/@reactway/api-builder)\n[![Build Status](https://img.shields.io/azure-devops/build/reactway/reactway/7/master.svg?logo=azuredevops)](https://dev.azure.com/reactway/ReactWay/_build?definitionId=7)\n[![Code coverage](https://img.shields.io/azure-devops/coverage/reactway/reactway/7/master.svg)](https://dev.azure.com/reactway/ReactWay/_build?definitionId=7)\n[![Dependencies](https://img.shields.io/david/reactway/api-builder.svg)](https://david-dm.org/reactway/api-builder)\n[![Dev dependencies](https://img.shields.io/david/dev/reactway/api-builder.svg)](https://david-dm.org/reactway/api-builder?type=dev)\n\n# @reactway/api-builder\n\nAn easy api client builder for applications with identity.\n\n## Features\n\n-   API builder is ready for SPA development\n-   OAuth identity mechanism included\n\n## Get started\n\n```sh\n$ npm install @reactway/api-builder\n```\n\nTo start using api builder first it needs to make an `ApiConfiguration` with structure (**host** field is **required**). Then initiate class with created configuration.\n\n```ts\ninterface ApiConfiguration {\n    host: string;\n    path?: string;\n    defaultHeaders?: { [index: string]: string };\n    defaultAuthRequired?: boolean;\n    identity?: IdentityMechanism;\n    defaultQueryParams?: QueryParams;\n    requestQueueLimit?: number;\n}\n\nconst apiConfiguration: ApiConfiguration = {\n    host: \"https://example.com\"\n};\n\nconst ApiClient = new ApiBuilder(apiConfiguration);\n```\n\nTo make request you have create an `ApiRequest` typed object or arrow function if you want to pass parameters. `method` and `requestPath` fields are **required** for `ApiRequest`.\n\n```ts\nconst getExample: ApiRequest = {\n    method: HttpMethods.GET\n    requestPath: PATH_GET\n};\n\nconst getExample = (id: number): ApiRequest =\u003e {\n    return {\n        method: HttpMethods.GET,\n        requestPath: `/${id}`\n    };\n};\n```\n\nOnly http(s) method `GET` does not take `body` param. Rest of methods takes passed typed `body`. To pass typed `body` to a request here is an example.\n\n```ts\ninterface Person {\n    name: string;\n    surname: string;\n}\n\nconst getExample = await apiBuilder.post\u003cPerson\u003e({\n    requestPath: \"/post\",\n    body: {\n        name: \"John\",\n        surname: \"Snow\"\n    }\n});\n```\n\nAlso you can pass `QueryParams`.\n\n```ts\ntype QueryParams = { [key: string]: string | number | Array\u003cstring | number\u003e };\n\nconst getExample: ApiRequest = {\n    method: HttpMethods.GET\n    requestPath: PATH_GET,\n    queryParams: {\n        page: 2\n    }\n};\n```\n\n## API\n\nWIP\n\n## Documentation\n\nWIP\n\n## License\n\nReleased under the [MIT license](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactwaylabs%2Fapi-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactwaylabs%2Fapi-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactwaylabs%2Fapi-builder/lists"}