Class OperationBulkService

This class allows for managing bulk operations.

Hierarchy (view full)

Constructors

Methods

  • Creates a new operation.

    Parameters

    • operation: Partial<IOperationBulk>

      Operation object with mandantory fragments.

    Returns Promise<IResult<IOperationBulk>>

    Response wrapped in [[IResult]]

    Example


    const mandantoryObject: Partial<IOperationBulk> = {
    creationRamp: 15,
    groupId: '149044',
    operationPrototype: {
    c8y_Restart: {},
    description: 'Restart device',
    deviceId: device.id,
    status: 'PENDING'
    },
    startDate: '2018-02-15T16:01:00.000Z'
    };

    (async () => {
    const {data, res} = await operationBulkService.create(mandantoryObject);
    })();
  • Removes an bulk operation with given id.

    Parameters

    • operationOrId: string | number | IIdentified

      Operation object or id.

      Example


      const id: number = 1;

      (async () => {
      const {data, res} = await operationBulkService.delete(id);
      })();

    Returns Promise<IResult<null>>

    Response wrapped in [[IResult]]

  • Updates a new operation.

    Parameters

    Returns Promise<IResult<IOperationBulk>>

    Response wrapped in [[IResult]]

    Example


    const updateObject: Partial<IOperationBulk> = {
    creationRamp: 15,
    groupId: '149044',
    operationPrototype: {
    c8y_Restart: {},
    description: 'Restart device',
    deviceId: device.id,
    status: 'PENDING'
    },
    startDate: '2018-02-15T16:01:00.000Z'
    };

    (async () => {
    const {data, res} = await operationBulkService.update(updateObject);
    })();