This class allows for managing managed objects and different child types, see ChildType.

Hierarchy

Constructors

Properties

queriesUtil: QueriesUtil

Methods

  • Creates a new managed object as child addition to another managed object (parent)

    Returns

    Response wrapped in IResult

    Parameters

    • managedObject: Partial<IManagedObject>
    • parentReference: IdReference

      Example


      const mOAsChildAddition: Partial<IManagedObject> = {
      name: 'Child addition MO',
      type: 'new type',
      ...
      };

      // This is the identifier of the managed object which should be the parent of
      // mOAsChildAddition, see above.
      const parentReferenceId: number = 1;

      (async () => {
      const {data, res} = await inventoryService.childAdditionsCreate(mOAsChildAddition, parentReferenceId);
      })();

    Returns Promise<IResult<IIdentified>>

  • Creates a new managed object as child asset to another managed object (parent)

    Returns

    Response wrapped in IResult

    Parameters

    • managedObject: Partial<IManagedObject>
    • parentReference: IdReference

      Example


      const mOAsChildAsset: Partial<IManagedObject> = {
      name: 'Child asset MO',
      type: 'new type',
      ...
      };

      // This is the identifier of the managed object which should be the parent of
      // mOAsChildAsset, see above.
      const parentReferenceId: number = 1;

      (async () => {
      const {data, res} = await inventoryService.childAdditionsCreate(mOAsChildAddition, parentReferenceId);
      })();

    Returns Promise<IResult<IIdentified>>

  • Creates a new managed object as child device to another managed object (parent)

    Returns

    Response wrapped in IResult

    Parameters

    • managedObject: Partial<IManagedObject>
    • parentReference: IdReference

      Example


      const mOAsChildDevice: Partial<IManagedObject> = {
      name: 'Child device MO',
      type: 'new type',
      ...
      };

      // This is the identifier of the managed object which should be the parent of
      // mOAsChildDevice, see above.
      const parentReferenceId: number = 1;

      (async () => {
      const {data, res} = await inventoryService.childDevicesCreate(mOAsChildDevice, parentReferenceId);
      })();

    Returns Promise<IResult<IIdentified>>

  • Removes managed object with given id.

    Returns

    Response wrapped in IResult

    Parameters

    • managedObjectOrId: IdReference

      ManagedObject or Id of the ManagedObject.

    • params: any = {}

      Additional query params.

      Example


      const managedObjectId: number = 1;
      const params: any = {
      cascade: true
      }

      (async () => {
      const {data, res} = await inventoryService.delete(managedObjectId, params);
      })();

    Returns Promise<IResult<null>>

  • Gets an array of measurement series and fragments supported by the specified managedObject.

    Returns

    array of supported measurement series and fragments

    Parameters

    Returns Promise<{
        fragment: string;
        series: string;
    }[]>

  • Gets an array of measurement fragments supported by the specified managedObject. e.g. ["c8y_Temperature", "c8y_Humidity"]

    Returns

    array of supported measurement fragments

    Parameters

    Returns Promise<string[]>

  • Gets the list of all managed objects filtered and sorted by given query.

    Returns

    Response wrapped in IResultList

    Parameters

    • query: any
    • filter: object = {}

      Object containing filters for querying managed objects.

      Example


      const filter: object = {
      pageSize: 100,
      withTotalPages: true
      };

      const query = {
      name: 'MY-NAM*'
      }

      (async () => {
      const {data, res, paging} = await inventoryService.listQuery(query, filter);
      })();

    Returns Promise<IResultList<IManagedObject>>

  • Gets the list of all devices filtered and sorted by given query.

    Returns

    Response wrapped in IResultList

    Parameters

    • query: any
    • filter: object = {}

      Object containing filters for querying devices.

      Example


      const filter: object = {
      pageSize: 100,
      withTotalPages: true
      };

      const query = {
      name: 'MY-NAM*'
      }

      (async () => {
      const {data, res, paging} = await inventoryService.listQueryDevices(query, filter);
      })();

    Returns Promise<IResultList<IManagedObject>>