@kodira/omlox-client-typescript-angular
v0.1.1
Published
TypeScript Angular client for the OMLOX Hub API 2.0
Readme
Omlox Angular Client
A TypeScript Angular client for the omlox Hub API with Bearer authentication support.
Features
- Native Angular services using HttpClient
- Bearer token authentication
- Full TypeScript support with typed models
- Observable-based API
Installation
npm install @kodira/omlox-client-typescript-angularUsage
1. Provide the services (recommended for modern Angular)
import { bootstrapApplication } from '@angular/platform-browser'
import { provideOmloxClient } from '@kodira/omlox-client-typescript-angular'
import { AppComponent } from './app/app.component'
bootstrapApplication(AppComponent, {
providers: [
provideOmloxClient({
baseUrl: 'https://your-omlox-hub.com/api',
}),
],
})1. Alternative: Import the module (legacy)
import { OmloxClientModule } from '@kodira/omlox-client-typescript-angular'
@NgModule({
imports: [
OmloxClientModule.forRoot({
baseUrl: 'https://your-omlox-hub.com/api',
}),
],
})
export class AppModule {}2. Use in your services
import { Injectable, inject } from '@angular/core'
import { Observable } from 'rxjs'
import { OmloxTrackablesService, OmloxBaseService, Trackable } from '@kodira/omlox-client-typescript-angular'
@Injectable()
export class YourService {
private trackablesService = inject(OmloxTrackablesService)
private baseService = inject(OmloxBaseService)
setupAuth(token: string): void {
this.baseService.setBearerToken(token)
}
getTrackables(): Observable<Trackable[]> {
return this.trackablesService.getAllTrackables()
}
}Available Services
OmloxTrackablesService- Trackable managementOmloxFencesService- Fence and collision managementOmloxZonesService- Zone managementOmloxProvidersService- Location provider managementOmloxBaseService- Base service with authentication
Authentication
The client uses Bearer token authentication. Set the token using:
baseService.setBearerToken('your-jwt-token')The token will be automatically included in all subsequent API requests.
Models
All omlox data models are fully typed:
import { Trackable, Fence, Zone, Location, TrackableMotion } from '@kodira/omlox-client-typescript-angular'