Cumulocity Web SDK - v1021.62.8
    Preparing search index...

    Class SmartGroupsService

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Creates a smart group managed object with columns configuration.

      Parameters

      Returns Promise<IResult<IManagedObject>>

      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*'] } }] )
    • Removes managed object with given id.

      Parameters

      • entityOrId: IdReference
      • params: any = {}

        Additional query params.

      Returns Promise<IResult<null>>

      Response wrapped in [[IResult]]


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

      (async () => {
      await smartGroupsService.delete(group, params);
      })();
    • Checks whether a given managed object is a smart group

      Parameters

      Returns boolean

      boolean


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

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