{"id":15958946,"url":"https://github.com/kaosdev/rest-angular","last_synced_at":"2026-01-11T02:51:51.940Z","repository":{"id":34093941,"uuid":"168602865","full_name":"kaosdev/rest-angular","owner":"kaosdev","description":"An Angular Http Client for fast Rest APIs","archived":false,"fork":false,"pushed_at":"2023-01-04T21:52:54.000Z","size":1489,"stargazers_count":0,"open_issues_count":10,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-07T02:03:41.357Z","etag":null,"topics":["angular","http-client","rest-api","restful"],"latest_commit_sha":null,"homepage":null,"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/kaosdev.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-01-31T21:53:49.000Z","updated_at":"2021-02-10T22:13:31.000Z","dependencies_parsed_at":"2023-01-15T04:45:29.930Z","dependency_job_id":null,"html_url":"https://github.com/kaosdev/rest-angular","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosdev%2Frest-angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosdev%2Frest-angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosdev%2Frest-angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaosdev%2Frest-angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaosdev","download_url":"https://codeload.github.com/kaosdev/rest-angular/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246290583,"owners_count":20753724,"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":["angular","http-client","rest-api","restful"],"created_at":"2024-10-07T14:21:33.688Z","updated_at":"2026-01-11T02:51:51.934Z","avatar_url":"https://github.com/kaosdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rest Angular Decorators\n\u003e Build fast REST APIs using decorators\n\n## Getting Started\n\n### Installing\n\n```\nnpm install rest-angular-decorators\n```\n\n### Basic Usage\n\nCreate a new service that extends RestAngularClient.\nDeclare methods, parameters and base url.\n\n```typescript\n@Injectable({\n  providedIn: 'root'\n})\n@BaseUrl('https://jsonplaceholder.typicode.com')\n@DefaultHeaders({\n  Accept: 'text/html'\n})\nexport class TestService extends RestAngularClient {\n\n  // Path parameters\n  @GET('todos/:id')\n  getTodo(\n    @Path('id') id: number\n  ): Observable\u003cany\u003e { return null; }\n\n  // Body\n  @POST('todos')\n  createTodo(\n    @Body: todo: any\n  ): Observable\u003cany\u003e { return null; }\n  \n  // Query parameters\n  @GET('todos')\n  getTodos(\n    @Query('limit') limit: number,\n    @QueryMap otherFilters: object\n  ): Observable\u003cany[]\u003e { return null }\n}\n```\n\nThen in component just use the service\n\n```typescript\n@Component({\n  template: `\u003ch1\u003e{{ todoTitle$ | async }}\u003c/h1\u003e`\n})\nclass TestComponent {\n  todoTitle$ = this.testService.getTodo(42).pipe(\n    map(todo =\u003e todo.title)\n  );\n  \n  constructor(\n    private readonly testService: TestService\n  ) {\n  }\n}\n```\n\n## Features\n\n- All rest methods: @GET, @POST, @PUT, @PATCH, @DELETE\n- Body parameter: @Body\n- Path parameters: @Path\n- Query parameters: @Query, @QueryMap\n- Base url: @BaseUrl or by Injection of REST_BASE_URL\n- Headers: @DefaultHeaders\n\n## Customization\n\nWhat if you don't like to write url like these `GET('path/:id')`?\nWhat if you like curly braces a lot?\n\nJust add this provider in AppModule and you can use paths with style `GET('path/{id}')`\n```typescript\n{provide: PathParserFactory, useClass: CurlyPathParserFactory}\n```\n\nYou can also provide your own factories for:\n- PathParserFactory \n- BodyParserFactory\n- QueryParserFactory\n\n## Roadmap\n\n- @Headers method decorator\n- @Header \u0026 @HeaderMap parameter decorator\n\n## Contribute\n\nEvery contribution is really appreciated.\n\n## License\n\nRest Angular Decorators is released under the MIT license. [Read license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaosdev%2Frest-angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaosdev%2Frest-angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaosdev%2Frest-angular/lists"}