@del-internet/sdk-cpe
v1.1.0
Published
TypeScript SDK to interact with ACS services.
Downloads
87
Readme
CPE & ACS
This package written to work with Delinternet ACS service. the package contains only devices
API's.
Usage
To use the package in you project do it like so:
import factory from '@del-internet/sdk-cpe';
const ACS = factory({ endpoint: 'acs.example.com' });
await ACS.devices.all() // to list all devices
await ACS.devices.find('device_id') // to get device by its id
...
Extending
to add more collection API you could create another collection like so:
///
...
import Collection from '../Collection';
export default class Tasks extends Collection<Task> {
/**
* Get collection uri.
*/
protected abstract collection(): string {
return 'tasks'
}
}
then export you endpoint in index.ts
:
export const factory = (config: Config) => {
const client = new Client(config);
const devices = new Devices(client);
const tasks = new Tasks(client);
return { client, devices, tasks };
};