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

Hierarchy (view full)

Constructors

Properties

queriesUtil: QueriesUtil

Methods

  • Adds an existing managed object as child addition to another managed object (parent)

    Parameters

    • childReference: IdReference
    • parentReference: IdReference

      Example


      const childRef: number = 2;
      const parentReferenceId: number = 1;

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

    Returns Promise<IResult<IIdentified>>

    Response wrapped in [[IResult]]

  • Adds bulk of existing managed objects as child addition to another managed object (parent).

    Parameters

    • childReference: IdReference[]

      List of existing managed objects IDs that should be added to another managed object (parent).

    • parentReference: IdReference

      Example


      const childAdditionsRefIds: string[] = ['2', '3'];
      const parentReferenceId: number = 1;

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

    Returns Promise<IResultList<IIdentified>>

    Response wrapped in array of [[IResult]]

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

    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>>

    Response wrapped in [[IResult]]

  • Gets a list of child additions from a given managed object (parent)

    Parameters

    • parentReference: IdReference
    • filter: object = {}

      Example

         const parentReferenceId: IdReference = 1;

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

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

    Returns Promise<IResultList<IManagedObject>>

    Response wrapped in [[IResultList]]

  • Removes an existing managed object as child addition from another managed object (parent)

    Parameters

    • childReference: IdReference
    • parentReference: IdReference

      Example


      const childRef: number = 2;
      const parentReferenceId: number = 1;

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

    Returns Promise<IResult<null>>

    Response wrapped in [[IResult]]

  • Adds bulk of existing managed objects as child assets to another managed object (parent).

    Parameters

    • childReference: IdReference[]

      List of existing managed objects IDs that should be added to another managed object (parent).

    • parentReference: IdReference

      Example


      const childAssetsRefIds: string[] = ['2', '3'];
      const parentReferenceId: number = 1;

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

    Returns Promise<IResultList<IIdentified>>

    Response wrapped in array of [[IResult]]

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

    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>>

    Response wrapped in [[IResult]]

  • Gets a list of child assets from a given managed object (parent)

    Parameters

    • parentReference: IdReference
    • filter: object = {}

      Example


      const parentReferenceId: IdReference = 1;

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

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

    Returns Promise<IResultList<IManagedObject>>

    Response wrapped in [[IResultList]]

  • Removes an existing managed object as child asset from another managed object (parent)

    Parameters

    • childReference: IdReference
    • parentReference: IdReference

      Example


      const childRef: number = 2;
      const parentReferenceId: number = 1;

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

    Returns Promise<IResult<null>>

    Response wrapped in [[IResult]]

  • Adds bulk of existing managed objects as child devices to another managed object (parent).

    Parameters

    • childReference: IdReference[]

      List of existing managed objects IDs that should be added to another managed object (parent).

    • parentReference: IdReference

      Example


      const childDevicesRefIds: string[] = ['2', '3'];
      const parentReferenceId: number = 1;

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

    Returns Promise<IResultList<IIdentified>>

    Response wrapped in array of [[IResult]]

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

    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>>

    Response wrapped in [[IResult]]

  • Gets a list of child devices from a given managed object (parent)

    Parameters

    • parentReference: IdReference
    • filter: object = {}

      Example


      const parentReferenceId: IdReference = 1;

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

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

    Returns Promise<IResultList<IManagedObject>>

    Response wrapped in [[IResultList]]

  • Removes an existing managed object as child device from another managed object (parent)

    Parameters

    • childReference: IdReference
    • parentReference: IdReference

      Example


      const childRef: number = 2;
      const parentReferenceId: number = 1;

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

    Returns Promise<IResult<null>>

    Response wrapped in [[IResult]]

  • Gets total count of managed objects filtered by parameters.

    Parameters

    • filter: object = {}

      Object containing filters for querying managed objects.

      Example


      const filter: object = {
      type: 'c8y_MQTTDevice'
      };

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

    Returns Promise<IResult<number>>

    Response wrapped in [[IResultList]]

  • Removes managed object with given id.

    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>>

    Response wrapped in [[IResult]]

  • Gets the details of managed object

    Parameters

    • managedObjectOrId: IdReference

      ManagedObject or Id of the ManagedObject.

    • filter: object = {}

      Filter object.

    Returns Promise<IResult<IManagedObject>>

    Response wrapped in [[IResult]]

    Example


    const managedObjId: number = 1;
    const filter = { withChildren: false };

    (async () => {
    const {data, res} = await inventoryService.detail(managedObjId, filter);
    })();
  • Gets an array of measurement series and fragments supported by the specified managedObject.

    Parameters

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

    array of supported measurement series and fragments

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

    Parameters

    Returns Promise<string[]>

    array of supported measurement fragments

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

    Parameters

    Returns Promise<string[]>

    array of supported measurement series

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

    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>>

    Response wrapped in [[IResultList]]

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

    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>>

    Response wrapped in [[IResultList]]