$ npm i @evva/nest-xs3-api-client
Client implementation for the Xesar 3 MQTT api interface.
# Nest Build
$ nest build
import { ClientService } from '@evva/nest-xs3-api-client';
@Module({
imports: [
ClientModule.forRootAsync({
imports: [],
inject: [],
useFactory: () => {
const cert = fs.readFileSync('conf/cert.pem', 'utf-8');
const certCA = fs.readFileSync('conf/cert_ca.pem', 'utf-8');
const key = fs.readFileSync('conf/pk.pem', 'utf-8');
return {
host: '127.0.0.1',
port: 1883,
cert: cert,
certCA: certCA,
key: key,
clientId: 'clientId',
token: 'token',
};
},
}),
],
providers: [AppService],
})
export class AppModule {}
Query specific resources from the Xesar API with support for pagination and filters.
import { ClientService } from '@evva/nest-xs3-api-client';
@Injectable()
export class AppService {
constructor(private readonly clientService: ClientService) {}
async queryComponents() {
let result = await this.clientService.queryPaged({
res: 'evva-components',
limit: 5,
offset: 0,
filters: [
{
type: 'eq',
field: 'status',
value: 'Synced',
},
],
});
}
}
You can auto-paginate all results by omitting the
limit
andoffset
properties.
A few of the supported resources are:
export type Resource =
| 'identification-media'
| 'authorization-profiles'
| 'access-protocol'
| 'persons'
| 'installation-points'
| 'evva-components'
| 'office-modes'
| 'time-profiles'
| 'zones';
Execute specific CQRS commands on the Xesar API.
import { ClientService } from '@evva/nest-xs3-api-client';
@Injectable()
export class AppService {
constructor(private readonly clientService: ClientService) {}
async remoteDisengage() {
let result = await this.clientService.remoteDisengageCommand(
'a034bfda-c569-49a0-a3ba-d438d65eeb34',
false,
);
}
}
Proprietary