ngx-auto-api-decorators
v1.0.2
Published
Runtime decorator-based, type-safe API clients for Angular (DI + caching + offline queue).
Maintainers
Readme
ngx-auto-api-decorators
Runtime decorator-based API client for Angular. Define API classes with decorators — no manual HttpClient wiring.
Install
npm i ngx-auto-api-decoratorsQuick example
import { Injector } from '@angular/core';
import { ApiClient } from 'ngx-auto-api-decorators';
import { Get, Post } from 'ngx-auto-api-decorators';
import { Observable } from 'rxjs';
@ApiClient('/api/users')
export class UserApi {
constructor(public injector: Injector) {}
@Get('/:id') getById(id: number): Observable<User>;
@Get('/') getAll(): Observable<User[]>;
@Post('/') create(u: User): Observable<User>;
}Features
- @ApiClient class decorator
- @Get/@Post/@Put/@Delete method decorators
- Path param substitution
- Basic dev logging and cacheSeconds option
- In-memory cache with TTL
- Offline queue for mutating requests (POST/PUT/DELETE) that retries when connectivity returns
