@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
105 lines • 3.01 kB
TypeScript
import { IIdentified, Service, IResult, IResultList } from '../core/index.js';
import { IOperation } from './IOperation.js';
/**
* This class allows for managing operations on a device.
*/
export declare class OperationService extends Service<IOperation> {
protected baseUrl: string;
protected listUrl: string;
protected propertyName: string;
/**
* Gets the details of selected operation.
*
* @param {string|number|IIdentified} entityOrId Entity or Id of the entitytabs.service.ts.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const operationId: number = 1;
*
* (async () => {
* const {data, res} = await operationService.detail(operationId);
* })();
* ```
*/
detail(entityOrId: string | number | IIdentified): Promise<IResult<IOperation>>;
/**
* Creates a new operation.
*
* @param {IOperation} entity Operation object with mandantory fragments.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const mandantoryObject: IOperation = {
* com_cumulocity_model_WebCamDevice: {
* name: 'take picture',
* parameters: {
* duration: '5s',
* quality: 'HD'
* }
* },
* deviceId: device.id,
* };
*
* (async () => {
* const {data, res} = await operationService.create(mandantoryObject);
* })();
* ```
*/
create(entity: IOperation): Promise<IResult<IOperation>>;
/**
* Updates operation data.
*
* @param {Partial<IOperation>} entity Operation is partially updatable.
*
* @returns Response wrapped in [[IResult]]
*
* **Example**
* ```typescript
*
* const partialUpdateObject: Partial<IOperation> = {
* com_cumulocity_model_WebCamDevice: {
* name: 'take picture',
* parameters: {
* duration: '2s',
* quality: 'HD',
* ratio: '16:9'
* }
* },
* deviceId: device.id,
* };
*
* (async () => {
* const {data, res} = await operationService.update(partialUpdateObject);
* })();
* ```
*/
update(entity: Partial<IOperation>): Promise<IResult<IOperation>>;
/**
* Gets the list of operations filtered by parameters.
*
* @returns Response wrapped in [[IResultList]]
*
* @param {object} filter Object containing filters for querying operations.
*
* **Example**
* ```typescript
*
* const filter: object = {
* pageSize: 100,
* withTotalPages: true
* };
*
* (async () => {
* const {data, res, paging} = await operationService.list(filter);
* })();
* ```
*/
list(filter?: object): Promise<IResultList<IOperation>>;
}
//# sourceMappingURL=OperationService.d.ts.map