@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
87 lines • 2.89 kB
TypeScript
import { IResult } from '../core/index.js';
import { IFetchClient } from '../core/IFetchClient.js';
import { Service } from '../core/Service.js';
import { IdReference } from '../inventory/index.js';
import { IRule } from './IRule.js';
export declare class SmartRulesService extends Service<IRule> {
private static readonly microserviceName;
protected readonly baseUrl = "service/smartrule";
protected readonly listUrl: any;
private readonly rulesUrl;
private readonly unupdatableFields;
private microserviceAvailable;
private applicationService;
constructor(client: IFetchClient);
/**
* Checks if the smart rules microservice is subscribed and available to user.
*
* **Example**
* ```typescript
*
* (async () => {
* const isAvailable = await smartRulesService.isMicroserviceAvailable();
* })();
* ```
*/
isMicroserviceAvailable(): Promise<boolean>;
/**
* Gets a list of smart rules for given managed object.
*
* @param {IdReference} entityOrId Entity or Id of the ManagedObject.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const id: string = '1';
*
* (async () => {
* const {data, res} = await smartRulesService.listByContext(id);
* })();
* ```
*/
listByContext(entityOrId: IdReference): Promise<IResult<IRule[]>>;
/**
* Deactivates smart rule for given entities list.
*
* @param {Partial<IRule>} rule Smart rule managed object.
* @param {IdReference[]} entitiesOrIdsList List of entities or Id of the ManagedObjects.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const rule: IRule = {id: '1', enabledSources: ['2', '3'],...};
* const entityOrIdList: IdReference[] = ['2'];
* (async () => {
* const {data, res} = await smartRulesService.bulkDeactivateEnabledSources(rule, entityOrIdList);
* })();
* ```
*/
bulkDeactivateEnabledSources(rule: Partial<IRule>, entitiesOrIdsList: IdReference[]): Promise<IResult<IRule>>;
/**
* Updates smart rule.
*
* @param {Parial<IRule>} rule Smart rule managed object.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const rule: IRule = {id: '1', enabledSources: ['2', '3'],...};
* (async () => {
* const {data, res} = await smartRulesService.updateSmartRule(rule);
* })();
* ```
*/
update(rule: Partial<IRule>): Promise<IResult<IRule>>;
private disableEnabledSources;
private getListOfStringIds;
private getSmartRulesUrl;
private removeUnclonableFields;
private contextRulesUrl;
}
//# sourceMappingURL=SmartRulesService.d.ts.map