[Digital-Twins] Update for GA, rename namespace, add span (#11872)

This commit is contained in:
Zoltan Varga 2020-10-22 10:29:50 -07:00 коммит произвёл GitHub
Родитель 0a606b66fc
Коммит 9cf8af88ab
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
62 изменённых файлов: 4358 добавлений и 1742 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -165,7 +165,7 @@
"path": "sdk/test-utils/perfstress"
},
{
"path": "sdk\\digitaltwins\\digital-twins"
"path": "sdk\\digitaltwins\\digital-twins-core"
}
],
"settings": {

Просмотреть файл

@ -578,8 +578,8 @@
"versionPolicyName": "utility"
},
{
"packageName": "@azure/digital-twins",
"projectFolder": "sdk/digitaltwins/digital-twins",
"packageName": "@azure/digital-twins-core",
"projectFolder": "sdk/digitaltwins/digital-twins-core",
"versionPolicyName": "client"
}
]

Просмотреть файл

@ -26,5 +26,5 @@ extends:
parameters:
ServiceDirectory: digitaltwins
Artifacts:
- name: azure-digital-twins
safeName: azuredigitaltwins
- name: azure-digital-twins-core
safeName: azuredigitaltwinscore

Просмотреть файл

Просмотреть файл

@ -2,11 +2,10 @@
## 1.0.0-preview.2 (Unreleased)
## 1.0.0-preview.1 (2020-09-03)
- This release is a preview of our efforts to create a client library that is user friendly and
idiomatic to the JavaScript ecosystem. The reasons for most of the changes in this update can be found in the
[Azure SDK Design Guidelines for TypeScript](https://azure.github.io/azure-sdk/typescript_introduction.html).
- Initial release:
- Package name `@azure/digital-twins`.
- Package name `@azure/digital-twins-core`.

Просмотреть файл

@ -1,4 +1,4 @@
# Azure Azure Digital Twins client library for JavaScript
# Azure Azure Digital Twins Core client library for JavaScript
This package contains an isomorphic SDK for Azure Digital Twins API to provide access to the Azure Digital Twins service for managing twins, models, relationships, etc.
@ -12,7 +12,7 @@ This package contains an isomorphic SDK for Azure Digital Twins API to provide a
### How to Install
```bash
npm install @azure/digital-twins
npm install @azure/digital-twins-core
```
### How to use
@ -35,7 +35,7 @@ import {
AzureDigitalTwinsAPI,
AzureDigitalTwinsAPIModels,
AzureDigitalTwinsAPIMappers
} from "@azure/digital-twins";
} from "@azure/digital-twins-core";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
msRestNodeAuth
.interactiveLogin()
@ -74,11 +74,11 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/digital-twins sample</title>
<title>@azure/digital-twins-core sample</title>
<script src="node_modules/@azure/core-http/dist/coreHttp.browser.js"></script>
<script src="node_modules/@azure/core-arm/dist/coreArm.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/digital-twins/dist/digital-twins.js"></script>
<script src="node_modules/@azure/digital-twins-core/dist/digital-twins-core.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
@ -119,17 +119,19 @@ You can learn more about Azure Digital Twins by visiting [Azure Digital Twins Do
## Examples
Please take a look at the Readme file in
[samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins/samples)
[samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins-core/samples)
directory for detailed examples on how to use this library.
## Troubleshooting
### Enable logs
You can set the following environment variable to get the debug logging output when using this library.
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
```bash
export AZURE_LOG_LEVEL=verbose
```javascript
import { setLogLevel } from "@azure/logger";
setLogLevel("info");
```
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/logger).
@ -137,7 +139,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur
## Next steps
Please take a look at the
[samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins/samples)
[samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins-core/samples)
directory for detailed examples on how to use this library.
## Contributing
@ -147,4 +149,4 @@ If you'd like to contribute to this library, please read the [contributing guide
## Related projects
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
![Impressions](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins/README.md)
![Impressions](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins-core/README.md)

Просмотреть файл

@ -1,5 +1,5 @@
{
"name": "@azure/digital-twins",
"name": "@azure/digital-twins-core",
"version": "1.0.0-preview.2",
"description": "An isomorphic client library for Azure Digital Twins",
"sdk-type": "client",
@ -16,11 +16,12 @@
"build:test:browser": "tsc -p . && cross-env ONLY_BROWSER=true rollup -c rollup.test.config.js 2>&1",
"build:test:node": "tsc -p . && cross-env ONLY_NODE=true rollup -c rollup.test.config.js 2>&1",
"build:test": "npm run build:test:node && npm run build:test:browser",
"build:samples": "dev-tool samples prep && cd dist-samples && tsc -p .",
"check-format": "prettier --list-different --config ../../.prettierrc.json --ignore-path ../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"clean": "rimraf dist dist-esm dist-browser test-dist test-browser types *.tgz *.log",
"coverage": "nyc --reporter=lcov --exclude-after-remap=false mocha -t 120000 dist-test/index.node.js --reporter ../../../common/tools/mocha-multi-reporter.js",
"execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/",
"execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples",
"execute:samples": "npm run build:samples && dev-tool samples run dist-samples/javascript dist-samples/typescript/dist/dist-samples/typescript/src/",
"extract-api": "tsc -p . && api-extractor run --local",
"format": "prettier --write --config ../../.prettierrc.json --ignore-path ../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "npm run build:test:browser && cross-env TEST_MODE=live karma start --single-run",
@ -47,7 +48,7 @@
"keywords": [
"azure",
"iot",
"digital-twins",
"digital-twins-core",
"twins",
"node",
"typescript",
@ -65,12 +66,14 @@
"dependencies": {
"@azure/core-http": "^1.1.6",
"@azure/core-paging": "^1.1.1",
"@azure/core-tracing": "1.0.0-preview.9",
"@azure/logger": "^1.0.0",
"@opentelemetry/api": "^0.10.2",
"tslib": "^2.0.0"
},
"devDependencies": {
"@azure/identity": "^1.1.0",
"@azure/dev-tool": "^1.0.0",
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
"@azure/test-utils-recorder": "^1.0.0",
"@microsoft/api-extractor": "7.7.11",

Просмотреть файл

@ -1,4 +1,4 @@
## API Report File for "@azure/digital-twins"
## API Report File for "@azure/digital-twins-core"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
@ -9,48 +9,30 @@ import { OperationOptions } from '@azure/core-http';
import { PagedAsyncIterableIterator } from '@azure/core-paging';
import { PageSettings } from '@azure/core-paging';
import { PipelineOptions } from '@azure/core-http';
import { RequestOptionsBase } from '@azure/core-http';
import { RestResponse } from '@azure/core-http';
import { TokenCredential } from '@azure/core-http';
// @public
export interface DigitalTwinModelsAddOptionalParams extends coreHttp.OperationOptions {
models?: any[];
}
// @public
export type DigitalTwinModelsAddResponse = ModelData[] & {
export type DigitalTwinModelsAddResponse = DigitalTwinsModelData[] & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: ModelData[];
parsedBody: DigitalTwinsModelData[];
};
};
// @public
export type DigitalTwinModelsGetByIdResponse = ModelData & {
export type DigitalTwinModelsGetByIdResponse = DigitalTwinsModelData & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: ModelData;
parsedBody: DigitalTwinsModelData;
};
};
// @public
export interface DigitalTwinModelsListOptionalParams extends coreHttp.OperationOptions {
dependenciesFor?: string[];
digitalTwinModelsListOptions?: DigitalTwinModelsListOptions;
includeModelDefinition?: boolean;
}
// @public
export interface DigitalTwinModelsListOptions {
maxItemCount?: number;
}
// @public
export type DigitalTwinModelsListResponse = PagedModelDataCollection & {
export type DigitalTwinModelsListResponse = PagedDigitalTwinsModelDataCollection & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: PagedModelDataCollection;
parsedBody: PagedDigitalTwinsModelDataCollection;
};
};
@ -64,11 +46,6 @@ export interface DigitalTwinsAddRelationshipHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsAddRelationshipOptionalParams extends coreHttp.OperationOptions {
relationship?: any;
}
// @public
export type DigitalTwinsAddRelationshipResponse = DigitalTwinsAddRelationshipHeaders & {
body: any;
@ -93,28 +70,28 @@ export type DigitalTwinsAddResponse = DigitalTwinsAddHeaders & {
export class DigitalTwinsClient {
constructor(endpointUrl: string, credential: TokenCredential, options?: DigitalTwinsClientOptions);
createModels(models: any[], options?: OperationOptions): Promise<DigitalTwinModelsAddResponse>;
decomissionModel(modelId: string, updateModel: any[], options?: OperationOptions): Promise<RestResponse>;
decomissionModel(modelId: string, options?: OperationOptions): Promise<RestResponse>;
deleteDigitalTwin(digitalTwinId: string, etag?: string, options?: OperationOptions): Promise<RestResponse>;
deleteEventRoute(eventRouteId: string, options?: OperationOptions): Promise<RestResponse>;
deleteModel(modelId: string, options?: OperationOptions): Promise<RestResponse>;
deleteRelationship(digitalTwinId: string, relationshipId: string, etag?: string, options?: OperationOptions): Promise<RestResponse>;
getComponent(digitalTwinId: string, componentPath: string, options?: OperationOptions): Promise<DigitalTwinsGetComponentResponse>;
getComponent(digitalTwinId: string, componentName: string, options?: OperationOptions): Promise<DigitalTwinsGetComponentResponse>;
getDigitalTwin(digitalTwinId: string, options?: OperationOptions): Promise<DigitalTwinsGetByIdResponse>;
getEventRoute(eventRouteId: string, options?: OperationOptions): Promise<EventRoutesGetByIdResponse>;
getModel(modelId: string, includeModelDefinition?: boolean, options?: OperationOptions): Promise<DigitalTwinModelsGetByIdResponse>;
getRelationship(digitalTwinId: string, relationshipId: string, options?: OperationOptions): Promise<DigitalTwinsGetByIdResponse>;
listEventRoutes(maxItemCount?: number): PagedAsyncIterableIterator<EventRoute, EventRoutesListNextResponse>;
listIncomingRelationships(digitalTwinId: string, options?: RequestOptionsBase & PageSettings): PagedAsyncIterableIterator<IncomingRelationship, DigitalTwinsListIncomingRelationshipsResponse>;
listModels(dependeciesFor?: string[], includeModelDefinition?: boolean, maxItemCount?: number): PagedAsyncIterableIterator<ModelData, DigitalTwinModelsListResponse>;
listRelationships(digitalTwinId: string, options?: RequestOptionsBase & PageSettings): PagedAsyncIterableIterator<any, DigitalTwinsListRelationshipsResponse>;
publishComponentTelemetry(digitalTwinId: string, componentPath: string, payload: string, messageId?: string, options?: OperationOptions): Promise<RestResponse>;
publishTelemetry(digitalTwinId: string, payload: any, messageId?: string, options?: OperationOptions): Promise<RestResponse>;
queryTwins(query?: string): PagedAsyncIterableIterator<any, QueryQueryTwinsResponse>;
updateComponent(digitalTwinId: string, componentPath: string, componentPatch?: any[], etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateComponentResponse>;
updateDigitalTwin(digitalTwinId: string, twinPatch: any, etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateResponse>;
updateRelationship(digitalTwinId: string, relationshipId: string, relationshipPatch: any[], etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateRelationshipResponse>;
getRelationship(digitalTwinId: string, relationshipId: string, options?: OperationOptions): Promise<DigitalTwinsGetRelationshipByIdResponse>;
listEventRoutes(resultsPerPage?: number, options?: OperationOptions): PagedAsyncIterableIterator<EventRoute, EventRoutesListNextResponse>;
listIncomingRelationships(digitalTwinId: string, options?: OperationOptions): PagedAsyncIterableIterator<IncomingRelationship, DigitalTwinsListIncomingRelationshipsResponse>;
listModels(dependeciesFor?: string[], includeModelDefinition?: boolean, resultsPerPage?: number, options?: OperationOptions): PagedAsyncIterableIterator<DigitalTwinsModelData, DigitalTwinModelsListResponse>;
listRelationships(digitalTwinId: string, options?: OperationOptions & PageSettings): PagedAsyncIterableIterator<any, DigitalTwinsListRelationshipsResponse>;
publishComponentTelemetry(digitalTwinId: string, componentName: string, payload: string, messageId?: string, options?: OperationOptions): Promise<RestResponse>;
publishTelemetry(digitalTwinId: string, payload: any, messageId: string, options?: OperationOptions): Promise<RestResponse>;
queryTwins(query: string, resultsPerPage?: number, options?: OperationOptions): PagedAsyncIterableIterator<any, QueryQueryTwinsResponse>;
updateComponent(digitalTwinId: string, componentName: string, jsonPatch: any[], etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateComponentResponse>;
updateDigitalTwin(digitalTwinId: string, jsonPatch: any, etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateResponse>;
updateRelationship(digitalTwinId: string, relationshipId: string, jsonPatch: any[], etag?: string, options?: OperationOptions): Promise<DigitalTwinsUpdateRelationshipResponse>;
upsertDigitalTwin(digitalTwinId: string, digitalTwinJson: string, options?: OperationOptions): Promise<DigitalTwinsAddResponse>;
upsertEventRoute(eventRouteId: string, endpointId: string, filter?: string, options?: OperationOptions): Promise<RestResponse>;
upsertEventRoute(eventRouteId: string, endpointId: string, filter: string, options?: OperationOptions): Promise<RestResponse>;
upsertRelationship(digitalTwinId: string, relationshipId: string, relationship: any, options?: OperationOptions): Promise<DigitalTwinsAddRelationshipResponse>;
}
@ -123,11 +100,6 @@ export interface DigitalTwinsClientOptions extends PipelineOptions {
apiVersion?: string;
}
// @public
export interface DigitalTwinsDeleteRelationshipOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
}
// @public
export interface DigitalTwinsGetByIdHeaders {
etag?: string;
@ -158,6 +130,21 @@ export type DigitalTwinsGetComponentResponse = DigitalTwinsGetComponentHeaders &
};
};
// @public
export interface DigitalTwinsGetRelationshipByIdHeaders {
etag?: string;
}
// @public
export type DigitalTwinsGetRelationshipByIdResponse = DigitalTwinsGetRelationshipByIdHeaders & {
body: any;
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: any;
parsedHeaders: DigitalTwinsGetRelationshipByIdHeaders;
};
};
// @public
export type DigitalTwinsListIncomingRelationshipsResponse = IncomingRelationshipCollection & {
_response: coreHttp.HttpResponse & {
@ -166,11 +153,6 @@ export type DigitalTwinsListIncomingRelationshipsResponse = IncomingRelationship
};
};
// @public
export interface DigitalTwinsListRelationshipsOptionalParams extends coreHttp.OperationOptions {
relationshipName?: string;
}
// @public
export type DigitalTwinsListRelationshipsResponse = RelationshipCollection & {
_response: coreHttp.HttpResponse & {
@ -180,13 +162,17 @@ export type DigitalTwinsListRelationshipsResponse = RelationshipCollection & {
};
// @public
export interface DigitalTwinsSendComponentTelemetryOptionalParams extends coreHttp.OperationOptions {
timestamp?: string;
}
// @public
export interface DigitalTwinsSendTelemetryOptionalParams extends coreHttp.OperationOptions {
timestamp?: string;
export interface DigitalTwinsModelData {
decommissioned?: boolean;
description?: {
[propertyName: string]: string;
};
displayName?: {
[propertyName: string]: string;
};
id: string;
model?: any;
uploadTime?: Date;
}
// @public
@ -194,12 +180,6 @@ export interface DigitalTwinsUpdateComponentHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsUpdateComponentOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
patchDocument?: any[];
}
// @public
export type DigitalTwinsUpdateComponentResponse = DigitalTwinsUpdateComponentHeaders & {
_response: coreHttp.HttpResponse & {
@ -212,22 +192,11 @@ export interface DigitalTwinsUpdateHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsUpdateOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
}
// @public
export interface DigitalTwinsUpdateRelationshipHeaders {
etag?: string;
}
// @public
export interface DigitalTwinsUpdateRelationshipOptionalParams extends coreHttp.OperationOptions {
ifMatch?: string;
patchDocument?: any[];
}
// @public
export type DigitalTwinsUpdateRelationshipResponse = DigitalTwinsUpdateRelationshipHeaders & {
_response: coreHttp.HttpResponse & {
@ -245,7 +214,7 @@ export type DigitalTwinsUpdateResponse = DigitalTwinsUpdateHeaders & {
// @public
export interface EventRoute {
endpointName: string;
filter?: string;
filter: string;
readonly id?: string;
}
@ -255,11 +224,6 @@ export interface EventRouteCollection {
value?: EventRoute[];
}
// @public
export interface EventRoutesAddOptionalParams extends coreHttp.OperationOptions {
eventRoute?: EventRoute;
}
// @public
export type EventRoutesGetByIdResponse = EventRoute & {
_response: coreHttp.HttpResponse & {
@ -276,16 +240,6 @@ export type EventRoutesListNextResponse = EventRouteCollection & {
};
};
// @public
export interface EventRoutesListOptionalParams extends coreHttp.OperationOptions {
eventRoutesListOptions?: EventRoutesListOptions;
}
// @public
export interface EventRoutesListOptions {
maxItemCount?: number;
}
// @public
export interface IncomingRelationship {
relationshipId?: string;
@ -302,23 +256,9 @@ export interface IncomingRelationshipCollection {
}
// @public
export interface ModelData {
decommissioned?: boolean;
description?: {
[propertyName: string]: string;
};
displayName?: {
[propertyName: string]: string;
};
id: string;
model?: any;
uploadTime?: Date;
}
// @public
export interface PagedModelDataCollection {
export interface PagedDigitalTwinsModelDataCollection {
nextLink?: string;
value?: ModelData[];
value?: DigitalTwinsModelData[];
}
// @public
@ -338,7 +278,7 @@ export type QueryQueryTwinsResponse = QueryQueryTwinsHeaders & QueryResult & {
// @public
export interface QueryResult {
continuationToken?: string;
items?: any[];
value?: any[];
}
// @public

Просмотреть файл

@ -73,7 +73,7 @@ export function browserConfig(test = false) {
const baseConfig = {
input: input,
output: {
file: "dist-browser/digital-twins.js",
file: "dist-browser/digital-twins-core.js",
format: "umd",
name: "Azure.DigitialTwins",
globals: {

Просмотреть файл

@ -28,7 +28,7 @@ The client requires an instance of [TokenCredential](https://docs.microsoft.com/
In this samples, we illustrate how to use one derived class: [DefaultAzureCredentials](https://docs.microsoft.com/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet).
> Note: In order to access the data plane for the Digital Twins service, the entity must be given permissions.
> To do this, use the Azure CLI command: `az dt rbac assign-role --assignee '<user-email | application-id>' --role owner -n '<your-digital-twins-instance>'`
> To do this, use the Azure CLI command: `az dt rbac assign-role --assignee '<user-email | application-id>' --role owner -n '<your-digital-twins-core-instance>'`
```JavaScript Snippet:dt_create_service_client_with_secret.js
// DefaultAzureCredential supports different authentication mechanisms and determines the appropriate credential type based of the environment it is executing in.
@ -58,7 +58,7 @@ It provides an opportunity to override default behavior including:
### Create models
Let's create models using the code below. You need to pass in `any[]` containing list of json models.
Check out sample models [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/digitaltwins/digital-twins/samples/dtdl/models).
Check out sample models [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/digitaltwins/digital-twins-core/samples/dtdl/models).
```JavaScript Snippet:dt_models_lifecycle.js
const newModels = [temporaryComponent, temporaryModel];
@ -77,6 +77,8 @@ for await (const model of models) {
}
```
### Get model
Use `getModel` with model's unique identifier to get a specific model.
```JavaScript Snippet:dt_models_lifecycle
@ -103,7 +105,7 @@ await serviceClient.deleteModel(modelId);
### Create digital twins
For Creating Twin you will need to provide Id of a digital Twin such as `myTwin` and the application/json digital twin based on the model created earlier. You can look at sample application/json [here](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins/samples/dtdl/digitalTwins "DigitalTwin").
For Creating Twin you will need to provide Id of a digital Twin such as `myTwin` and the application/json digital twin based on the model created earlier. You can look at sample application/json [here](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/digitaltwins/digital-twins-core/samples/dtdl/digitalTwins "DigitalTwin").
```JavaScript Snippet:dt_digitaltwins_lifecycle
const digitalTwinId = "myTwin";
@ -127,7 +129,7 @@ console.log(`DigitalTwin: ${twin.body}`);
### Query digital twins
Query the Azure Digital Twins instance for digital twins using the [Azure Digital Twins Query Store lanaguage](https://review.docs.microsoft.com/azure/digital-twins-v2/concepts-query-language?branch=pr-en-us-114648). Query calls support paging. Here's an example of how to query for digital twins and how to iterate over the results.
Query the Azure Digital Twins instance for digital twins using the [Azure Digital Twins Query Store lanaguage](https://review.docs.microsoft.com/azure/digital-twins/concepts-query-language). Query calls support paging. Here's an example of how to query for digital twins and how to iterate over the results.
```JavaScript Snippet:dt_digitaltwins_query
const query = "SELECT * FROM digitaltwins";
@ -177,7 +179,7 @@ console.log(`Updated component: ${component}`);
### Create digital twin relationships
`upsertRelationship` creates a relationship on a digital twin provided with Id of a digital twin, name of relationship such as "contains", Id of an relationship such as "FloorContainsRoom" and an application/json relationship to be created. Must contain property with key "\$targetId" to specify the target of the relationship. Sample payloads for relationships can be found [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/digitaltwins/digital-twins/samples/dtdl/relationships/hospitalRelationships.ts "RelationshipExamples").
`upsertRelationship` creates a relationship on a digital twin provided with Id of a digital twin, name of relationship such as "contains", Id of an relationship such as "FloorContainsRoom" and an application/json relationship to be created. Must contain property with key "\$targetId" to specify the target of the relationship. Sample payloads for relationships can be found [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/digitaltwins/digital-twins-core/samples/dtdl/relationships/hospitalRelationships.ts "RelationshipExamples").
```JavaScript Snippet:dt_scenario
const hospitalRelationships = [

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { v4 } = require("uuid");
const { inspect } = require("util");

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { v4 } = require("uuid");
const { buildingTwin } = require("../dtdl/digitalTwins/buildingTwin.ts");
const { building } = require("../dtdl/models/building.ts");

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { v4 } = require("uuid");
const { inspect } = require("util");

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { inspect } = require("util");
// Simple example of how to:

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
const { DefaultAzureCredential } = require("@azure/identity");
const { DigitalTwinsClient } = require("@azure/digital-twins");
const { DigitalTwinsClient } = require("@azure/digital-twins-core");
const { v4 } = require("uuid");
const { buildingTwin } = require("../dtdl/digitalTwins/buildingTwin.ts");

Просмотреть файл

@ -0,0 +1,14 @@
{
"name": "azure-digital-twins-core-samples-js",
"private": true,
"version": "1.0.0-preview.2",
"description": "Samples for the azure/digital-twins-core client library for Javascript",
"author": "Microsoft Corporation",
"license": "MIT",
"main": "dt_create_digitaltwins_service_client.js",
"dependencies": {
"@azure/digital-twins-core": "file:../..",
"@azure/core-http": "^1.1.6",
"@azure/identity": "^1.1.0"
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -41,6 +41,6 @@ export class AzureDigitalTwinsAPIContext extends coreHttp.ServiceClient {
// Assigning values to Constant parameters
this.$host =
options.$host || "https://digitaltwins-name.digitaltwins.azure.net";
this.apiVersion = options.apiVersion || "2020-05-31-preview";
this.apiVersion = options.apiVersion || "2020-10-31";
}
}

Просмотреть файл

@ -11,7 +11,7 @@ import * as coreHttp from "@azure/core-http";
/**
* A model definition and metadata for that model.
*/
export interface ModelData {
export interface DigitalTwinsModelData {
/**
* A language map that contains the localized display names as specified in the model definition.
*/
@ -85,13 +85,13 @@ export interface InnerError {
}
/**
* A collection of ModelData objects.
* A collection of DigitalTwinsModelData objects.
*/
export interface PagedModelDataCollection {
export interface PagedDigitalTwinsModelDataCollection {
/**
* The ModelData objects.
* The DigitalTwinsModelData objects.
*/
value?: ModelData[];
value?: DigitalTwinsModelData[];
/**
* A URI to retrieve the next page of objects.
*/
@ -119,7 +119,7 @@ export interface QueryResult {
/**
* The query results.
*/
items?: any[];
value?: any[];
/**
* A token which can be used to construct a new QuerySpecification to retrieve the next set of results.
*/
@ -202,7 +202,7 @@ export interface EventRoute {
/**
* An expression which describes the events which are routed to the endpoint.
*/
filter?: string;
filter: string;
}
/**
@ -295,14 +295,312 @@ export interface DigitalTwinsUpdateComponentHeaders {
etag?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsAddOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsListOptions {
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested max.
* Identifies the request in a distributed tracing system.
*/
maxItemCount?: number;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsGetByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsUpdateOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinModelsDeleteOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface QueryTwinsOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
* Parameter group
*/
export interface DigitalTwinsGetByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsAddOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsDeleteOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsUpdateOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsGetRelationshipByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsAddRelationshipOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsDeleteRelationshipOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsUpdateRelationshipOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsListRelationshipsOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsListIncomingRelationshipsOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsSendTelemetryOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsSendComponentTelemetryOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsGetComponentOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface DigitalTwinsUpdateComponentOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
*/
ifMatch?: string;
}
/**
@ -310,9 +608,59 @@ export interface DigitalTwinModelsListOptions {
*/
export interface EventRoutesListOptions {
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested max.
* Identifies the request in a distributed tracing system.
*/
maxItemCount?: number;
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
/**
* The maximum number of items to retrieve per request. The server may choose to return less than the requested number.
*/
maxItemsPerPage?: number;
}
/**
* Parameter group
*/
export interface EventRoutesGetByIdOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface EventRoutesAddOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
* Parameter group
*/
export interface EventRoutesDeleteOptions {
/**
* Identifies the request in a distributed tracing system.
*/
traceparent?: string;
/**
* Provides vendor-specific trace identification information and is a companion to traceparent.
*/
tracestate?: string;
}
/**
@ -320,6 +668,10 @@ export interface EventRoutesListOptions {
*/
export interface DigitalTwinModelsAddOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinModelsAddOptions?: DigitalTwinModelsAddOptions;
/**
* An array of models to add.
*/
@ -329,7 +681,7 @@ export interface DigitalTwinModelsAddOptionalParams
/**
* Contains response data for the add operation.
*/
export type DigitalTwinModelsAddResponse = ModelData[] & {
export type DigitalTwinModelsAddResponse = DigitalTwinsModelData[] & {
/**
* The underlying HTTP response.
*/
@ -342,7 +694,7 @@ export type DigitalTwinModelsAddResponse = ModelData[] & {
/**
* The response body as parsed JSON or XML
*/
parsedBody: ModelData[];
parsedBody: DigitalTwinsModelData[];
};
};
@ -368,7 +720,7 @@ export interface DigitalTwinModelsListOptionalParams
/**
* Contains response data for the list operation.
*/
export type DigitalTwinModelsListResponse = PagedModelDataCollection & {
export type DigitalTwinModelsListResponse = PagedDigitalTwinsModelDataCollection & {
/**
* The underlying HTTP response.
*/
@ -381,7 +733,7 @@ export type DigitalTwinModelsListResponse = PagedModelDataCollection & {
/**
* The response body as parsed JSON or XML
*/
parsedBody: PagedModelDataCollection;
parsedBody: PagedDigitalTwinsModelDataCollection;
};
};
@ -390,6 +742,10 @@ export type DigitalTwinModelsListResponse = PagedModelDataCollection & {
*/
export interface DigitalTwinModelsGetByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinModelsGetByIdOptions?: DigitalTwinModelsGetByIdOptions;
/**
* When true the model definition will be returned as part of the result.
*/
@ -399,7 +755,7 @@ export interface DigitalTwinModelsGetByIdOptionalParams
/**
* Contains response data for the getById operation.
*/
export type DigitalTwinModelsGetByIdResponse = ModelData & {
export type DigitalTwinModelsGetByIdResponse = DigitalTwinsModelData & {
/**
* The underlying HTTP response.
*/
@ -412,10 +768,32 @@ export type DigitalTwinModelsGetByIdResponse = ModelData & {
/**
* The response body as parsed JSON or XML
*/
parsedBody: ModelData;
parsedBody: DigitalTwinsModelData;
};
};
/**
* Optional parameters.
*/
export interface DigitalTwinModelsUpdateOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinModelsUpdateOptions?: DigitalTwinModelsUpdateOptions;
}
/**
* Optional parameters.
*/
export interface DigitalTwinModelsDeleteOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinModelsDeleteOptions?: DigitalTwinModelsDeleteOptions;
}
/**
* Optional parameters.
*/
@ -438,7 +816,7 @@ export interface DigitalTwinModelsListNextOptionalParams
/**
* Contains response data for the listNext operation.
*/
export type DigitalTwinModelsListNextResponse = PagedModelDataCollection & {
export type DigitalTwinModelsListNextResponse = PagedDigitalTwinsModelDataCollection & {
/**
* The underlying HTTP response.
*/
@ -451,10 +829,21 @@ export type DigitalTwinModelsListNextResponse = PagedModelDataCollection & {
/**
* The response body as parsed JSON or XML
*/
parsedBody: PagedModelDataCollection;
parsedBody: PagedDigitalTwinsModelDataCollection;
};
};
/**
* Optional parameters.
*/
export interface QueryQueryTwinsOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
queryTwinsOptions?: QueryTwinsOptions;
}
/**
* Contains response data for the queryTwins operation.
*/
@ -480,6 +869,17 @@ export type QueryQueryTwinsResponse = QueryQueryTwinsHeaders &
};
};
/**
* Optional parameters.
*/
export interface DigitalTwinsGetByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsGetByIdOptions?: DigitalTwinsGetByIdOptions;
}
/**
* Contains response data for the getById operation.
*/
@ -509,6 +909,17 @@ export type DigitalTwinsGetByIdResponse = DigitalTwinsGetByIdHeaders & {
};
};
/**
* Optional parameters.
*/
export interface DigitalTwinsAddOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsAddOptions?: DigitalTwinsAddOptions;
}
/**
* Contains response data for the add operation.
*/
@ -544,9 +955,9 @@ export type DigitalTwinsAddResponse = DigitalTwinsAddHeaders & {
export interface DigitalTwinsDeleteOptionalParams
extends coreHttp.OperationOptions {
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* Parameter group
*/
ifMatch?: string;
digitalTwinsDeleteOptions?: DigitalTwinsDeleteOptions;
}
/**
@ -555,9 +966,9 @@ export interface DigitalTwinsDeleteOptionalParams
export interface DigitalTwinsUpdateOptionalParams
extends coreHttp.OperationOptions {
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* Parameter group
*/
ifMatch?: string;
digitalTwinsUpdateOptions?: DigitalTwinsUpdateOptions;
}
/**
@ -575,6 +986,17 @@ export type DigitalTwinsUpdateResponse = DigitalTwinsUpdateHeaders & {
};
};
/**
* Optional parameters.
*/
export interface DigitalTwinsGetRelationshipByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsGetRelationshipByIdOptions?: DigitalTwinsGetRelationshipByIdOptions;
}
/**
* Contains response data for the getRelationshipById operation.
*/
@ -610,9 +1032,9 @@ export type DigitalTwinsGetRelationshipByIdResponse = DigitalTwinsGetRelationshi
export interface DigitalTwinsAddRelationshipOptionalParams
extends coreHttp.OperationOptions {
/**
* The data for the relationship.
* Parameter group
*/
relationship?: any;
digitalTwinsAddRelationshipOptions?: DigitalTwinsAddRelationshipOptions;
}
/**
@ -650,9 +1072,9 @@ export type DigitalTwinsAddRelationshipResponse = DigitalTwinsAddRelationshipHea
export interface DigitalTwinsDeleteRelationshipOptionalParams
extends coreHttp.OperationOptions {
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* Parameter group
*/
ifMatch?: string;
digitalTwinsDeleteRelationshipOptions?: DigitalTwinsDeleteRelationshipOptions;
}
/**
@ -661,13 +1083,9 @@ export interface DigitalTwinsDeleteRelationshipOptionalParams
export interface DigitalTwinsUpdateRelationshipOptionalParams
extends coreHttp.OperationOptions {
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* Parameter group
*/
ifMatch?: string;
/**
* JSON Patch description of the update to the relationship properties.
*/
patchDocument?: any[];
digitalTwinsUpdateRelationshipOptions?: DigitalTwinsUpdateRelationshipOptions;
}
/**
@ -690,6 +1108,10 @@ export type DigitalTwinsUpdateRelationshipResponse = DigitalTwinsUpdateRelations
*/
export interface DigitalTwinsListRelationshipsOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsListRelationshipsOptions?: DigitalTwinsListRelationshipsOptions;
/**
* The name of the relationship.
*/
@ -716,6 +1138,17 @@ export type DigitalTwinsListRelationshipsResponse = RelationshipCollection & {
};
};
/**
* Optional parameters.
*/
export interface DigitalTwinsListIncomingRelationshipsOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsListIncomingRelationshipsOptions?: DigitalTwinsListIncomingRelationshipsOptions;
}
/**
* Contains response data for the listIncomingRelationships operation.
*/
@ -741,10 +1174,14 @@ export type DigitalTwinsListIncomingRelationshipsResponse = IncomingRelationship
*/
export interface DigitalTwinsSendTelemetryOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsSendTelemetryOptions?: DigitalTwinsSendTelemetryOptions;
/**
* An RFC 3339 timestamp that identifies the time the telemetry was measured.
*/
timestamp?: string;
telemetrySourceTime?: string;
}
/**
@ -752,10 +1189,25 @@ export interface DigitalTwinsSendTelemetryOptionalParams
*/
export interface DigitalTwinsSendComponentTelemetryOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsSendComponentTelemetryOptions?: DigitalTwinsSendComponentTelemetryOptions;
/**
* An RFC 3339 timestamp that identifies the time the telemetry was measured.
*/
timestamp?: string;
telemetrySourceTime?: string;
}
/**
* Optional parameters.
*/
export interface DigitalTwinsGetComponentOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsGetComponentOptions?: DigitalTwinsGetComponentOptions;
}
/**
@ -793,13 +1245,9 @@ export type DigitalTwinsGetComponentResponse = DigitalTwinsGetComponentHeaders &
export interface DigitalTwinsUpdateComponentOptionalParams
extends coreHttp.OperationOptions {
/**
* Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
* Parameter group
*/
ifMatch?: string;
/**
* 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.
*/
patchDocument?: any[];
digitalTwinsUpdateComponentOptions?: DigitalTwinsUpdateComponentOptions;
}
/**
@ -822,6 +1270,10 @@ export type DigitalTwinsUpdateComponentResponse = DigitalTwinsUpdateComponentHea
*/
export interface DigitalTwinsListRelationshipsNextOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsListRelationshipsOptions?: DigitalTwinsListRelationshipsOptions;
/**
* The name of the relationship.
*/
@ -848,6 +1300,17 @@ export type DigitalTwinsListRelationshipsNextResponse = RelationshipCollection &
};
};
/**
* Optional parameters.
*/
export interface DigitalTwinsListIncomingRelationshipsNextOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
digitalTwinsListIncomingRelationshipsOptions?: DigitalTwinsListIncomingRelationshipsOptions;
}
/**
* Contains response data for the listIncomingRelationshipsNext operation.
*/
@ -899,6 +1362,17 @@ export type EventRoutesListResponse = EventRouteCollection & {
};
};
/**
* Optional parameters.
*/
export interface EventRoutesGetByIdOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
eventRoutesGetByIdOptions?: EventRoutesGetByIdOptions;
}
/**
* Contains response data for the getById operation.
*/
@ -924,12 +1398,27 @@ export type EventRoutesGetByIdResponse = EventRoute & {
*/
export interface EventRoutesAddOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
eventRoutesAddOptions?: EventRoutesAddOptions;
/**
* The event route data
*/
eventRoute?: EventRoute;
}
/**
* Optional parameters.
*/
export interface EventRoutesDeleteOptionalParams
extends coreHttp.OperationOptions {
/**
* Parameter group
*/
eventRoutesDeleteOptions?: EventRoutesDeleteOptions;
}
/**
* Optional parameters.
*/

Просмотреть файл

@ -8,10 +8,10 @@
import * as coreHttp from "@azure/core-http";
export const ModelData: coreHttp.CompositeMapper = {
export const DigitalTwinsModelData: coreHttp.CompositeMapper = {
type: {
name: "Composite",
className: "ModelData",
className: "DigitalTwinsModelData",
modelProperties: {
displayName: {
serializedName: "displayName",
@ -132,16 +132,18 @@ export const InnerError: coreHttp.CompositeMapper = {
}
};
export const PagedModelDataCollection: coreHttp.CompositeMapper = {
export const PagedDigitalTwinsModelDataCollection: coreHttp.CompositeMapper = {
type: {
name: "Composite",
className: "PagedModelDataCollection",
className: "PagedDigitalTwinsModelDataCollection",
modelProperties: {
value: {
serializedName: "value",
type: {
name: "Sequence",
element: { type: { name: "Composite", className: "ModelData" } }
element: {
type: { name: "Composite", className: "DigitalTwinsModelData" }
}
}
},
nextLink: {
@ -180,8 +182,8 @@ export const QueryResult: coreHttp.CompositeMapper = {
name: "Composite",
className: "QueryResult",
modelProperties: {
items: {
serializedName: "items",
value: {
serializedName: "value",
type: {
name: "Sequence",
element: { type: { name: "any" } }
@ -319,6 +321,7 @@ export const EventRoute: coreHttp.CompositeMapper = {
},
filter: {
serializedName: "filter",
required: true,
type: {
name: "String"
}

Просмотреть файл

@ -0,0 +1,890 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
OperationParameter,
OperationURLParameter,
OperationQueryParameter,
QueryCollectionFormat
} from "@azure/core-http";
import {
QuerySpecification as QuerySpecificationMapper,
EventRoute as EventRouteMapper
} from "../models/mappers";
export const contentType: OperationParameter = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
};
export const models: OperationParameter = {
parameterPath: ["options", "models"],
mapper: {
constraints: {
MinItems: 1,
UniqueItems: true
},
serializedName: "models",
type: {
name: "Sequence",
element: { type: { name: "any" } }
}
}
};
export const $host: OperationURLParameter = {
parameterPath: "$host",
mapper: {
serializedName: "$host",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const traceparent: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsAddOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsAddOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const apiVersion: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2020-10-31",
isConstant: true,
serializedName: "api-version",
type: {
name: "String"
}
}
};
export const traceparent1: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsListOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate1: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsListOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const dependenciesFor: OperationQueryParameter = {
parameterPath: ["options", "dependenciesFor"],
mapper: {
serializedName: "dependenciesFor",
type: {
name: "Sequence",
element: { type: { name: "String" } }
}
},
collectionFormat: QueryCollectionFormat.Csv
};
export const includeModelDefinition: OperationQueryParameter = {
parameterPath: ["options", "includeModelDefinition"],
mapper: {
serializedName: "includeModelDefinition",
type: {
name: "Boolean"
}
}
};
export const maxItemsPerPage: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsListOptions", "maxItemsPerPage"],
mapper: {
serializedName: "max-items-per-page",
type: {
name: "Number"
}
}
};
export const traceparent2: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsGetByIdOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate2: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsGetByIdOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const id: OperationURLParameter = {
parameterPath: "id",
mapper: {
serializedName: "id",
required: true,
type: {
name: "String"
}
}
};
export const contentType1: OperationParameter = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json-patch+json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
};
export const updateModel: OperationParameter = {
parameterPath: "updateModel",
mapper: {
serializedName: "updateModel",
required: true,
type: {
name: "Sequence",
element: { type: { name: "any" } }
}
}
};
export const traceparent3: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsUpdateOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate3: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsUpdateOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent4: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsDeleteOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate4: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsDeleteOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const nextLink: OperationURLParameter = {
parameterPath: "nextLink",
mapper: {
serializedName: "nextLink",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const querySpecification: OperationParameter = {
parameterPath: "querySpecification",
mapper: QuerySpecificationMapper
};
export const traceparent5: OperationParameter = {
parameterPath: ["options", "queryTwinsOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate5: OperationParameter = {
parameterPath: ["options", "queryTwinsOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const maxItemsPerPage1: OperationParameter = {
parameterPath: ["options", "queryTwinsOptions", "maxItemsPerPage"],
mapper: {
serializedName: "max-items-per-page",
type: {
name: "Number"
}
}
};
export const traceparent6: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetByIdOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate6: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetByIdOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const twin: OperationParameter = {
parameterPath: "twin",
mapper: {
serializedName: "twin",
required: true,
type: {
name: "any"
}
}
};
export const traceparent7: OperationParameter = {
parameterPath: ["options", "digitalTwinsAddOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate7: OperationParameter = {
parameterPath: ["options", "digitalTwinsAddOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifNoneMatch: OperationParameter = {
parameterPath: ["options", "ifNoneMatch"],
mapper: {
defaultValue: "*",
isConstant: true,
serializedName: "If-None-Match",
type: {
name: "String"
}
}
};
export const traceparent8: OperationParameter = {
parameterPath: ["options", "digitalTwinsDeleteOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate8: OperationParameter = {
parameterPath: ["options", "digitalTwinsDeleteOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch: OperationParameter = {
parameterPath: ["options", "digitalTwinsDeleteOptions", "ifMatch"],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const patchDocument: OperationParameter = {
parameterPath: "patchDocument",
mapper: {
serializedName: "patchDocument",
required: true,
type: {
name: "Sequence",
element: { type: { name: "any" } }
}
}
};
export const traceparent9: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate9: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch1: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateOptions", "ifMatch"],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent10: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsGetRelationshipByIdOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate10: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsGetRelationshipByIdOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const relationshipId: OperationURLParameter = {
parameterPath: "relationshipId",
mapper: {
serializedName: "relationshipId",
required: true,
type: {
name: "String"
}
}
};
export const relationship: OperationParameter = {
parameterPath: "relationship",
mapper: {
serializedName: "relationship",
required: true,
type: {
name: "any"
}
}
};
export const traceparent11: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsAddRelationshipOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate11: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsAddRelationshipOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent12: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsDeleteRelationshipOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate12: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsDeleteRelationshipOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch2: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsDeleteRelationshipOptions",
"ifMatch"
],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent13: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateRelationshipOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate13: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateRelationshipOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch3: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateRelationshipOptions",
"ifMatch"
],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent14: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListRelationshipsOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate14: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListRelationshipsOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const relationshipName: OperationQueryParameter = {
parameterPath: ["options", "relationshipName"],
mapper: {
serializedName: "relationshipName",
type: {
name: "String"
}
}
};
export const traceparent15: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListIncomingRelationshipsOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate15: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsListIncomingRelationshipsOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const telemetry: OperationParameter = {
parameterPath: "telemetry",
mapper: {
serializedName: "telemetry",
required: true,
type: {
name: "any"
}
}
};
export const traceparent16: OperationParameter = {
parameterPath: ["options", "digitalTwinsSendTelemetryOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate16: OperationParameter = {
parameterPath: ["options", "digitalTwinsSendTelemetryOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const messageId: OperationParameter = {
parameterPath: "messageId",
mapper: {
serializedName: "Message-Id",
required: true,
type: {
name: "String"
}
}
};
export const telemetrySourceTime: OperationParameter = {
parameterPath: ["options", "telemetrySourceTime"],
mapper: {
serializedName: "Telemetry-Source-Time",
type: {
name: "String"
}
}
};
export const traceparent17: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsSendComponentTelemetryOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate17: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsSendComponentTelemetryOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const componentPath: OperationURLParameter = {
parameterPath: "componentPath",
mapper: {
serializedName: "componentPath",
required: true,
type: {
name: "String"
}
}
};
export const traceparent18: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetComponentOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate18: OperationParameter = {
parameterPath: ["options", "digitalTwinsGetComponentOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent19: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateComponentOptions",
"traceparent"
],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate19: OperationParameter = {
parameterPath: [
"options",
"digitalTwinsUpdateComponentOptions",
"tracestate"
],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const ifMatch4: OperationParameter = {
parameterPath: ["options", "digitalTwinsUpdateComponentOptions", "ifMatch"],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const traceparent20: OperationParameter = {
parameterPath: ["options", "eventRoutesListOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate20: OperationParameter = {
parameterPath: ["options", "eventRoutesListOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const maxItemsPerPage2: OperationParameter = {
parameterPath: ["options", "eventRoutesListOptions", "maxItemsPerPage"],
mapper: {
serializedName: "max-items-per-page",
type: {
name: "Number"
}
}
};
export const traceparent21: OperationParameter = {
parameterPath: ["options", "eventRoutesGetByIdOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate21: OperationParameter = {
parameterPath: ["options", "eventRoutesGetByIdOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const eventRoute: OperationParameter = {
parameterPath: ["options", "eventRoute"],
mapper: EventRouteMapper
};
export const traceparent22: OperationParameter = {
parameterPath: ["options", "eventRoutesAddOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate22: OperationParameter = {
parameterPath: ["options", "eventRoutesAddOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};
export const traceparent23: OperationParameter = {
parameterPath: ["options", "eventRoutesDeleteOptions", "traceparent"],
mapper: {
serializedName: "traceparent",
type: {
name: "String"
}
}
};
export const tracestate23: OperationParameter = {
parameterPath: ["options", "eventRoutesDeleteOptions", "tracestate"],
mapper: {
serializedName: "tracestate",
type: {
name: "String"
}
}
};

Просмотреть файл

@ -17,6 +17,8 @@ import {
DigitalTwinModelsListResponse,
DigitalTwinModelsGetByIdOptionalParams,
DigitalTwinModelsGetByIdResponse,
DigitalTwinModelsUpdateOptionalParams,
DigitalTwinModelsDeleteOptionalParams,
DigitalTwinModelsListNextOptionalParams,
DigitalTwinModelsListNextResponse
} from "../models";
@ -38,9 +40,14 @@ export class DigitalTwinModels {
/**
* Uploads one or more models. When any error occurs, no models are uploaded.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 409 (Conflict): One or more of the provided models already exist.
* * 201 Created
* * 400 Bad Request
* * DTDLParserError - The models provided are not valid DTDL.
* * InvalidArgument - The model id is invalid.
* * LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached.
* * ModelVersionNotSupported - The version of DTDL used is not supported.
* * 409 Conflict
* * ModelAlreadyExists - The model provided already exists.
* @param options The options parameters.
*/
add(
@ -58,8 +65,12 @@ export class DigitalTwinModels {
/**
* Retrieves model metadata and, optionally, model definitions.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The model id is invalid.
* * LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached.
* * 404 Not Found
* * ModelNotFound - The model was not found.
* @param options The options parameters.
*/
list(
@ -77,8 +88,12 @@ export class DigitalTwinModels {
/**
* Retrieves model metadata and optionally the model definition.
* Status codes:
* 200 (OK): Success.
* 404 (Not Found): There is no model with the provided id.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The model id is invalid.
* * MissingArgument - The model id was not provided.
* * 404 Not Found
* * ModelNotFound - The model was not found.
* @param id The id for the model. The id is globally unique and case sensitive.
* @param options The options parameters.
*/
@ -98,9 +113,15 @@ export class DigitalTwinModels {
/**
* Updates the metadata for a model.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is no model with the provided id.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The model id is invalid.
* * JsonPatchInvalid - The JSON Patch provided is invalid.
* * MissingArgument - The model id was not provided.
* * 404 Not Found
* * ModelNotFound - The model was not found.
* * 409 Conflict
* * ModelReferencesNotDecommissioned - The model refers to models that are not decommissioned.
* @param id The id for the model. The id is globally unique and case sensitive.
* @param updateModel An update specification described by JSON Patch. Only the decommissioned property
* can be replaced.
@ -109,7 +130,7 @@ export class DigitalTwinModels {
update(
id: string,
updateModel: any[],
options?: coreHttp.OperationOptions
options?: DigitalTwinModelsUpdateOptionalParams
): Promise<coreHttp.RestResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -123,16 +144,20 @@ export class DigitalTwinModels {
/**
* Deletes a model. A model can only be deleted if no other models reference it.
* Status codes:
* 204 (No Content): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is no model with the provided id.
* 409 (Conflict): There are dependencies on the model that prevent it from being deleted.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The model id is invalid.
* * MissingArgument - The model id was not provided.
* * 404 Not Found
* * ModelNotFound - The model was not found.
* * 409 Conflict
* * ModelReferencesNotDeleted - The model refers to models that are not deleted.
* @param id The id for the model. The id is globally unique and case sensitive.
* @param options The options parameters.
*/
delete(
id: string,
options?: coreHttp.OperationOptions
options?: DigitalTwinModelsDeleteOptionalParams
): Promise<coreHttp.RestResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -173,7 +198,9 @@ const addOperationSpec: coreHttp.OperationSpec = {
bodyMapper: {
type: {
name: "Sequence",
element: { type: { name: "Composite", className: "ModelData" } }
element: {
type: { name: "Composite", className: "DigitalTwinsModelData" }
}
}
}
},
@ -184,7 +211,11 @@ const addOperationSpec: coreHttp.OperationSpec = {
requestBody: Parameters.models,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.contentType],
headerParameters: [
Parameters.contentType,
Parameters.traceparent,
Parameters.tracestate
],
mediaType: "json",
serializer
};
@ -193,7 +224,7 @@ const listOperationSpec: coreHttp.OperationSpec = {
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PagedModelDataCollection
bodyMapper: Mappers.PagedDigitalTwinsModelDataCollection
},
default: {
bodyMapper: Mappers.ErrorResponse
@ -205,7 +236,11 @@ const listOperationSpec: coreHttp.OperationSpec = {
Parameters.includeModelDefinition
],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.maxItemCount],
headerParameters: [
Parameters.traceparent1,
Parameters.tracestate1,
Parameters.maxItemsPerPage
],
serializer
};
const getByIdOperationSpec: coreHttp.OperationSpec = {
@ -213,7 +248,7 @@ const getByIdOperationSpec: coreHttp.OperationSpec = {
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.ModelData
bodyMapper: Mappers.DigitalTwinsModelData
},
default: {
bodyMapper: Mappers.ErrorResponse
@ -221,6 +256,7 @@ const getByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion, Parameters.includeModelDefinition],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent2, Parameters.tracestate2],
serializer
};
const updateOperationSpec: coreHttp.OperationSpec = {
@ -235,7 +271,11 @@ const updateOperationSpec: coreHttp.OperationSpec = {
requestBody: Parameters.updateModel,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.contentType1],
headerParameters: [
Parameters.contentType1,
Parameters.traceparent3,
Parameters.tracestate3
],
mediaType: "json",
serializer
};
@ -250,6 +290,7 @@ const deleteOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent4, Parameters.tracestate4],
serializer
};
const listNextOperationSpec: coreHttp.OperationSpec = {
@ -257,7 +298,7 @@ const listNextOperationSpec: coreHttp.OperationSpec = {
httpMethod: "GET",
responses: {
200: {
bodyMapper: Mappers.PagedModelDataCollection
bodyMapper: Mappers.PagedDigitalTwinsModelDataCollection
},
default: {
bodyMapper: Mappers.ErrorResponse
@ -269,6 +310,10 @@ const listNextOperationSpec: coreHttp.OperationSpec = {
Parameters.includeModelDefinition
],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.maxItemCount],
headerParameters: [
Parameters.traceparent1,
Parameters.tracestate1,
Parameters.maxItemsPerPage
],
serializer
};

Просмотреть файл

@ -11,11 +11,14 @@ import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { AzureDigitalTwinsAPI } from "../azureDigitalTwinsAPI";
import {
DigitalTwinsGetByIdOptionalParams,
DigitalTwinsGetByIdResponse,
DigitalTwinsAddOptionalParams,
DigitalTwinsAddResponse,
DigitalTwinsDeleteOptionalParams,
DigitalTwinsUpdateOptionalParams,
DigitalTwinsUpdateResponse,
DigitalTwinsGetRelationshipByIdOptionalParams,
DigitalTwinsGetRelationshipByIdResponse,
DigitalTwinsAddRelationshipOptionalParams,
DigitalTwinsAddRelationshipResponse,
@ -24,14 +27,17 @@ import {
DigitalTwinsUpdateRelationshipResponse,
DigitalTwinsListRelationshipsOptionalParams,
DigitalTwinsListRelationshipsResponse,
DigitalTwinsListIncomingRelationshipsOptionalParams,
DigitalTwinsListIncomingRelationshipsResponse,
DigitalTwinsSendTelemetryOptionalParams,
DigitalTwinsSendComponentTelemetryOptionalParams,
DigitalTwinsGetComponentOptionalParams,
DigitalTwinsGetComponentResponse,
DigitalTwinsUpdateComponentOptionalParams,
DigitalTwinsUpdateComponentResponse,
DigitalTwinsListRelationshipsNextOptionalParams,
DigitalTwinsListRelationshipsNextResponse,
DigitalTwinsListIncomingRelationshipsNextOptionalParams,
DigitalTwinsListIncomingRelationshipsNextResponse
} from "../models";
@ -52,14 +58,17 @@ export class DigitalTwins {
/**
* Retrieves a digital twin.
* Status codes:
* 200 (OK): Success.
* 404 (Not Found): There is no digital twin with the provided id.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The digital twin id is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param options The options parameters.
*/
getById(
id: string,
options?: coreHttp.OperationOptions
options?: DigitalTwinsGetByIdOptionalParams
): Promise<DigitalTwinsGetByIdResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -73,10 +82,14 @@ export class DigitalTwins {
/**
* Adds or replaces a digital twin.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 412 (Precondition Failed): The model is decommissioned or the digital twin already exists (when
* using If-None-Match: *).
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The digital twin id or payload is invalid.
* * ModelDecommissioned - The model for the digital twin is decommissioned.
* * TwinLimitReached - The maximum number of digital twins allowed has been reached.
* * ValidationFailed - The digital twin payload is not valid.
* * 412 Precondition Failed
* * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param twin The digital twin instance being added. If provided, the $dtId property is ignored.
* @param options The options parameters.
@ -84,7 +97,7 @@ export class DigitalTwins {
add(
id: string,
twin: any,
options?: coreHttp.OperationOptions
options?: DigitalTwinsAddOptionalParams
): Promise<DigitalTwinsAddResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -98,9 +111,14 @@ export class DigitalTwins {
/**
* Deletes a digital twin. All relationships referencing the digital twin must already be deleted.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is no digital twin with the provided id.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The digital twin id is invalid.
* * RelationshipsNotDeleted - The digital twin contains relationships.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * 412 Precondition Failed
* * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param options The options parameters.
*/
@ -120,9 +138,15 @@ export class DigitalTwins {
/**
* Updates a digital twin.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is no digital twin with the provided id.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The digital twin id or payload is invalid.
* * JsonPatchInvalid - The JSON Patch provided is invalid.
* * ValidationFailed - Applying the patch results in an invalid digital twin.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * 412 Precondition Failed
* * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param patchDocument 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.
@ -145,8 +169,12 @@ export class DigitalTwins {
/**
* Retrieves a relationship between two digital twins.
* Status codes:
* 200 (OK): Success.
* 404 (Not Found): There is either no digital twin or relationship with the provided id.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The digital twin id or relationship id is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * RelationshipNotFound - The relationship was not found.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param relationshipId The id of the relationship. The id is unique within the digital twin and case
* sensitive.
@ -155,7 +183,7 @@ export class DigitalTwins {
getRelationshipById(
id: string,
relationshipId: string,
options?: coreHttp.OperationOptions
options?: DigitalTwinsGetRelationshipByIdOptionalParams
): Promise<DigitalTwinsGetRelationshipByIdResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -169,26 +197,34 @@ export class DigitalTwins {
/**
* Adds a relationship between two digital twins.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is either no digital twin, target digital twin, or relationship with the
* provided id.
* 409 (Conflict): A relationship with the provided id already exists.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The digital twin id, relationship id, or payload is invalid.
* * InvalidRelationship - The relationship is invalid.
* * OperationNotAllowed - The relationship cannot connect to the same digital twin.
* * ValidationFailed - The relationship content is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * TargetTwinNotFound - The digital twin target of the relationship was not found.
* * 412 Precondition Failed
* * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param relationshipId The id of the relationship. The id is unique within the digital twin and case
* sensitive.
* @param relationship The data for the relationship.
* @param options The options parameters.
*/
addRelationship(
id: string,
relationshipId: string,
relationship: any,
options?: DigitalTwinsAddRelationshipOptionalParams
): Promise<DigitalTwinsAddRelationshipResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
return this.client.sendOperationRequest(
{ id, relationshipId, options: operationOptions },
{ id, relationshipId, relationship, options: operationOptions },
addRelationshipOperationSpec
) as Promise<DigitalTwinsAddRelationshipResponse>;
}
@ -196,8 +232,14 @@ export class DigitalTwins {
/**
* Deletes a relationship between two digital twins.
* Status codes:
* 200 (OK): Success.
* 404 (Not Found): There is either no digital twin or relationship with the provided id.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The digital twin id or relationship id is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * RelationshipNotFound - The relationship was not found.
* * 412 Precondition Failed
* * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param relationshipId The id of the relationship. The id is unique within the digital twin and case
* sensitive.
@ -220,24 +262,36 @@ export class DigitalTwins {
/**
* Updates the properties on a relationship between two digital twins.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is either no digital twin or relationship with the provided id.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The digital twin id or relationship id is invalid.
* * InvalidRelationship - The relationship is invalid.
* * JsonPatchInvalid - The JSON Patch provided is invalid.
* * ValidationFailed - The relationship content is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * RelationshipNotFound - The relationship was not found.
* * 409 Conflict
* * RelationshipAlreadyExists - The relationship already exists.
* * 412 Precondition Failed
* * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param relationshipId The id of the relationship. The id is unique within the digital twin and case
* sensitive.
* @param patchDocument JSON Patch description of the update to the relationship properties.
* @param options The options parameters.
*/
updateRelationship(
id: string,
relationshipId: string,
patchDocument: any[],
options?: DigitalTwinsUpdateRelationshipOptionalParams
): Promise<DigitalTwinsUpdateRelationshipResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
return this.client.sendOperationRequest(
{ id, relationshipId, options: operationOptions },
{ id, relationshipId, patchDocument, options: operationOptions },
updateRelationshipOperationSpec
) as Promise<DigitalTwinsUpdateRelationshipResponse>;
}
@ -245,9 +299,11 @@ export class DigitalTwins {
/**
* Retrieves the relationships from a digital twin.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is no digital twin with the provided id.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The digital twin id is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param options The options parameters.
*/
@ -267,15 +323,17 @@ export class DigitalTwins {
/**
* Retrieves all incoming relationship for a digital twin.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is no digital twin with the provided id.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The digital twin id is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param options The options parameters.
*/
listIncomingRelationships(
id: string,
options?: coreHttp.OperationOptions
options?: DigitalTwinsListIncomingRelationshipsOptionalParams
): Promise<DigitalTwinsListIncomingRelationshipsResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -289,18 +347,21 @@ export class DigitalTwins {
/**
* Sends telemetry on behalf of a digital twin.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is no digital twin with the provided id.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The digital twin id or message id is invalid.
* * ValidationFailed - The telemetry content is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param dtId A unique message identifier (in the scope of the digital twin id) that is commonly used
* for de-duplicating messages.
* @param messageId A unique message identifier (in the scope of the digital twin id) that is commonly
* used for de-duplicating messages.
* @param telemetry The telemetry measurements to send from the digital twin.
* @param options The options parameters.
*/
sendTelemetry(
id: string,
dtId: string,
messageId: string,
telemetry: any,
options?: DigitalTwinsSendTelemetryOptionalParams
): Promise<coreHttp.RestResponse> {
@ -308,7 +369,7 @@ export class DigitalTwins {
options || {}
);
return this.client.sendOperationRequest(
{ id, dtId, telemetry, options: operationOptions },
{ id, messageId, telemetry, options: operationOptions },
sendTelemetryOperationSpec
) as Promise<coreHttp.RestResponse>;
}
@ -316,21 +377,24 @@ export class DigitalTwins {
/**
* Sends telemetry on behalf of a component in a digital twin.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is either no digital twin with the provided id or the component path is
* invalid.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The digital twin id, message id, or component path is invalid.
* * ValidationFailed - The telemetry content is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * ComponentNotFound - The component path was not found.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param componentPath The name of the DTDL component.
* @param dtId A unique message identifier (in the scope of the digital twin id) that is commonly used
* for de-duplicating messages.
* @param messageId A unique message identifier (in the scope of the digital twin id) that is commonly
* used for de-duplicating messages.
* @param telemetry The telemetry measurements to send from the digital twin's component.
* @param options The options parameters.
*/
sendComponentTelemetry(
id: string,
componentPath: string,
dtId: string,
messageId: string,
telemetry: any,
options?: DigitalTwinsSendComponentTelemetryOptionalParams
): Promise<coreHttp.RestResponse> {
@ -338,7 +402,7 @@ export class DigitalTwins {
options || {}
);
return this.client.sendOperationRequest(
{ id, componentPath, dtId, telemetry, options: operationOptions },
{ id, componentPath, messageId, telemetry, options: operationOptions },
sendComponentTelemetryOperationSpec
) as Promise<coreHttp.RestResponse>;
}
@ -346,9 +410,12 @@ export class DigitalTwins {
/**
* Retrieves a component from a digital twin.
* Status codes:
* 200 (OK): Success.
* 404 (Not Found): There is either no digital twin with the provided id or the component path is
* invalid.
* * 200 OK
* * 400 Bad Request
* * InvalidArgument - The digital twin id or component path is invalid.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * ComponentNotFound - The component path was not found.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param componentPath The name of the DTDL component.
* @param options The options parameters.
@ -356,7 +423,7 @@ export class DigitalTwins {
getComponent(
id: string,
componentPath: string,
options?: coreHttp.OperationOptions
options?: DigitalTwinsGetComponentOptionalParams
): Promise<DigitalTwinsGetComponentResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -370,24 +437,32 @@ export class DigitalTwins {
/**
* Updates a component on a digital twin.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* 404 (Not Found): There is either no digital twin with the provided id or the component path is
* invalid.
* * 204 No Content
* * 400 Bad Request
* * InvalidArgument - The digital twin id, component path, or payload is invalid.
* * JsonPatchInvalid - The JSON Patch provided is invalid.
* * ValidationFailed - Applying the patch results in an invalid digital twin.
* * 404 Not Found
* * DigitalTwinNotFound - The digital twin was not found.
* * 412 Precondition Failed
* * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
* @param id The id of the digital twin. The id is unique within the service and case sensitive.
* @param componentPath The name of the DTDL component.
* @param patchDocument 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.
* @param options The options parameters.
*/
updateComponent(
id: string,
componentPath: string,
patchDocument: any[],
options?: DigitalTwinsUpdateComponentOptionalParams
): Promise<DigitalTwinsUpdateComponentResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
);
return this.client.sendOperationRequest(
{ id, componentPath, options: operationOptions },
{ id, componentPath, patchDocument, options: operationOptions },
updateComponentOperationSpec
) as Promise<DigitalTwinsUpdateComponentResponse>;
}
@ -422,7 +497,7 @@ export class DigitalTwins {
listIncomingRelationshipsNext(
id: string,
nextLink: string,
options?: coreHttp.OperationOptions
options?: DigitalTwinsListIncomingRelationshipsNextOptionalParams
): Promise<DigitalTwinsListIncomingRelationshipsNextResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -451,6 +526,7 @@ const getByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent6, Parameters.tracestate6],
serializer
};
const addOperationSpec: coreHttp.OperationSpec = {
@ -469,7 +545,12 @@ const addOperationSpec: coreHttp.OperationSpec = {
requestBody: Parameters.twin,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.contentType, Parameters.ifNoneMatch],
headerParameters: [
Parameters.contentType,
Parameters.traceparent7,
Parameters.tracestate7,
Parameters.ifNoneMatch
],
mediaType: "json",
serializer
};
@ -484,7 +565,11 @@ const deleteOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.ifMatch],
headerParameters: [
Parameters.traceparent8,
Parameters.tracestate8,
Parameters.ifMatch
],
serializer
};
const updateOperationSpec: coreHttp.OperationSpec = {
@ -502,7 +587,12 @@ const updateOperationSpec: coreHttp.OperationSpec = {
requestBody: Parameters.patchDocument,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.contentType1, Parameters.ifMatch],
headerParameters: [
Parameters.contentType1,
Parameters.traceparent9,
Parameters.tracestate9,
Parameters.ifMatch1
],
mediaType: "json",
serializer
};
@ -520,6 +610,7 @@ const getRelationshipByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [Parameters.traceparent10, Parameters.tracestate10],
serializer
};
const addRelationshipOperationSpec: coreHttp.OperationSpec = {
@ -537,7 +628,12 @@ const addRelationshipOperationSpec: coreHttp.OperationSpec = {
requestBody: Parameters.relationship,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [Parameters.contentType, Parameters.ifNoneMatch],
headerParameters: [
Parameters.contentType,
Parameters.ifNoneMatch,
Parameters.traceparent11,
Parameters.tracestate11
],
mediaType: "json",
serializer
};
@ -552,7 +648,11 @@ const deleteRelationshipOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [Parameters.ifMatch],
headerParameters: [
Parameters.traceparent12,
Parameters.tracestate12,
Parameters.ifMatch2
],
serializer
};
const updateRelationshipOperationSpec: coreHttp.OperationSpec = {
@ -566,10 +666,15 @@ const updateRelationshipOperationSpec: coreHttp.OperationSpec = {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.patchDocument1,
requestBody: Parameters.patchDocument,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.relationshipId],
headerParameters: [Parameters.contentType1, Parameters.ifMatch],
headerParameters: [
Parameters.contentType1,
Parameters.traceparent13,
Parameters.tracestate13,
Parameters.ifMatch3
],
mediaType: "json",
serializer
};
@ -586,6 +691,7 @@ const listRelationshipsOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion, Parameters.relationshipName],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent14, Parameters.tracestate14],
serializer
};
const listIncomingRelationshipsOperationSpec: coreHttp.OperationSpec = {
@ -601,6 +707,7 @@ const listIncomingRelationshipsOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent15, Parameters.tracestate15],
serializer
};
const sendTelemetryOperationSpec: coreHttp.OperationSpec = {
@ -617,8 +724,10 @@ const sendTelemetryOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [
Parameters.contentType,
Parameters.dtId,
Parameters.timestamp
Parameters.traceparent16,
Parameters.tracestate16,
Parameters.messageId,
Parameters.telemetrySourceTime
],
mediaType: "json",
serializer
@ -637,8 +746,10 @@ const sendComponentTelemetryOperationSpec: coreHttp.OperationSpec = {
urlParameters: [Parameters.$host, Parameters.id, Parameters.componentPath],
headerParameters: [
Parameters.contentType,
Parameters.dtId,
Parameters.timestamp
Parameters.messageId,
Parameters.telemetrySourceTime,
Parameters.traceparent17,
Parameters.tracestate17
],
mediaType: "json",
serializer
@ -657,6 +768,7 @@ const getComponentOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.componentPath],
headerParameters: [Parameters.traceparent18, Parameters.tracestate18],
serializer
};
const updateComponentOperationSpec: coreHttp.OperationSpec = {
@ -671,10 +783,15 @@ const updateComponentOperationSpec: coreHttp.OperationSpec = {
bodyMapper: Mappers.ErrorResponse
}
},
requestBody: Parameters.patchDocument1,
requestBody: Parameters.patchDocument,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.componentPath],
headerParameters: [Parameters.contentType1, Parameters.ifMatch],
headerParameters: [
Parameters.contentType1,
Parameters.traceparent19,
Parameters.tracestate19,
Parameters.ifMatch4
],
mediaType: "json",
serializer
};
@ -691,6 +808,7 @@ const listRelationshipsNextOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion, Parameters.relationshipName],
urlParameters: [Parameters.$host, Parameters.id, Parameters.nextLink],
headerParameters: [Parameters.traceparent14, Parameters.tracestate14],
serializer
};
const listIncomingRelationshipsNextOperationSpec: coreHttp.OperationSpec = {
@ -706,5 +824,6 @@ const listIncomingRelationshipsNextOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id, Parameters.nextLink],
headerParameters: [Parameters.traceparent15, Parameters.tracestate15],
serializer
};

Просмотреть файл

@ -13,8 +13,10 @@ import { AzureDigitalTwinsAPI } from "../azureDigitalTwinsAPI";
import {
EventRoutesListOptionalParams,
EventRoutesListResponse,
EventRoutesGetByIdOptionalParams,
EventRoutesGetByIdResponse,
EventRoutesAddOptionalParams,
EventRoutesDeleteOptionalParams,
EventRoutesListNextOptionalParams,
EventRoutesListNextResponse
} from "../models";
@ -36,8 +38,7 @@ export class EventRoutes {
/**
* Retrieves all event routes.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* * 200 OK
* @param options The options parameters.
*/
list(
@ -55,14 +56,15 @@ export class EventRoutes {
/**
* Retrieves an event route.
* Status codes:
* 200 (OK): Success.
* 404 (Not Found): There is no event route with the provided id.
* * 200 OK
* * 404 Not Found
* * EventRouteNotFound - The event route was not found.
* @param id The id for an event route. The id is unique within event routes and case sensitive.
* @param options The options parameters.
*/
getById(
id: string,
options?: coreHttp.OperationOptions
options?: EventRoutesGetByIdOptionalParams
): Promise<EventRoutesGetByIdResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -76,8 +78,12 @@ export class EventRoutes {
/**
* Adds or replaces an event route.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* * 204 No Content
* * 400 Bad Request
* * EventRouteEndpointInvalid - The endpoint provided does not exist or is not active.
* * EventRouteFilterInvalid - The event route filter is invalid.
* * EventRouteIdInvalid - The event route id is invalid.
* * LimitExceeded - The maximum number of event routes allowed has been reached.
* @param id The id for an event route. The id is unique within event routes and case sensitive.
* @param options The options parameters.
*/
@ -97,14 +103,15 @@ export class EventRoutes {
/**
* Deletes an event route.
* Status codes:
* 200 (OK): Success.
* 404 (Not Found): There is no event route with the provided id.
* * 204 No Content
* * 404 Not Found
* * EventRouteNotFound - The event route was not found.
* @param id The id for an event route. The id is unique within event routes and case sensitive.
* @param options The options parameters.
*/
delete(
id: string,
options?: coreHttp.OperationOptions
options?: EventRoutesDeleteOptionalParams
): Promise<coreHttp.RestResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -150,7 +157,11 @@ const listOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.maxItemCount1],
headerParameters: [
Parameters.traceparent20,
Parameters.tracestate20,
Parameters.maxItemsPerPage2
],
serializer
};
const getByIdOperationSpec: coreHttp.OperationSpec = {
@ -166,6 +177,7 @@ const getByIdOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent21, Parameters.tracestate21],
serializer
};
const addOperationSpec: coreHttp.OperationSpec = {
@ -180,7 +192,11 @@ const addOperationSpec: coreHttp.OperationSpec = {
requestBody: Parameters.eventRoute,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.contentType],
headerParameters: [
Parameters.contentType,
Parameters.traceparent22,
Parameters.tracestate22
],
mediaType: "json",
serializer
};
@ -195,6 +211,7 @@ const deleteOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.id],
headerParameters: [Parameters.traceparent23, Parameters.tracestate23],
serializer
};
const listNextOperationSpec: coreHttp.OperationSpec = {
@ -210,6 +227,10 @@ const listNextOperationSpec: coreHttp.OperationSpec = {
},
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host, Parameters.nextLink],
headerParameters: [Parameters.maxItemCount1],
headerParameters: [
Parameters.traceparent20,
Parameters.tracestate20,
Parameters.maxItemsPerPage2
],
serializer
};

Просмотреть файл

@ -10,7 +10,11 @@ import * as coreHttp from "@azure/core-http";
import * as Mappers from "../models/mappers";
import * as Parameters from "../models/parameters";
import { AzureDigitalTwinsAPI } from "../azureDigitalTwinsAPI";
import { QuerySpecification, QueryQueryTwinsResponse } from "../models";
import {
QuerySpecification,
QueryQueryTwinsOptionalParams,
QueryQueryTwinsResponse
} from "../models";
/**
* Class representing a Query.
@ -29,14 +33,18 @@ export class Query {
/**
* Executes a query that allows traversing relationships and filtering by property values.
* Status codes:
* 200 (OK): Success.
* 400 (Bad Request): The request is invalid.
* * 200 OK
* * 400 Bad Request
* * BadRequest - The continuation token is invalid.
* * SqlQueryError - The query contains some errors.
* * 429 Too Many Requests
* * QuotaReachedError - The maximum query rate limit has been reached.
* @param querySpecification The query specification to execute.
* @param options The options parameters.
*/
queryTwins(
querySpecification: QuerySpecification,
options?: coreHttp.OperationOptions
options?: QueryQueryTwinsOptionalParams
): Promise<QueryQueryTwinsResponse> {
const operationOptions: coreHttp.RequestOptionsBase = coreHttp.operationOptionsToRequestOptionsBase(
options || {}
@ -66,7 +74,12 @@ const queryTwinsOperationSpec: coreHttp.OperationSpec = {
requestBody: Parameters.querySpecification,
queryParameters: [Parameters.apiVersion],
urlParameters: [Parameters.$host],
headerParameters: [Parameters.contentType],
headerParameters: [
Parameters.contentType,
Parameters.traceparent5,
Parameters.tracestate5,
Parameters.maxItemsPerPage1
],
mediaType: "json",
serializer
};

Просмотреть файл

@ -10,44 +10,32 @@ export {
DigitalTwinsUpdateHeaders,
DigitalTwinsGetByIdHeaders,
DigitalTwinsAddRelationshipHeaders,
DigitalTwinsAddRelationshipOptionalParams,
DigitalTwinsAddRelationshipResponse,
DigitalTwinsUpdateRelationshipOptionalParams,
DigitalTwinsUpdateRelationshipResponse,
DigitalTwinsUpdateRelationshipHeaders,
DigitalTwinsListRelationshipsOptionalParams,
DigitalTwinsListRelationshipsResponse,
DigitalTwinsDeleteRelationshipOptionalParams,
RelationshipCollection,
DigitalTwinsListIncomingRelationshipsResponse,
IncomingRelationship,
IncomingRelationshipCollection,
DigitalTwinsSendComponentTelemetryOptionalParams,
DigitalTwinsGetRelationshipByIdHeaders,
DigitalTwinsGetRelationshipByIdResponse,
DigitalTwinsUpdateComponentHeaders,
DigitalTwinsGetComponentHeaders,
DigitalTwinsUpdateComponentOptionalParams,
DigitalTwinsUpdateComponentResponse,
DigitalTwinsGetComponentResponse,
DigitalTwinsSendTelemetryOptionalParams,
DigitalTwinModelsGetByIdResponse,
DigitalTwinModelsListOptionalParams,
DigitalTwinModelsListResponse,
DigitalTwinModelsListOptions,
DigitalTwinModelsAddResponse,
DigitalTwinModelsAddOptionalParams,
DigitalTwinsUpdateOptionalParams,
DigitalTwinsUpdateResponse,
EventRoute,
EventRouteCollection,
EventRoutesAddOptionalParams,
EventRoutesGetByIdResponse,
EventRoutesListNextResponse,
EventRoutesListOptionalParams,
EventRoutesListOptions,
ModelData,
PagedModelDataCollection,
DigitalTwinsModelData,
QueryQueryTwinsHeaders,
QueryQueryTwinsResponse,
QueryResult,
QuerySpecification
QuerySpecification,
PagedDigitalTwinsModelDataCollection
} from "./generated/models";

Просмотреть файл

@ -6,4 +6,4 @@ import { createClientLogger } from "@azure/logger";
/**
* The @azure/logger configuration for this package.
*/
export const logger = createClientLogger("azure-digitaltwins");
export const logger = createClientLogger("azure-digitaltwins-core");

Просмотреть файл

@ -4,7 +4,7 @@
```yaml
typescript:
package-name: "@azure/digital-twins"
package-name: "@azure/digital-twins-core"
title: GeneratedClient
description: Digitaltwins Client
use-extension:
@ -12,7 +12,7 @@ use-extension:
generate-metadata: false
add-credentials: false
license-header: MICROSOFT_MIT_NO_VERSION
input-file: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/digitaltwins/data-plane/Microsoft.DigitalTwins/preview/2020-05-31-preview/digitaltwins.json
input-file: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/digitaltwins/data-plane/Microsoft.DigitalTwins/stable/2020-10-31/digitaltwins.json
output-folder: ../
source-code-folder-path: ./src/generated
```

Просмотреть файл

@ -48,6 +48,7 @@ describe("DigitalTwinsClient", () => {
let testBody: any;
let testHeaders: any;
let testError: Error;
let decommissionPatch: any[];
beforeEach(async function() {
operationOptions = {
@ -93,6 +94,7 @@ describe("DigitalTwinsClient", () => {
etag: testEtag
};
testError = new Error("Promise Rejected");
decommissionPatch = [{ op: "replace", path: "/decommissioned", value: true }];
});
it(`Constructor creates an instance of the DigitalTwinsClient`, function() {
@ -156,8 +158,13 @@ describe("DigitalTwinsClient", () => {
});
it("updateDigitalTwin calls the update method with twinId, jsonPatch and converted options on the generated client", function() {
const expectedOptions: DigitalTwinsUpdateOptionalParams = operationOptions;
expectedOptions.ifMatch = testEtag;
var expectedOptions: DigitalTwinsUpdateOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsUpdateOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const stub = sinon.stub(testClient["client"].digitalTwins, "update");
testClient.updateDigitalTwin(testTwinId, testJsonPatch, testEtag, operationOptions);
assert.isTrue(stub.calledOnce);
@ -179,8 +186,14 @@ describe("DigitalTwinsClient", () => {
});
it("deleteDigitalTwin calls the deleteMethod method with twinId and converted options on the generated client", function() {
const expectedOptions: DigitalTwinsDeleteOptionalParams = operationOptions;
expectedOptions.ifMatch = testEtag;
var expectedOptions: DigitalTwinsDeleteOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsDeleteOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const stub = sinon.stub(testClient["client"].digitalTwins, "delete");
testClient.deleteDigitalTwin(testTwinId, testEtag, operationOptions);
assert.isTrue(stub.calledOnce);
@ -225,9 +238,13 @@ describe("DigitalTwinsClient", () => {
});
it("updateComponent calls the updateComponent method with twinId, componentPath, jsonPatch and converted options on the generated client", function() {
const expectedOptions: DigitalTwinsUpdateComponentOptionalParams = operationOptions;
expectedOptions.ifMatch = testEtag;
expectedOptions.patchDocument = testJsonPatch;
var expectedOptions: DigitalTwinsUpdateComponentOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsUpdateComponentOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const stub = sinon.stub(testClient["client"].digitalTwins, "updateComponent");
testClient.updateComponent(
@ -238,21 +255,23 @@ describe("DigitalTwinsClient", () => {
operationOptions
);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testComponentPath, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testComponentPath, testJsonPatch, expectedOptions));
});
it("updateComponent returns a promise of the generated code return value", async () => {
const testReturn = testHeaders + testDefaultResponse;
sinon.stub(testClient["client"].digitalTwins, "updateComponent").resolves(testReturn);
const retVal = await testClient.updateComponent(testTwinId, testComponentPath);
const retVal = await testClient.updateComponent(testTwinId, testComponentPath, testJsonPatch);
assert.deepEqual(retVal, testReturn);
});
it("updateComponent rejects the promise if the generated code rejects it", async () => {
sinon.stub(testClient["client"].digitalTwins, "updateComponent").rejects(testError);
await testClient.updateComponent(testTwinId, testComponentPath).catch((error) => {
expect(error.message).to.equal("Promise Rejected");
});
await testClient
.updateComponent(testTwinId, testComponentPath, testJsonPatch)
.catch((error) => {
expect(error.message).to.equal("Promise Rejected");
});
});
it("getRelationship calls the getRelationshipById method with twinId and relationshipId on the generated client if there is no option defined", function() {
@ -284,12 +303,11 @@ describe("DigitalTwinsClient", () => {
});
it("upsertRelationship calls the addRelationship method with twinId, relationshipId, relationshipJson and converted options on the generated client", function() {
const expectedOptions: DigitalTwinsAddRelationshipOptionalParams = operationOptions;
expectedOptions.relationship = testJsonString;
var expectedOptions: DigitalTwinsAddRelationshipOptionalParams = operationOptions;
const stub = sinon.stub(testClient["client"].digitalTwins, "addRelationship");
testClient.upsertRelationship(testTwinId, testRelationshipId, testJsonString, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, testJsonString, expectedOptions));
});
it("upsertRelationship returns a promise of the generated code return value", async () => {
@ -313,9 +331,13 @@ describe("DigitalTwinsClient", () => {
});
it("updateRelationship calls the updateRelationship method with twinId, jsonPatch and converted options on the generated client", function() {
const expectedOptions: DigitalTwinsUpdateRelationshipOptionalParams = operationOptions;
expectedOptions.ifMatch = testEtag;
expectedOptions.patchDocument = testJsonPatch;
var expectedOptions: DigitalTwinsUpdateRelationshipOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsUpdateRelationshipOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const stub = sinon.stub(testClient["client"].digitalTwins, "updateRelationship");
testClient.updateRelationship(
@ -326,7 +348,7 @@ describe("DigitalTwinsClient", () => {
operationOptions
);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, expectedOptions));
assert.isTrue(stub.calledWith(testTwinId, testRelationshipId, testJsonPatch, expectedOptions));
});
it("updateRelationship returns a promise of the generated code return value", async () => {
@ -350,8 +372,13 @@ describe("DigitalTwinsClient", () => {
});
it("deleteRelationship calls the deleteRelationship method with twinId, relationshipId and converted options on the generated client", function() {
const expectedOptions: DigitalTwinsDeleteRelationshipOptionalParams = operationOptions;
expectedOptions.ifMatch = testEtag;
var expectedOptions: DigitalTwinsDeleteRelationshipOptionalParams = operationOptions;
expectedOptions = {
digitalTwinsDeleteRelationshipOptions: {
ifMatch: testEtag,
...operationOptions
}
};
const stub = sinon.stub(testClient["client"].digitalTwins, "deleteRelationship");
testClient.deleteRelationship(testTwinId, testRelationshipId, testEtag, operationOptions);
@ -386,7 +413,7 @@ describe("DigitalTwinsClient", () => {
it("publishTelemetry rejects the promise if the generated code rejects it", async () => {
sinon.stub(testClient["client"].digitalTwins, "sendTelemetry").rejects(testError);
await testClient.publishTelemetry(testTwinId, testPayload).catch((error) => {
await testClient.publishTelemetry(testTwinId, testPayload, testMessageId).catch((error) => {
expect(error.message).to.equal("Promise Rejected");
});
});
@ -450,9 +477,9 @@ describe("DigitalTwinsClient", () => {
it("decomissionModel calls the update method with modelId, patchJson and options on the generated client", function() {
const stub = sinon.stub(testClient["client"].digitalTwinModels, "update");
testClient.decomissionModel(testModelId, testJsonPatch, operationOptions);
testClient.decomissionModel(testModelId, operationOptions);
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testModelId, testJsonPatch, operationOptions));
assert.isTrue(stub.calledWith(testModelId, decommissionPatch, operationOptions));
});
it("decomissionModel returns a promise of the generated code return value", async () => {
@ -460,13 +487,13 @@ describe("DigitalTwinsClient", () => {
_response: testDefaultOperationalResponse
};
sinon.stub(testClient["client"].digitalTwinModels, "update").resolves(testReturn);
const retVal = await testClient.decomissionModel(testModelId, testJsonPatch);
const retVal = await testClient.decomissionModel(testModelId);
assert.deepEqual(retVal, testReturn);
});
it("decomissionModel rejects the promise if the generated code rejects it", async () => {
sinon.stub(testClient["client"].digitalTwinModels, "update").rejects(testError);
await testClient.decomissionModel(testModelId, testJsonPatch).catch((error) => {
await testClient.decomissionModel(testModelId).catch((error) => {
expect(error.message).to.equal("Promise Rejected");
});
});
@ -517,7 +544,7 @@ describe("DigitalTwinsClient", () => {
it("upsertEventRoute calls the add method with eventRouteId on the generated client if there is no option defined", function() {
const stub = sinon.stub(testClient["client"].eventRoutes, "add");
testClient.upsertEventRoute(testEventRouteId, testJsonString);
testClient.upsertEventRoute(testEventRouteId, testJsonString, "");
assert.isTrue(stub.calledOnce);
assert.isTrue(stub.calledWith(testEventRouteId));
});
@ -539,15 +566,21 @@ describe("DigitalTwinsClient", () => {
it("upsertEventRoute returns a promise of the generated code return value", async () => {
const testReturn = testHeaders + testBody + testDefaultOperationalResponse;
sinon.stub(testClient["client"].eventRoutes, "add").resolves(testReturn);
const retVal = await testClient.upsertEventRoute(testEventRouteId, testEndpointName);
const retVal = await testClient.upsertEventRoute(
testEventRouteId,
testEndpointName,
testFilter
);
assert.deepEqual(retVal, testReturn);
});
it("upsertEventRoute rejects the promise if the generated code rejects it", async () => {
sinon.stub(testClient["client"].eventRoutes, "add").rejects(testError);
await testClient.upsertEventRoute(testEventRouteId, testEndpointName).catch((error) => {
expect(error.message).to.equal("Promise Rejected");
});
await testClient
.upsertEventRoute(testEventRouteId, testEndpointName, testFilter)
.catch((error) => {
expect(error.message).to.equal("Promise Rejected");
});
});
it("deleteEventRoute calls the deleteMethod method with eventRouteId and options on the generated client", function() {

Просмотреть файл

@ -1,13 +0,0 @@
{
"name": "azure-digital-twins-js-samples",
"version": "1.0.0-preview.1",
"description": "Samples for the azure/digital-twins client library",
"author": "Microsoft Corporation",
"license": "MIT",
"main": "dt_scenario.js",
"dependencies": {
"@azure/digital-twins": "file:../..",
"@azure/core-http": "^1.1.6",
"@azure/identity": "^1.1.0"
}
}

Просмотреть файл

@ -1,300 +0,0 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
import {
OperationParameter,
OperationURLParameter,
OperationQueryParameter,
QueryCollectionFormat
} from "@azure/core-http";
import {
QuerySpecification as QuerySpecificationMapper,
EventRoute as EventRouteMapper
} from "../models/mappers";
export const contentType: OperationParameter = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
};
export const models: OperationParameter = {
parameterPath: ["options", "models"],
mapper: {
constraints: {
MinItems: 1,
UniqueItems: true
},
serializedName: "models",
type: {
name: "Sequence",
element: { type: { name: "any" } }
}
}
};
export const $host: OperationURLParameter = {
parameterPath: "$host",
mapper: {
serializedName: "$host",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const apiVersion: OperationQueryParameter = {
parameterPath: "apiVersion",
mapper: {
defaultValue: "2020-05-31-preview",
isConstant: true,
serializedName: "api-version",
type: {
name: "String"
}
}
};
export const dependenciesFor: OperationQueryParameter = {
parameterPath: ["options", "dependenciesFor"],
mapper: {
serializedName: "dependenciesFor",
type: {
name: "Sequence",
element: { type: { name: "String" } }
}
},
collectionFormat: QueryCollectionFormat.Csv
};
export const includeModelDefinition: OperationQueryParameter = {
parameterPath: ["options", "includeModelDefinition"],
mapper: {
serializedName: "includeModelDefinition",
type: {
name: "Boolean"
}
}
};
export const maxItemCount: OperationParameter = {
parameterPath: ["options", "digitalTwinModelsListOptions", "maxItemCount"],
mapper: {
defaultValue: -1,
serializedName: "x-ms-max-item-count",
type: {
name: "Number"
}
}
};
export const id: OperationURLParameter = {
parameterPath: "id",
mapper: {
serializedName: "id",
required: true,
type: {
name: "String"
}
}
};
export const contentType1: OperationParameter = {
parameterPath: ["options", "contentType"],
mapper: {
defaultValue: "application/json-patch+json",
isConstant: true,
serializedName: "Content-Type",
type: {
name: "String"
}
}
};
export const updateModel: OperationParameter = {
parameterPath: "updateModel",
mapper: {
serializedName: "updateModel",
required: true,
type: {
name: "Sequence",
element: { type: { name: "any" } }
}
}
};
export const nextLink: OperationURLParameter = {
parameterPath: "nextLink",
mapper: {
serializedName: "nextLink",
required: true,
type: {
name: "String"
}
},
skipEncoding: true
};
export const querySpecification: OperationParameter = {
parameterPath: "querySpecification",
mapper: QuerySpecificationMapper
};
export const twin: OperationParameter = {
parameterPath: "twin",
mapper: {
serializedName: "twin",
required: true,
type: {
name: "any"
}
}
};
export const ifNoneMatch: OperationParameter = {
parameterPath: ["options", "ifNoneMatch"],
mapper: {
defaultValue: "*",
isConstant: true,
serializedName: "If-None-Match",
type: {
name: "String"
}
}
};
export const ifMatch: OperationParameter = {
parameterPath: ["options", "ifMatch"],
mapper: {
serializedName: "If-Match",
type: {
name: "String"
}
}
};
export const patchDocument: OperationParameter = {
parameterPath: "patchDocument",
mapper: {
serializedName: "patchDocument",
required: true,
type: {
name: "Sequence",
element: { type: { name: "any" } }
}
}
};
export const relationshipId: OperationURLParameter = {
parameterPath: "relationshipId",
mapper: {
serializedName: "relationshipId",
required: true,
type: {
name: "String"
}
}
};
export const relationship: OperationParameter = {
parameterPath: ["options", "relationship"],
mapper: {
serializedName: "relationship",
type: {
name: "any"
}
}
};
export const patchDocument1: OperationParameter = {
parameterPath: ["options", "patchDocument"],
mapper: {
serializedName: "patchDocument",
type: {
name: "Sequence",
element: { type: { name: "any" } }
}
}
};
export const relationshipName: OperationQueryParameter = {
parameterPath: ["options", "relationshipName"],
mapper: {
serializedName: "relationshipName",
type: {
name: "String"
}
}
};
export const telemetry: OperationParameter = {
parameterPath: "telemetry",
mapper: {
serializedName: "telemetry",
required: true,
type: {
name: "any"
}
}
};
export const dtId: OperationParameter = {
parameterPath: "dtId",
mapper: {
serializedName: "dt-id",
required: true,
type: {
name: "String"
}
}
};
export const timestamp: OperationParameter = {
parameterPath: ["options", "timestamp"],
mapper: {
serializedName: "dt-timestamp",
type: {
name: "String"
}
}
};
export const componentPath: OperationURLParameter = {
parameterPath: "componentPath",
mapper: {
serializedName: "componentPath",
required: true,
type: {
name: "String"
}
}
};
export const maxItemCount1: OperationParameter = {
parameterPath: ["options", "eventRoutesListOptions", "maxItemCount"],
mapper: {
defaultValue: -1,
serializedName: "x-ms-max-item-count",
type: {
name: "Number"
}
}
};
export const eventRoute: OperationParameter = {
parameterPath: ["options", "eventRoute"],
mapper: EventRouteMapper
};