Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OperationService

This class allows for managing operations on a device.

Hierarchy

Index

Constructors

Methods

Constructors

constructor

Methods

create

  • Creates a new operation.

    example
    
     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);
     })();
    

    Parameters

    • entity: IOperation

      Operation object with mandantory fragments.

    Returns Promise<IResult<IOperation>>

    Response wrapped in IResult

detail

  • Gets the details of selected operation.

    example
    
       const operationId: number = 1;
    
       (async () => {
         const {data, res} = await operationService.detail(operationId);
      })();
    

    Parameters

    • entityOrId: string | number | IIdentified

      Entity or Id of the entity.

    Returns Promise<IResult<IOperation>>

    Response wrapped in IResult

list

  • Gets the list of operations filtered by parameters.

    example
    
     const filter: object = {
        pageSize: 100,
        withTotalPages: true
      };
    
      (async () => {
        const {data, res, paging} = await operationService.list(filter);
      })();
    

    Parameters

    • Default value filter: object = {}

      Object containing filters for querying operations.

    Returns Promise<IResultList<IOperation>>

    Response wrapped in IResultList

update

  • Updates operation data.

    example
    
     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);
     })();
    

    Parameters

    • entity: Partial<IOperation>

      Operation is partially updatable.

    Returns Promise<IResult<IOperation>>

    Response wrapped in IResult

Generated using TypeDoc