Hierarchy

Constructors

Methods

  • Creates a smart group managed object with columns configuration.

    Returns

    Response wrapped in IResult

    Example


    const smartGroup = { name: 'newName', type: 'c8y_DynamicGroup', c8y_IsDynamicGroup: {} };
    const deviceQueryString = 'c8y_DeviceQueryString: "$filter=(name eq 'test*') $orderby=c8y_Hardware.model asc';
    const configurableColumns = [
    {headerName: 'Status', active: false, key: 'status'},
    {headerName: 'Name', active: true, key: 'name', filter: { externalFilterQuery: { name: { names: ['test*'] } } }},
    {headerName: 'Model', active: true, key: 'model'}
    ];

    (async () => {
    await smartGroupsService.create({ smartGroup, deviceQueryString, configurableColumns });
    })();

    Note: filterConfig has been removed as a default property to the input object.
    Now it is part of the configurable columns properties as it is shown above.
    You can still pass it as an optional parameter.
    ( const filterConfig = [{ name: { names: ['test*'] } }] )

    Parameters

    Returns Promise<IResult<IManagedObject>>

  • Removes managed object with given id.

    Returns

    Response wrapped in IResult

    Example


    const group = { id: '1' } as IManagedObject;
    const params: any = {
    withChildren: false
    }

    (async () => {
    await smartGroupsService.delete(group, params);
    })();

    Parameters

    • entityOrId: IdReference
    • params: any = {}

      Additional query params.

    Returns Promise<IResult<null>>

  • Checks whether a given managed object is a smart group

    Returns

    boolean

    Example


    const mo: IManagedObject = {id: 1, type: "c8y_DeviceGroup", c8y_IsDeviceGroup: {}} as IManagedObject;

    (() => {
    const isSmartGroup = smartGroupsService.isSmartGroup(mo);
    })();

    Parameters

    Returns boolean

  • Checks whether a given managed object is a smart group v2

    Returns

    boolean

    Example


    const mo: IManagedObject = {id: 1, type: "c8y_DeviceGroup", c8y_IsDeviceGroup: {}} as IManagedObject;

    (() => {
    const isSmartGroup = smartGroupsService.isSmartGroupV2(mo);
    })();

    Parameters

    Returns boolean