Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DigitalTwinsClient

Package version

Client for Azure IoT DigitalTwins API.

Hierarchy

  • DigitalTwinsClient

Index

Constructors

constructor

  • Creates an instance of AzureDigitalTwinsAPI.

    Example usage:

    const { DigitalTwinsClient, ServiceClientCredentials } = require("@azure/digital-twins-core");
    
    const client = new DigitalTwinsClient(
      "<endpoint>",
      new DefaultAzureCredential();
    );

    Parameters

    • endpointUrl: string

      The endpoint URL of the service.

    • credential: TokenCredential

      Used to authenticate requests to the service.

    • Default value options: DigitalTwinsClientOptions = {}

      Used to configure the service client.

    Returns DigitalTwinsClient

Properties

decomissionModel

decomissionModel: decommissionModel = this.decommissionModel
deprecated

Please use DigitalTwinsClient.decommissionModel instead.

Methods

createModels

decommissionModel

  • decommissionModel(modelId: string, options?: OperationOptions): Promise<RestResponse>
  • Decommission a model using a json patch. When a model is decommissioned, new digital twins will no longer be able to be defined by this model. However, existing digital twins may continue to use this model. Once a model is decommissioned, it may not be recommissioned.

    Parameters

    • modelId: string

      The Id of the model to decommission. property can be replaced.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<RestResponse>

    The http response.

deleteDigitalTwin

  • Delete a digital twin

    Parameters

    • digitalTwinId: string

      The Id of the digital twin to delete.

    • Default value options: DigitalTwinsDeleteOptionalParams = {}

      Extended operation options including ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.

    Returns Promise<RestResponse>

    The http response.

deleteEventRoute

  • deleteEventRoute(eventRouteId: string, options?: OperationOptions): Promise<RestResponse>
  • Delete an event route.

    Parameters

    • eventRouteId: string

      The Id of the eventRoute to delete.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<RestResponse>

    The http response.

deleteModel

  • deleteModel(modelId: string, options?: OperationOptions): Promise<RestResponse>
  • Delete a model.

    Parameters

    • modelId: string

      The Id of the model to delete.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<RestResponse>

    The http response.

deleteRelationship

  • Delete a relationship on a digital twin.

    Parameters

    • digitalTwinId: string

      The Id of the source digital twin.

    • relationshipId: string

      The Id of the relationship to delete.

    • Default value options: DigitalTwinsDeleteRelationshipOptionalParams = {}

      The operation options ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is

    Returns Promise<RestResponse>

    The http response.

getComponent

  • Get a component on a digital twin.

    Parameters

    • digitalTwinId: string

      The Id of the digital twin.

    • componentName: string

      The component being retrieved.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<DigitalTwinsGetComponentResponse>

    Json string representation of the component corresponding to the provided componentName and the HTTP response.

getDigitalTwin

  • Get a digital twin

    Parameters

    • digitalTwinId: string

      The Id of the digital twin.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<DigitalTwinsGetByIdResponse>

    The application/json digital twin and the http response.

getEventRoute

  • Get an event route.

    Parameters

    • eventRouteId: string
    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<EventRoutesGetByIdResponse>

    The application/json event route and the http response.

getModel

  • Get a model, including the model metadata and the model definition.

    Parameters

    • modelId: string

      The Id of the model.

    • Default value includeModelDefinition: boolean = false
    • Default value options: OperationOptions = {}

      Extended operation options including includeModelDefinition: When true the model definition will be returned as part of the result. Default value: false.

    Returns Promise<DigitalTwinModelsGetByIdResponse>

    The application/json model and the http response.

getRelationship

  • Get a relationship on a digital twin.

    Parameters

    • digitalTwinId: string

      The Id of the source digital twin.

    • relationshipId: string

      The Id of the relationship to retrieve.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<DigitalTwinsGetRelationshipByIdResponse>

    The pageable list of application/json relationships belonging to the specified digital twin and the http response.

listEventRoutes

  • List the event routes in a digital twins instance.

    Parameters

    • Optional resultsPerPage: undefined | number

      The maximum number of items to retrieve per request. The server may choose to return less than the requested max.

    • Default value options: OperationOptions & PageSettings = {}

    Returns PagedAsyncIterableIterator<EventRoute, EventRoutesListNextResponse>

    The application/json event route and the http response.

listIncomingRelationships

listModels

  • Get the list of models

    Parameters

    • Optional dependeciesFor: string[]

      The model Ids to have dependencies retrieved. If omitted, all models are retrieved.

    • Default value includeModelDefinition: boolean = false

      Whether to include the model definition in the result. If false, only the model metadata will be returned.

    • Optional resultsPerPage: undefined | number

      The maximum number of items to retrieve per request. The server may choose to return less than the requested max.

    • Default value options: OperationOptions & PageSettings = {}

    Returns PagedAsyncIterableIterator<DigitalTwinsModelData, DigitalTwinModelsListResponse>

    A pageable set of application/json models and the http response.

listRelationships

publishComponentTelemetry

  • publishComponentTelemetry(digitalTwinId: string, componentName: string, payload: string, messageId: string, options?: OperationOptions): Promise<RestResponse>
  • Publish telemetry from a digital twin's component, which is then consumed by one or many destination endpoints (subscribers) defined under.

    Parameters

    • digitalTwinId: string

      The Id of the digital twin to delete.

    • componentName: string

      The name of the DTDL component.

    • payload: string

      The application/json telemetry payload to be sent.

    • messageId: string

      The message Id.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<RestResponse>

    The http response.

publishTelemetry

  • publishTelemetry(digitalTwinId: string, payload: any, messageId: string, options?: OperationOptions): Promise<RestResponse>
  • Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.

    Parameters

    • digitalTwinId: string

      The Id of the digital twin to delete.

    • payload: any

      The application/json telemetry payload to be sent.

    • messageId: string

      The message Id.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<RestResponse>

    The http response.

queryTwins

  • queryTwins(query: string, resultsPerPage?: undefined | number, options?: OperationOptions & PageSettings): PagedAsyncIterableIterator<any, QueryQueryTwinsResponse>
  • Query for digital twins.

    Parameters

    • query: string

      The query string, in SQL-like syntax.

    • Optional resultsPerPage: undefined | number

      The maximum number of items to retrieve per request. The server may choose to return less than the requested max.

    • Default value options: OperationOptions & PageSettings = {}

    Returns PagedAsyncIterableIterator<any, QueryQueryTwinsResponse>

    The pageable list of query results.

updateComponent

  • Update properties of a component on a digital twin using a JSON patch.

    Parameters

    • digitalTwinId: string

      The Id of the digital twin.

    • componentName: string

      The component being updated.

    • jsonPatch: any[]

      The application/json-patch+json operations to be performed on the specified digital twin's component.

    • Default value options: DigitalTwinsUpdateComponentOptionalParams = {}

      Extended operation options including ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.

    Returns Promise<DigitalTwinsUpdateComponentResponse>

    The http response.

updateDigitalTwin

  • Update a digital twin using a json patch.

    Parameters

    • digitalTwinId: string

      The Id of the digital twin.

    • jsonPatch: any

      An update specification described by JSON Patch. Updates to property values and $model elements may happen in the same request. Operations are limited to add, replace and remove.

    • Default value options: DigitalTwinsUpdateOptionalParams = {}

      Extended operation options including ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.

    Returns Promise<DigitalTwinsUpdateResponse>

    The http response.

updateRelationship

  • Updates the properties of a relationship on a digital twin using a JSON patch.

    Parameters

    • digitalTwinId: string

      The Id of the digital twin to delete.

    • relationshipId: string

      The Id of the relationship to be updated.

    • jsonPatch: any[]

      The application/json-patch+json operations to be performed on the specified digital twin's relationship.

    • Default value options: DigitalTwinsUpdateRelationshipOptionalParams = {}

      Extended operation options ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.

    Returns Promise<DigitalTwinsUpdateRelationshipResponse>

upsertDigitalTwin

  • Create or update a digital twin

    Parameters

    • digitalTwinId: string

      The Id of the digital twin to create or update.

    • digitalTwinJson: string

      The application/json digital twin to create.

    • Default value options: DigitalTwinsAddOptionalParams = {}

      Extended operation options including ifNoneMatch: Only perform the operation if the entity does not already exist.

    Returns Promise<DigitalTwinsAddResponse>

    The created application/json digital twin and the http response.

upsertEventRoute

  • upsertEventRoute(eventRouteId: string, endpointId: string, filter: string, options?: OperationOptions): Promise<RestResponse>
  • Create or update an event route.

    Parameters

    • eventRouteId: string

      The Id of the event route to create or update.

    • endpointId: string

      The id of the endpoint this event route is bound to.

    • filter: string

      An expression which describes the events which are routed to the endpoint.

    • Default value options: OperationOptions = {}

      The operation options

    Returns Promise<RestResponse>

    The http response.

upsertRelationship

  • Create or update a relationship on a digital twin.

    Parameters

    • digitalTwinId: string

      The Id of the source digital twin.

    • relationshipId: string

      The Id of the relationship to create.

    • relationship: any

      The application/json relationship to be created.

    • Default value options: DigitalTwinsAddRelationshipOptionalParams = {}

      Extended operation options including ifNoneMatch: Only perform the operation if the entity does not already exist.

    Returns Promise<DigitalTwinsAddRelationshipResponse>

Generated using TypeDoc