@azure/digital-twins-core 1.1.1-alpha.20221107.1 → 2.0.0-alpha.20230117.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +7 -7
  2. package/dist/index.js +575 -610
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/constants.js +1 -1
  5. package/dist-esm/src/constants.js.map +1 -1
  6. package/dist-esm/src/digitalTwinsClient.js +69 -364
  7. package/dist-esm/src/digitalTwinsClient.js.map +1 -1
  8. package/dist-esm/src/generated/azureDigitalTwinsAPI.js +52 -13
  9. package/dist-esm/src/generated/azureDigitalTwinsAPI.js.map +1 -1
  10. package/dist-esm/src/generated/index.js +13 -0
  11. package/dist-esm/src/generated/index.js.map +1 -0
  12. package/dist-esm/src/generated/models/index.js.map +1 -1
  13. package/dist-esm/src/generated/models/mappers.js +35 -7
  14. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  15. package/dist-esm/src/generated/models/parameters.js +45 -30
  16. package/dist-esm/src/generated/models/parameters.js.map +1 -1
  17. package/dist-esm/src/generated/operations/digitalTwinModels.js +87 -47
  18. package/dist-esm/src/generated/operations/digitalTwinModels.js.map +1 -1
  19. package/dist-esm/src/generated/operations/digitalTwins.js +190 -80
  20. package/dist-esm/src/generated/operations/digitalTwins.js.map +1 -1
  21. package/dist-esm/src/generated/operations/eventRoutes.js +79 -35
  22. package/dist-esm/src/generated/operations/eventRoutes.js.map +1 -1
  23. package/dist-esm/src/generated/operations/query.js +10 -12
  24. package/dist-esm/src/generated/operations/query.js.map +1 -1
  25. package/dist-esm/src/generated/operationsInterfaces/digitalTwinModels.js +9 -0
  26. package/dist-esm/src/generated/operationsInterfaces/digitalTwinModels.js.map +1 -0
  27. package/dist-esm/src/generated/operationsInterfaces/digitalTwins.js +9 -0
  28. package/dist-esm/src/generated/operationsInterfaces/digitalTwins.js.map +1 -0
  29. package/dist-esm/src/generated/operationsInterfaces/eventRoutes.js +9 -0
  30. package/dist-esm/src/generated/operationsInterfaces/eventRoutes.js.map +1 -0
  31. package/dist-esm/src/generated/operationsInterfaces/index.js +12 -0
  32. package/dist-esm/src/generated/operationsInterfaces/index.js.map +1 -0
  33. package/dist-esm/src/generated/operationsInterfaces/query.js +9 -0
  34. package/dist-esm/src/generated/operationsInterfaces/query.js.map +1 -0
  35. package/dist-esm/src/generated/pagingHelper.js +32 -0
  36. package/dist-esm/src/generated/pagingHelper.js.map +1 -0
  37. package/dist-esm/src/index.js +1 -1
  38. package/dist-esm/src/index.js.map +1 -1
  39. package/package.json +12 -10
  40. package/types/digital-twins-core.d.ts +196 -693
  41. package/dist-esm/src/generated/azureDigitalTwinsAPIContext.js +0 -35
  42. package/dist-esm/src/generated/azureDigitalTwinsAPIContext.js.map +0 -1
package/dist/index.js CHANGED
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
- var coreHttp = require('@azure/core-http');
6
+ var uuid = require('uuid');
7
+ var coreClient = require('@azure/core-client');
7
8
  var coreTracing = require('@azure/core-tracing');
8
9
  var logger$1 = require('@azure/logger');
9
10
 
@@ -25,7 +26,25 @@ function _interopNamespace(e) {
25
26
  return Object.freeze(n);
26
27
  }
27
28
 
28
- var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp);
29
+ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
30
+
31
+ /*
32
+ * Copyright (c) Microsoft Corporation.
33
+ * Licensed under the MIT License.
34
+ *
35
+ * Code generated by Microsoft (R) AutoRest Code Generator.
36
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
37
+ */
38
+ const pageMap = new WeakMap();
39
+ function setContinuationToken(page, continuationToken) {
40
+ var _a;
41
+ if (typeof page !== "object" || page === null || !continuationToken) {
42
+ return;
43
+ }
44
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
45
+ pageInfo.continuationToken = continuationToken;
46
+ pageMap.set(page, pageInfo);
47
+ }
29
48
 
30
49
  /*
31
50
  * Copyright (c) Microsoft Corporation.
@@ -67,6 +86,7 @@ const DigitalTwinsModelData = {
67
86
  }
68
87
  },
69
88
  decommissioned: {
89
+ defaultValue: false,
70
90
  serializedName: "decommissioned",
71
91
  type: {
72
92
  name: "Boolean"
@@ -75,7 +95,8 @@ const DigitalTwinsModelData = {
75
95
  model: {
76
96
  serializedName: "model",
77
97
  type: {
78
- name: "any"
98
+ name: "Dictionary",
99
+ value: { type: { name: "any" } }
79
100
  }
80
101
  }
81
102
  }
@@ -120,7 +141,12 @@ const ErrorModel = {
120
141
  readOnly: true,
121
142
  type: {
122
143
  name: "Sequence",
123
- element: { type: { name: "Composite", className: "ErrorModel" } }
144
+ element: {
145
+ type: {
146
+ name: "Composite",
147
+ className: "ErrorModel"
148
+ }
149
+ }
124
150
  }
125
151
  },
126
152
  innererror: {
@@ -164,7 +190,10 @@ const PagedDigitalTwinsModelDataCollection = {
164
190
  type: {
165
191
  name: "Sequence",
166
192
  element: {
167
- type: { name: "Composite", className: "DigitalTwinsModelData" }
193
+ type: {
194
+ name: "Composite",
195
+ className: "DigitalTwinsModelData"
196
+ }
168
197
  }
169
198
  }
170
199
  },
@@ -206,7 +235,12 @@ const QueryResult = {
206
235
  serializedName: "value",
207
236
  type: {
208
237
  name: "Sequence",
209
- element: { type: { name: "any" } }
238
+ element: {
239
+ type: {
240
+ name: "Dictionary",
241
+ value: { type: { name: "any" } }
242
+ }
243
+ }
210
244
  }
211
245
  },
212
246
  continuationToken: {
@@ -227,7 +261,12 @@ const RelationshipCollection = {
227
261
  serializedName: "value",
228
262
  type: {
229
263
  name: "Sequence",
230
- element: { type: { name: "any" } }
264
+ element: {
265
+ type: {
266
+ name: "Dictionary",
267
+ value: { type: { name: "any" } }
268
+ }
269
+ }
231
270
  }
232
271
  },
233
272
  nextLink: {
@@ -249,7 +288,10 @@ const IncomingRelationshipCollection = {
249
288
  type: {
250
289
  name: "Sequence",
251
290
  element: {
252
- type: { name: "Composite", className: "IncomingRelationship" }
291
+ type: {
292
+ name: "Composite",
293
+ className: "IncomingRelationship"
294
+ }
253
295
  }
254
296
  }
255
297
  },
@@ -303,7 +345,12 @@ const EventRouteCollection = {
303
345
  serializedName: "value",
304
346
  type: {
305
347
  name: "Sequence",
306
- element: { type: { name: "Composite", className: "EventRoute" } }
348
+ element: {
349
+ type: {
350
+ name: "Composite",
351
+ className: "EventRoute"
352
+ }
353
+ }
307
354
  }
308
355
  },
309
356
  nextLink: {
@@ -524,43 +571,41 @@ const models = {
524
571
  serializedName: "models",
525
572
  type: {
526
573
  name: "Sequence",
527
- element: { type: { name: "any" } }
574
+ element: {
575
+ type: {
576
+ name: "Dictionary",
577
+ value: { type: { name: "any" } }
578
+ }
579
+ }
528
580
  }
529
581
  }
530
582
  };
531
- const $host = {
532
- parameterPath: "$host",
533
- mapper: {
534
- serializedName: "$host",
535
- required: true,
536
- type: {
537
- name: "String"
538
- }
539
- },
540
- skipEncoding: true
541
- };
542
- const traceparent = {
543
- parameterPath: ["options", "traceparent"],
583
+ const accept = {
584
+ parameterPath: "accept",
544
585
  mapper: {
545
- serializedName: "traceparent",
586
+ defaultValue: "application/json",
587
+ isConstant: true,
588
+ serializedName: "Accept",
546
589
  type: {
547
590
  name: "String"
548
591
  }
549
592
  }
550
593
  };
551
- const tracestate = {
552
- parameterPath: ["options", "tracestate"],
594
+ const $host = {
595
+ parameterPath: "$host",
553
596
  mapper: {
554
- serializedName: "tracestate",
597
+ serializedName: "$host",
598
+ required: true,
555
599
  type: {
556
600
  name: "String"
557
601
  }
558
- }
602
+ },
603
+ skipEncoding: true
559
604
  };
560
605
  const apiVersion = {
561
606
  parameterPath: "apiVersion",
562
607
  mapper: {
563
- defaultValue: "2022-05-31",
608
+ defaultValue: "2020-10-31",
564
609
  isConstant: true,
565
610
  serializedName: "api-version",
566
611
  type: {
@@ -574,22 +619,27 @@ const dependenciesFor = {
574
619
  serializedName: "dependenciesFor",
575
620
  type: {
576
621
  name: "Sequence",
577
- element: { type: { name: "String" } }
622
+ element: {
623
+ type: {
624
+ name: "String"
625
+ }
626
+ }
578
627
  }
579
628
  },
580
- collectionFormat: coreHttp.QueryCollectionFormat.Csv
629
+ collectionFormat: "Multi"
581
630
  };
582
631
  const includeModelDefinition = {
583
632
  parameterPath: ["options", "includeModelDefinition"],
584
633
  mapper: {
634
+ defaultValue: false,
585
635
  serializedName: "includeModelDefinition",
586
636
  type: {
587
637
  name: "Boolean"
588
638
  }
589
639
  }
590
640
  };
591
- const maxItemsPerPage = {
592
- parameterPath: ["options", "maxItemsPerPage"],
641
+ const resultsPerPage = {
642
+ parameterPath: ["options", "resultsPerPage"],
593
643
  mapper: {
594
644
  serializedName: "max-items-per-page",
595
645
  type: {
@@ -625,7 +675,12 @@ const updateModel = {
625
675
  required: true,
626
676
  type: {
627
677
  name: "Sequence",
628
- element: { type: { name: "any" } }
678
+ element: {
679
+ type: {
680
+ name: "Dictionary",
681
+ value: { type: { name: "any" } }
682
+ }
683
+ }
629
684
  }
630
685
  }
631
686
  };
@@ -650,7 +705,8 @@ const twin = {
650
705
  serializedName: "twin",
651
706
  required: true,
652
707
  type: {
653
- name: "any"
708
+ name: "Dictionary",
709
+ value: { type: { name: "any" } }
654
710
  }
655
711
  }
656
712
  };
@@ -679,7 +735,12 @@ const patchDocument = {
679
735
  required: true,
680
736
  type: {
681
737
  name: "Sequence",
682
- element: { type: { name: "any" } }
738
+ element: {
739
+ type: {
740
+ name: "Dictionary",
741
+ value: { type: { name: "any" } }
742
+ }
743
+ }
683
744
  }
684
745
  }
685
746
  };
@@ -699,7 +760,8 @@ const relationship = {
699
760
  serializedName: "relationship",
700
761
  required: true,
701
762
  type: {
702
- name: "any"
763
+ name: "Dictionary",
764
+ value: { type: { name: "any" } }
703
765
  }
704
766
  }
705
767
  };
@@ -718,7 +780,8 @@ const telemetry = {
718
780
  serializedName: "telemetry",
719
781
  required: true,
720
782
  type: {
721
- name: "any"
783
+ name: "Dictionary",
784
+ value: { type: { name: "any" } }
722
785
  }
723
786
  }
724
787
  };
@@ -763,10 +826,9 @@ const eventRoute = {
763
826
  * Code generated by Microsoft (R) AutoRest Code Generator.
764
827
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
765
828
  */
766
- /**
767
- * Class representing a DigitalTwinModels.
768
- */
769
- class DigitalTwinModels {
829
+ /// <reference lib="esnext.asynciterable" />
830
+ /** Class containing DigitalTwinModels operations. */
831
+ class DigitalTwinModelsImpl {
770
832
  /**
771
833
  * Initialize a new instance of the class DigitalTwinModels class.
772
834
  * @param client Reference to the service client
@@ -774,6 +836,72 @@ class DigitalTwinModels {
774
836
  constructor(client) {
775
837
  this.client = client;
776
838
  }
839
+ /**
840
+ * Retrieves model metadata and, optionally, model definitions.
841
+ * Status codes:
842
+ * * 200 OK
843
+ * * 400 Bad Request
844
+ * * InvalidArgument - The model id is invalid.
845
+ * * LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached.
846
+ * * 404 Not Found
847
+ * * ModelNotFound - The model was not found.
848
+ * @param options The options parameters.
849
+ */
850
+ list(options) {
851
+ const iter = this.listPagingAll(options);
852
+ return {
853
+ next() {
854
+ return iter.next();
855
+ },
856
+ [Symbol.asyncIterator]() {
857
+ return this;
858
+ },
859
+ byPage: (settings) => {
860
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
861
+ throw new Error("maxPageSize is not supported by this operation.");
862
+ }
863
+ return this.listPagingPage(options, settings);
864
+ }
865
+ };
866
+ }
867
+ listPagingPage(options, settings) {
868
+ return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
869
+ let result;
870
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
871
+ if (!continuationToken) {
872
+ result = yield tslib.__await(this._list(options));
873
+ let page = result.value || [];
874
+ continuationToken = result.nextLink;
875
+ setContinuationToken(page, continuationToken);
876
+ yield yield tslib.__await(page);
877
+ }
878
+ while (continuationToken) {
879
+ result = yield tslib.__await(this._listNext(continuationToken, options));
880
+ continuationToken = result.nextLink;
881
+ let page = result.value || [];
882
+ setContinuationToken(page, continuationToken);
883
+ yield yield tslib.__await(page);
884
+ }
885
+ });
886
+ }
887
+ listPagingAll(options) {
888
+ return tslib.__asyncGenerator(this, arguments, function* listPagingAll_1() {
889
+ var e_1, _a;
890
+ try {
891
+ for (var _b = tslib.__asyncValues(this.listPagingPage(options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
892
+ const page = _c.value;
893
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
894
+ }
895
+ }
896
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
897
+ finally {
898
+ try {
899
+ if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
900
+ }
901
+ finally { if (e_1) throw e_1.error; }
902
+ }
903
+ });
904
+ }
777
905
  /**
778
906
  * Uploads one or more models. When any error occurs, no models are uploaded.
779
907
  * Status codes:
@@ -788,8 +916,7 @@ class DigitalTwinModels {
788
916
  * @param options The options parameters.
789
917
  */
790
918
  add(options) {
791
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
792
- return this.client.sendOperationRequest({ options: operationOptions }, addOperationSpec$2);
919
+ return this.client.sendOperationRequest({ options }, addOperationSpec$2);
793
920
  }
794
921
  /**
795
922
  * Retrieves model metadata and, optionally, model definitions.
@@ -802,9 +929,8 @@ class DigitalTwinModels {
802
929
  * * ModelNotFound - The model was not found.
803
930
  * @param options The options parameters.
804
931
  */
805
- list(options) {
806
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
807
- return this.client.sendOperationRequest({ options: operationOptions }, listOperationSpec$1);
932
+ _list(options) {
933
+ return this.client.sendOperationRequest({ options }, listOperationSpec$1);
808
934
  }
809
935
  /**
810
936
  * Retrieves model metadata and optionally the model definition.
@@ -819,8 +945,7 @@ class DigitalTwinModels {
819
945
  * @param options The options parameters.
820
946
  */
821
947
  getById(id, options) {
822
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
823
- return this.client.sendOperationRequest({ id, options: operationOptions }, getByIdOperationSpec$2);
948
+ return this.client.sendOperationRequest({ id, options }, getByIdOperationSpec$2);
824
949
  }
825
950
  /**
826
951
  * Updates the metadata for a model.
@@ -840,8 +965,7 @@ class DigitalTwinModels {
840
965
  * @param options The options parameters.
841
966
  */
842
967
  update(id, updateModel, options) {
843
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
844
- return this.client.sendOperationRequest({ id, updateModel, options: operationOptions }, updateOperationSpec$1);
968
+ return this.client.sendOperationRequest({ id, updateModel, options }, updateOperationSpec$1);
845
969
  }
846
970
  /**
847
971
  * Deletes a model. A model can only be deleted if no other models reference it.
@@ -858,21 +982,19 @@ class DigitalTwinModels {
858
982
  * @param options The options parameters.
859
983
  */
860
984
  delete(id, options) {
861
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
862
- return this.client.sendOperationRequest({ id, options: operationOptions }, deleteOperationSpec$2);
985
+ return this.client.sendOperationRequest({ id, options }, deleteOperationSpec$2);
863
986
  }
864
987
  /**
865
988
  * ListNext
866
989
  * @param nextLink The nextLink from the previous successful call to the List method.
867
990
  * @param options The options parameters.
868
991
  */
869
- listNext(nextLink, options) {
870
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
871
- return this.client.sendOperationRequest({ nextLink, options: operationOptions }, listNextOperationSpec$1);
992
+ _listNext(nextLink, options) {
993
+ return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec$1);
872
994
  }
873
995
  }
874
996
  // Operation Specifications
875
- const serializer$3 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
997
+ const serializer$3 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
876
998
  const addOperationSpec$2 = {
877
999
  path: "/models",
878
1000
  httpMethod: "POST",
@@ -894,11 +1016,7 @@ const addOperationSpec$2 = {
894
1016
  requestBody: models,
895
1017
  queryParameters: [apiVersion],
896
1018
  urlParameters: [$host],
897
- headerParameters: [
898
- contentType,
899
- traceparent,
900
- tracestate
901
- ],
1019
+ headerParameters: [contentType, accept],
902
1020
  mediaType: "json",
903
1021
  serializer: serializer$3
904
1022
  };
@@ -919,11 +1037,7 @@ const listOperationSpec$1 = {
919
1037
  includeModelDefinition
920
1038
  ],
921
1039
  urlParameters: [$host],
922
- headerParameters: [
923
- traceparent,
924
- tracestate,
925
- maxItemsPerPage
926
- ],
1040
+ headerParameters: [accept, resultsPerPage],
927
1041
  serializer: serializer$3
928
1042
  };
929
1043
  const getByIdOperationSpec$2 = {
@@ -939,7 +1053,7 @@ const getByIdOperationSpec$2 = {
939
1053
  },
940
1054
  queryParameters: [apiVersion, includeModelDefinition],
941
1055
  urlParameters: [$host, id],
942
- headerParameters: [traceparent, tracestate],
1056
+ headerParameters: [accept],
943
1057
  serializer: serializer$3
944
1058
  };
945
1059
  const updateOperationSpec$1 = {
@@ -954,11 +1068,7 @@ const updateOperationSpec$1 = {
954
1068
  requestBody: updateModel,
955
1069
  queryParameters: [apiVersion],
956
1070
  urlParameters: [$host, id],
957
- headerParameters: [
958
- traceparent,
959
- tracestate,
960
- contentType1
961
- ],
1071
+ headerParameters: [accept, contentType1],
962
1072
  mediaType: "json",
963
1073
  serializer: serializer$3
964
1074
  };
@@ -973,7 +1083,7 @@ const deleteOperationSpec$2 = {
973
1083
  },
974
1084
  queryParameters: [apiVersion],
975
1085
  urlParameters: [$host, id],
976
- headerParameters: [traceparent, tracestate],
1086
+ headerParameters: [accept],
977
1087
  serializer: serializer$3
978
1088
  };
979
1089
  const listNextOperationSpec$1 = {
@@ -987,17 +1097,8 @@ const listNextOperationSpec$1 = {
987
1097
  bodyMapper: ErrorResponse
988
1098
  }
989
1099
  },
990
- queryParameters: [
991
- apiVersion,
992
- dependenciesFor,
993
- includeModelDefinition
994
- ],
995
1100
  urlParameters: [$host, nextLink],
996
- headerParameters: [
997
- traceparent,
998
- tracestate,
999
- maxItemsPerPage
1000
- ],
1101
+ headerParameters: [accept, resultsPerPage],
1001
1102
  serializer: serializer$3
1002
1103
  };
1003
1104
 
@@ -1008,10 +1109,8 @@ const listNextOperationSpec$1 = {
1008
1109
  * Code generated by Microsoft (R) AutoRest Code Generator.
1009
1110
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1010
1111
  */
1011
- /**
1012
- * Class representing a Query.
1013
- */
1014
- class Query {
1112
+ /** Class containing Query operations. */
1113
+ class QueryImpl {
1015
1114
  /**
1016
1115
  * Initialize a new instance of the class Query class.
1017
1116
  * @param client Reference to the service client
@@ -1026,18 +1125,19 @@ class Query {
1026
1125
  * * 400 Bad Request
1027
1126
  * * BadRequest - The continuation token is invalid.
1028
1127
  * * SqlQueryError - The query contains some errors.
1029
- * * 429 Too Many Requests
1128
+ * * TimeoutError - The query execution timed out after 60 seconds. Try simplifying the query or
1129
+ * adding conditions to reduce the result size.
1130
+ * * 429 Too Many Requests
1030
1131
  * * QuotaReachedError - The maximum query rate limit has been reached.
1031
1132
  * @param querySpecification The query specification to execute.
1032
1133
  * @param options The options parameters.
1033
1134
  */
1034
1135
  queryTwins(querySpecification, options) {
1035
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1036
- return this.client.sendOperationRequest({ querySpecification, options: operationOptions }, queryTwinsOperationSpec);
1136
+ return this.client.sendOperationRequest({ querySpecification, options }, queryTwinsOperationSpec);
1037
1137
  }
1038
1138
  }
1039
1139
  // Operation Specifications
1040
- const serializer$2 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
1140
+ const serializer$2 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
1041
1141
  const queryTwinsOperationSpec = {
1042
1142
  path: "/query",
1043
1143
  httpMethod: "POST",
@@ -1055,9 +1155,8 @@ const queryTwinsOperationSpec = {
1055
1155
  urlParameters: [$host],
1056
1156
  headerParameters: [
1057
1157
  contentType,
1058
- traceparent,
1059
- tracestate,
1060
- maxItemsPerPage
1158
+ accept,
1159
+ resultsPerPage
1061
1160
  ],
1062
1161
  mediaType: "json",
1063
1162
  serializer: serializer$2
@@ -1070,10 +1169,9 @@ const queryTwinsOperationSpec = {
1070
1169
  * Code generated by Microsoft (R) AutoRest Code Generator.
1071
1170
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1072
1171
  */
1073
- /**
1074
- * Class representing a DigitalTwins.
1075
- */
1076
- class DigitalTwins {
1172
+ /// <reference lib="esnext.asynciterable" />
1173
+ /** Class containing DigitalTwins operations. */
1174
+ class DigitalTwinsImpl {
1077
1175
  /**
1078
1176
  * Initialize a new instance of the class DigitalTwins class.
1079
1177
  * @param client Reference to the service client
@@ -1081,6 +1179,138 @@ class DigitalTwins {
1081
1179
  constructor(client) {
1082
1180
  this.client = client;
1083
1181
  }
1182
+ /**
1183
+ * Retrieves the relationships from a digital twin.
1184
+ * Status codes:
1185
+ * * 200 OK
1186
+ * * 400 Bad Request
1187
+ * * InvalidArgument - The digital twin id is invalid.
1188
+ * * 404 Not Found
1189
+ * * DigitalTwinNotFound - The digital twin was not found.
1190
+ * @param id The id of the digital twin. The id is unique within the service and case sensitive.
1191
+ * @param options The options parameters.
1192
+ */
1193
+ listRelationships(id, options) {
1194
+ const iter = this.listRelationshipsPagingAll(id, options);
1195
+ return {
1196
+ next() {
1197
+ return iter.next();
1198
+ },
1199
+ [Symbol.asyncIterator]() {
1200
+ return this;
1201
+ },
1202
+ byPage: (settings) => {
1203
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1204
+ throw new Error("maxPageSize is not supported by this operation.");
1205
+ }
1206
+ return this.listRelationshipsPagingPage(id, options, settings);
1207
+ }
1208
+ };
1209
+ }
1210
+ listRelationshipsPagingPage(id, options, settings) {
1211
+ return tslib.__asyncGenerator(this, arguments, function* listRelationshipsPagingPage_1() {
1212
+ let result;
1213
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1214
+ if (!continuationToken) {
1215
+ result = yield tslib.__await(this._listRelationships(id, options));
1216
+ let page = result.value || [];
1217
+ continuationToken = result.nextLink;
1218
+ setContinuationToken(page, continuationToken);
1219
+ yield yield tslib.__await(page);
1220
+ }
1221
+ while (continuationToken) {
1222
+ result = yield tslib.__await(this._listRelationshipsNext(id, continuationToken, options));
1223
+ continuationToken = result.nextLink;
1224
+ let page = result.value || [];
1225
+ setContinuationToken(page, continuationToken);
1226
+ yield yield tslib.__await(page);
1227
+ }
1228
+ });
1229
+ }
1230
+ listRelationshipsPagingAll(id, options) {
1231
+ return tslib.__asyncGenerator(this, arguments, function* listRelationshipsPagingAll_1() {
1232
+ var e_1, _a;
1233
+ try {
1234
+ for (var _b = tslib.__asyncValues(this.listRelationshipsPagingPage(id, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
1235
+ const page = _c.value;
1236
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1237
+ }
1238
+ }
1239
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1240
+ finally {
1241
+ try {
1242
+ if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
1243
+ }
1244
+ finally { if (e_1) throw e_1.error; }
1245
+ }
1246
+ });
1247
+ }
1248
+ /**
1249
+ * Retrieves all incoming relationship for a digital twin.
1250
+ * Status codes:
1251
+ * * 200 OK
1252
+ * * 400 Bad Request
1253
+ * * InvalidArgument - The digital twin id is invalid.
1254
+ * * 404 Not Found
1255
+ * * DigitalTwinNotFound - The digital twin was not found.
1256
+ * @param id The id of the digital twin. The id is unique within the service and case sensitive.
1257
+ * @param options The options parameters.
1258
+ */
1259
+ listIncomingRelationships(id, options) {
1260
+ const iter = this.listIncomingRelationshipsPagingAll(id, options);
1261
+ return {
1262
+ next() {
1263
+ return iter.next();
1264
+ },
1265
+ [Symbol.asyncIterator]() {
1266
+ return this;
1267
+ },
1268
+ byPage: (settings) => {
1269
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1270
+ throw new Error("maxPageSize is not supported by this operation.");
1271
+ }
1272
+ return this.listIncomingRelationshipsPagingPage(id, options, settings);
1273
+ }
1274
+ };
1275
+ }
1276
+ listIncomingRelationshipsPagingPage(id, options, settings) {
1277
+ return tslib.__asyncGenerator(this, arguments, function* listIncomingRelationshipsPagingPage_1() {
1278
+ let result;
1279
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1280
+ if (!continuationToken) {
1281
+ result = yield tslib.__await(this._listIncomingRelationships(id, options));
1282
+ let page = result.value || [];
1283
+ continuationToken = result.nextLink;
1284
+ setContinuationToken(page, continuationToken);
1285
+ yield yield tslib.__await(page);
1286
+ }
1287
+ while (continuationToken) {
1288
+ result = yield tslib.__await(this._listIncomingRelationshipsNext(id, continuationToken, options));
1289
+ continuationToken = result.nextLink;
1290
+ let page = result.value || [];
1291
+ setContinuationToken(page, continuationToken);
1292
+ yield yield tslib.__await(page);
1293
+ }
1294
+ });
1295
+ }
1296
+ listIncomingRelationshipsPagingAll(id, options) {
1297
+ return tslib.__asyncGenerator(this, arguments, function* listIncomingRelationshipsPagingAll_1() {
1298
+ var e_2, _a;
1299
+ try {
1300
+ for (var _b = tslib.__asyncValues(this.listIncomingRelationshipsPagingPage(id, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
1301
+ const page = _c.value;
1302
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1303
+ }
1304
+ }
1305
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1306
+ finally {
1307
+ try {
1308
+ if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
1309
+ }
1310
+ finally { if (e_2) throw e_2.error; }
1311
+ }
1312
+ });
1313
+ }
1084
1314
  /**
1085
1315
  * Retrieves a digital twin.
1086
1316
  * Status codes:
@@ -1093,8 +1323,7 @@ class DigitalTwins {
1093
1323
  * @param options The options parameters.
1094
1324
  */
1095
1325
  getById(id, options) {
1096
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1097
- return this.client.sendOperationRequest({ id, options: operationOptions }, getByIdOperationSpec$1);
1326
+ return this.client.sendOperationRequest({ id, options }, getByIdOperationSpec$1);
1098
1327
  }
1099
1328
  /**
1100
1329
  * Adds or replaces a digital twin.
@@ -1112,8 +1341,7 @@ class DigitalTwins {
1112
1341
  * @param options The options parameters.
1113
1342
  */
1114
1343
  add(id, twin, options) {
1115
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1116
- return this.client.sendOperationRequest({ id, twin, options: operationOptions }, addOperationSpec$1);
1344
+ return this.client.sendOperationRequest({ id, twin, options }, addOperationSpec$1);
1117
1345
  }
1118
1346
  /**
1119
1347
  * Deletes a digital twin. All relationships referencing the digital twin must already be deleted.
@@ -1130,8 +1358,7 @@ class DigitalTwins {
1130
1358
  * @param options The options parameters.
1131
1359
  */
1132
1360
  delete(id, options) {
1133
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1134
- return this.client.sendOperationRequest({ id, options: operationOptions }, deleteOperationSpec$1);
1361
+ return this.client.sendOperationRequest({ id, options }, deleteOperationSpec$1);
1135
1362
  }
1136
1363
  /**
1137
1364
  * Updates a digital twin.
@@ -1151,8 +1378,7 @@ class DigitalTwins {
1151
1378
  * @param options The options parameters.
1152
1379
  */
1153
1380
  update(id, patchDocument, options) {
1154
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1155
- return this.client.sendOperationRequest({ id, patchDocument, options: operationOptions }, updateOperationSpec);
1381
+ return this.client.sendOperationRequest({ id, patchDocument, options }, updateOperationSpec);
1156
1382
  }
1157
1383
  /**
1158
1384
  * Retrieves a relationship between two digital twins.
@@ -1169,8 +1395,7 @@ class DigitalTwins {
1169
1395
  * @param options The options parameters.
1170
1396
  */
1171
1397
  getRelationshipById(id, relationshipId, options) {
1172
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1173
- return this.client.sendOperationRequest({ id, relationshipId, options: operationOptions }, getRelationshipByIdOperationSpec);
1398
+ return this.client.sendOperationRequest({ id, relationshipId, options }, getRelationshipByIdOperationSpec);
1174
1399
  }
1175
1400
  /**
1176
1401
  * Adds a relationship between two digital twins.
@@ -1193,8 +1418,7 @@ class DigitalTwins {
1193
1418
  * @param options The options parameters.
1194
1419
  */
1195
1420
  addRelationship(id, relationshipId, relationship, options) {
1196
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1197
- return this.client.sendOperationRequest({ id, relationshipId, relationship, options: operationOptions }, addRelationshipOperationSpec);
1421
+ return this.client.sendOperationRequest({ id, relationshipId, relationship, options }, addRelationshipOperationSpec);
1198
1422
  }
1199
1423
  /**
1200
1424
  * Deletes a relationship between two digital twins.
@@ -1213,8 +1437,7 @@ class DigitalTwins {
1213
1437
  * @param options The options parameters.
1214
1438
  */
1215
1439
  deleteRelationship(id, relationshipId, options) {
1216
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1217
- return this.client.sendOperationRequest({ id, relationshipId, options: operationOptions }, deleteRelationshipOperationSpec);
1440
+ return this.client.sendOperationRequest({ id, relationshipId, options }, deleteRelationshipOperationSpec);
1218
1441
  }
1219
1442
  /**
1220
1443
  * Updates the properties on a relationship between two digital twins.
@@ -1239,8 +1462,7 @@ class DigitalTwins {
1239
1462
  * @param options The options parameters.
1240
1463
  */
1241
1464
  updateRelationship(id, relationshipId, patchDocument, options) {
1242
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1243
- return this.client.sendOperationRequest({ id, relationshipId, patchDocument, options: operationOptions }, updateRelationshipOperationSpec);
1465
+ return this.client.sendOperationRequest({ id, relationshipId, patchDocument, options }, updateRelationshipOperationSpec);
1244
1466
  }
1245
1467
  /**
1246
1468
  * Retrieves the relationships from a digital twin.
@@ -1253,9 +1475,8 @@ class DigitalTwins {
1253
1475
  * @param id The id of the digital twin. The id is unique within the service and case sensitive.
1254
1476
  * @param options The options parameters.
1255
1477
  */
1256
- listRelationships(id, options) {
1257
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1258
- return this.client.sendOperationRequest({ id, options: operationOptions }, listRelationshipsOperationSpec);
1478
+ _listRelationships(id, options) {
1479
+ return this.client.sendOperationRequest({ id, options }, listRelationshipsOperationSpec);
1259
1480
  }
1260
1481
  /**
1261
1482
  * Retrieves all incoming relationship for a digital twin.
@@ -1268,9 +1489,8 @@ class DigitalTwins {
1268
1489
  * @param id The id of the digital twin. The id is unique within the service and case sensitive.
1269
1490
  * @param options The options parameters.
1270
1491
  */
1271
- listIncomingRelationships(id, options) {
1272
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1273
- return this.client.sendOperationRequest({ id, options: operationOptions }, listIncomingRelationshipsOperationSpec);
1492
+ _listIncomingRelationships(id, options) {
1493
+ return this.client.sendOperationRequest({ id, options }, listIncomingRelationshipsOperationSpec);
1274
1494
  }
1275
1495
  /**
1276
1496
  * Sends telemetry on behalf of a digital twin.
@@ -1288,8 +1508,7 @@ class DigitalTwins {
1288
1508
  * @param options The options parameters.
1289
1509
  */
1290
1510
  sendTelemetry(id, messageId, telemetry, options) {
1291
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1292
- return this.client.sendOperationRequest({ id, messageId, telemetry, options: operationOptions }, sendTelemetryOperationSpec);
1511
+ return this.client.sendOperationRequest({ id, messageId, telemetry, options }, sendTelemetryOperationSpec);
1293
1512
  }
1294
1513
  /**
1295
1514
  * Sends telemetry on behalf of a component in a digital twin.
@@ -1309,8 +1528,7 @@ class DigitalTwins {
1309
1528
  * @param options The options parameters.
1310
1529
  */
1311
1530
  sendComponentTelemetry(id, componentPath, messageId, telemetry, options) {
1312
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1313
- return this.client.sendOperationRequest({ id, componentPath, messageId, telemetry, options: operationOptions }, sendComponentTelemetryOperationSpec);
1531
+ return this.client.sendOperationRequest({ id, componentPath, messageId, telemetry, options }, sendComponentTelemetryOperationSpec);
1314
1532
  }
1315
1533
  /**
1316
1534
  * Retrieves a component from a digital twin.
@@ -1326,8 +1544,7 @@ class DigitalTwins {
1326
1544
  * @param options The options parameters.
1327
1545
  */
1328
1546
  getComponent(id, componentPath, options) {
1329
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1330
- return this.client.sendOperationRequest({ id, componentPath, options: operationOptions }, getComponentOperationSpec);
1547
+ return this.client.sendOperationRequest({ id, componentPath, options }, getComponentOperationSpec);
1331
1548
  }
1332
1549
  /**
1333
1550
  * Updates a component on a digital twin.
@@ -1348,8 +1565,7 @@ class DigitalTwins {
1348
1565
  * @param options The options parameters.
1349
1566
  */
1350
1567
  updateComponent(id, componentPath, patchDocument, options) {
1351
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1352
- return this.client.sendOperationRequest({ id, componentPath, patchDocument, options: operationOptions }, updateComponentOperationSpec);
1568
+ return this.client.sendOperationRequest({ id, componentPath, patchDocument, options }, updateComponentOperationSpec);
1353
1569
  }
1354
1570
  /**
1355
1571
  * ListRelationshipsNext
@@ -1357,9 +1573,8 @@ class DigitalTwins {
1357
1573
  * @param nextLink The nextLink from the previous successful call to the ListRelationships method.
1358
1574
  * @param options The options parameters.
1359
1575
  */
1360
- listRelationshipsNext(id, nextLink, options) {
1361
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1362
- return this.client.sendOperationRequest({ id, nextLink, options: operationOptions }, listRelationshipsNextOperationSpec);
1576
+ _listRelationshipsNext(id, nextLink, options) {
1577
+ return this.client.sendOperationRequest({ id, nextLink, options }, listRelationshipsNextOperationSpec);
1363
1578
  }
1364
1579
  /**
1365
1580
  * ListIncomingRelationshipsNext
@@ -1368,19 +1583,20 @@ class DigitalTwins {
1368
1583
  * method.
1369
1584
  * @param options The options parameters.
1370
1585
  */
1371
- listIncomingRelationshipsNext(id, nextLink, options) {
1372
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1373
- return this.client.sendOperationRequest({ id, nextLink, options: operationOptions }, listIncomingRelationshipsNextOperationSpec);
1586
+ _listIncomingRelationshipsNext(id, nextLink, options) {
1587
+ return this.client.sendOperationRequest({ id, nextLink, options }, listIncomingRelationshipsNextOperationSpec);
1374
1588
  }
1375
1589
  }
1376
1590
  // Operation Specifications
1377
- const serializer$1 = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
1591
+ const serializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
1378
1592
  const getByIdOperationSpec$1 = {
1379
1593
  path: "/digitaltwins/{id}",
1380
1594
  httpMethod: "GET",
1381
1595
  responses: {
1382
1596
  200: {
1383
- bodyMapper: { type: { name: "any" } },
1597
+ bodyMapper: {
1598
+ type: { name: "Dictionary", value: { type: { name: "any" } } }
1599
+ },
1384
1600
  headersMapper: DigitalTwinsGetByIdHeaders
1385
1601
  },
1386
1602
  default: {
@@ -1389,7 +1605,7 @@ const getByIdOperationSpec$1 = {
1389
1605
  },
1390
1606
  queryParameters: [apiVersion],
1391
1607
  urlParameters: [$host, id],
1392
- headerParameters: [traceparent, tracestate],
1608
+ headerParameters: [accept],
1393
1609
  serializer: serializer$1
1394
1610
  };
1395
1611
  const addOperationSpec$1 = {
@@ -1397,7 +1613,9 @@ const addOperationSpec$1 = {
1397
1613
  httpMethod: "PUT",
1398
1614
  responses: {
1399
1615
  200: {
1400
- bodyMapper: { type: { name: "any" } },
1616
+ bodyMapper: {
1617
+ type: { name: "Dictionary", value: { type: { name: "any" } } }
1618
+ },
1401
1619
  headersMapper: DigitalTwinsAddHeaders
1402
1620
  },
1403
1621
  202: {},
@@ -1410,8 +1628,7 @@ const addOperationSpec$1 = {
1410
1628
  urlParameters: [$host, id],
1411
1629
  headerParameters: [
1412
1630
  contentType,
1413
- traceparent,
1414
- tracestate,
1631
+ accept,
1415
1632
  ifNoneMatch
1416
1633
  ],
1417
1634
  mediaType: "json",
@@ -1428,11 +1645,7 @@ const deleteOperationSpec$1 = {
1428
1645
  },
1429
1646
  queryParameters: [apiVersion],
1430
1647
  urlParameters: [$host, id],
1431
- headerParameters: [
1432
- traceparent,
1433
- tracestate,
1434
- ifMatch
1435
- ],
1648
+ headerParameters: [accept, ifMatch],
1436
1649
  serializer: serializer$1
1437
1650
  };
1438
1651
  const updateOperationSpec = {
@@ -1451,8 +1664,7 @@ const updateOperationSpec = {
1451
1664
  queryParameters: [apiVersion],
1452
1665
  urlParameters: [$host, id],
1453
1666
  headerParameters: [
1454
- traceparent,
1455
- tracestate,
1667
+ accept,
1456
1668
  contentType1,
1457
1669
  ifMatch
1458
1670
  ],
@@ -1464,7 +1676,9 @@ const getRelationshipByIdOperationSpec = {
1464
1676
  httpMethod: "GET",
1465
1677
  responses: {
1466
1678
  200: {
1467
- bodyMapper: { type: { name: "any" } },
1679
+ bodyMapper: {
1680
+ type: { name: "Dictionary", value: { type: { name: "any" } } }
1681
+ },
1468
1682
  headersMapper: DigitalTwinsGetRelationshipByIdHeaders
1469
1683
  },
1470
1684
  default: {
@@ -1473,7 +1687,7 @@ const getRelationshipByIdOperationSpec = {
1473
1687
  },
1474
1688
  queryParameters: [apiVersion],
1475
1689
  urlParameters: [$host, id, relationshipId],
1476
- headerParameters: [traceparent, tracestate],
1690
+ headerParameters: [accept],
1477
1691
  serializer: serializer$1
1478
1692
  };
1479
1693
  const addRelationshipOperationSpec = {
@@ -1481,7 +1695,9 @@ const addRelationshipOperationSpec = {
1481
1695
  httpMethod: "PUT",
1482
1696
  responses: {
1483
1697
  200: {
1484
- bodyMapper: { type: { name: "any" } },
1698
+ bodyMapper: {
1699
+ type: { name: "Dictionary", value: { type: { name: "any" } } }
1700
+ },
1485
1701
  headersMapper: DigitalTwinsAddRelationshipHeaders
1486
1702
  },
1487
1703
  default: {
@@ -1493,8 +1709,7 @@ const addRelationshipOperationSpec = {
1493
1709
  urlParameters: [$host, id, relationshipId],
1494
1710
  headerParameters: [
1495
1711
  contentType,
1496
- traceparent,
1497
- tracestate,
1712
+ accept,
1498
1713
  ifNoneMatch
1499
1714
  ],
1500
1715
  mediaType: "json",
@@ -1511,11 +1726,7 @@ const deleteRelationshipOperationSpec = {
1511
1726
  },
1512
1727
  queryParameters: [apiVersion],
1513
1728
  urlParameters: [$host, id, relationshipId],
1514
- headerParameters: [
1515
- traceparent,
1516
- tracestate,
1517
- ifMatch
1518
- ],
1729
+ headerParameters: [accept, ifMatch],
1519
1730
  serializer: serializer$1
1520
1731
  };
1521
1732
  const updateRelationshipOperationSpec = {
@@ -1533,8 +1744,7 @@ const updateRelationshipOperationSpec = {
1533
1744
  queryParameters: [apiVersion],
1534
1745
  urlParameters: [$host, id, relationshipId],
1535
1746
  headerParameters: [
1536
- traceparent,
1537
- tracestate,
1747
+ accept,
1538
1748
  contentType1,
1539
1749
  ifMatch
1540
1750
  ],
@@ -1554,7 +1764,7 @@ const listRelationshipsOperationSpec = {
1554
1764
  },
1555
1765
  queryParameters: [apiVersion, relationshipName],
1556
1766
  urlParameters: [$host, id],
1557
- headerParameters: [traceparent, tracestate],
1767
+ headerParameters: [accept],
1558
1768
  serializer: serializer$1
1559
1769
  };
1560
1770
  const listIncomingRelationshipsOperationSpec = {
@@ -1570,7 +1780,7 @@ const listIncomingRelationshipsOperationSpec = {
1570
1780
  },
1571
1781
  queryParameters: [apiVersion],
1572
1782
  urlParameters: [$host, id],
1573
- headerParameters: [traceparent, tracestate],
1783
+ headerParameters: [accept],
1574
1784
  serializer: serializer$1
1575
1785
  };
1576
1786
  const sendTelemetryOperationSpec = {
@@ -1587,8 +1797,7 @@ const sendTelemetryOperationSpec = {
1587
1797
  urlParameters: [$host, id],
1588
1798
  headerParameters: [
1589
1799
  contentType,
1590
- traceparent,
1591
- tracestate,
1800
+ accept,
1592
1801
  messageId,
1593
1802
  telemetrySourceTime
1594
1803
  ],
@@ -1609,8 +1818,7 @@ const sendComponentTelemetryOperationSpec = {
1609
1818
  urlParameters: [$host, id, componentPath],
1610
1819
  headerParameters: [
1611
1820
  contentType,
1612
- traceparent,
1613
- tracestate,
1821
+ accept,
1614
1822
  messageId,
1615
1823
  telemetrySourceTime
1616
1824
  ],
@@ -1622,7 +1830,9 @@ const getComponentOperationSpec = {
1622
1830
  httpMethod: "GET",
1623
1831
  responses: {
1624
1832
  200: {
1625
- bodyMapper: { type: { name: "any" } },
1833
+ bodyMapper: {
1834
+ type: { name: "Dictionary", value: { type: { name: "any" } } }
1835
+ },
1626
1836
  headersMapper: DigitalTwinsGetComponentHeaders
1627
1837
  },
1628
1838
  default: {
@@ -1631,7 +1841,7 @@ const getComponentOperationSpec = {
1631
1841
  },
1632
1842
  queryParameters: [apiVersion],
1633
1843
  urlParameters: [$host, id, componentPath],
1634
- headerParameters: [traceparent, tracestate],
1844
+ headerParameters: [accept],
1635
1845
  serializer: serializer$1
1636
1846
  };
1637
1847
  const updateComponentOperationSpec = {
@@ -1650,8 +1860,7 @@ const updateComponentOperationSpec = {
1650
1860
  queryParameters: [apiVersion],
1651
1861
  urlParameters: [$host, id, componentPath],
1652
1862
  headerParameters: [
1653
- traceparent,
1654
- tracestate,
1863
+ accept,
1655
1864
  contentType1,
1656
1865
  ifMatch
1657
1866
  ],
@@ -1669,9 +1878,8 @@ const listRelationshipsNextOperationSpec = {
1669
1878
  bodyMapper: ErrorResponse
1670
1879
  }
1671
1880
  },
1672
- queryParameters: [apiVersion, relationshipName],
1673
1881
  urlParameters: [$host, id, nextLink],
1674
- headerParameters: [traceparent, tracestate],
1882
+ headerParameters: [accept],
1675
1883
  serializer: serializer$1
1676
1884
  };
1677
1885
  const listIncomingRelationshipsNextOperationSpec = {
@@ -1685,9 +1893,8 @@ const listIncomingRelationshipsNextOperationSpec = {
1685
1893
  bodyMapper: ErrorResponse
1686
1894
  }
1687
1895
  },
1688
- queryParameters: [apiVersion],
1689
1896
  urlParameters: [$host, id, nextLink],
1690
- headerParameters: [traceparent, tracestate],
1897
+ headerParameters: [accept],
1691
1898
  serializer: serializer$1
1692
1899
  };
1693
1900
 
@@ -1698,10 +1905,9 @@ const listIncomingRelationshipsNextOperationSpec = {
1698
1905
  * Code generated by Microsoft (R) AutoRest Code Generator.
1699
1906
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1700
1907
  */
1701
- /**
1702
- * Class representing a EventRoutes.
1703
- */
1704
- class EventRoutes {
1908
+ /// <reference lib="esnext.asynciterable" />
1909
+ /** Class containing EventRoutes operations. */
1910
+ class EventRoutesImpl {
1705
1911
  /**
1706
1912
  * Initialize a new instance of the class EventRoutes class.
1707
1913
  * @param client Reference to the service client
@@ -1716,8 +1922,68 @@ class EventRoutes {
1716
1922
  * @param options The options parameters.
1717
1923
  */
1718
1924
  list(options) {
1719
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1720
- return this.client.sendOperationRequest({ options: operationOptions }, listOperationSpec);
1925
+ const iter = this.listPagingAll(options);
1926
+ return {
1927
+ next() {
1928
+ return iter.next();
1929
+ },
1930
+ [Symbol.asyncIterator]() {
1931
+ return this;
1932
+ },
1933
+ byPage: (settings) => {
1934
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1935
+ throw new Error("maxPageSize is not supported by this operation.");
1936
+ }
1937
+ return this.listPagingPage(options, settings);
1938
+ }
1939
+ };
1940
+ }
1941
+ listPagingPage(options, settings) {
1942
+ return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1943
+ let result;
1944
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1945
+ if (!continuationToken) {
1946
+ result = yield tslib.__await(this._list(options));
1947
+ let page = result.value || [];
1948
+ continuationToken = result.nextLink;
1949
+ setContinuationToken(page, continuationToken);
1950
+ yield yield tslib.__await(page);
1951
+ }
1952
+ while (continuationToken) {
1953
+ result = yield tslib.__await(this._listNext(continuationToken, options));
1954
+ continuationToken = result.nextLink;
1955
+ let page = result.value || [];
1956
+ setContinuationToken(page, continuationToken);
1957
+ yield yield tslib.__await(page);
1958
+ }
1959
+ });
1960
+ }
1961
+ listPagingAll(options) {
1962
+ return tslib.__asyncGenerator(this, arguments, function* listPagingAll_1() {
1963
+ var e_1, _a;
1964
+ try {
1965
+ for (var _b = tslib.__asyncValues(this.listPagingPage(options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
1966
+ const page = _c.value;
1967
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
1968
+ }
1969
+ }
1970
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1971
+ finally {
1972
+ try {
1973
+ if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
1974
+ }
1975
+ finally { if (e_1) throw e_1.error; }
1976
+ }
1977
+ });
1978
+ }
1979
+ /**
1980
+ * Retrieves all event routes.
1981
+ * Status codes:
1982
+ * * 200 OK
1983
+ * @param options The options parameters.
1984
+ */
1985
+ _list(options) {
1986
+ return this.client.sendOperationRequest({ options }, listOperationSpec);
1721
1987
  }
1722
1988
  /**
1723
1989
  * Retrieves an event route.
@@ -1729,8 +1995,7 @@ class EventRoutes {
1729
1995
  * @param options The options parameters.
1730
1996
  */
1731
1997
  getById(id, options) {
1732
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1733
- return this.client.sendOperationRequest({ id, options: operationOptions }, getByIdOperationSpec);
1998
+ return this.client.sendOperationRequest({ id, options }, getByIdOperationSpec);
1734
1999
  }
1735
2000
  /**
1736
2001
  * Adds or replaces an event route.
@@ -1745,8 +2010,7 @@ class EventRoutes {
1745
2010
  * @param options The options parameters.
1746
2011
  */
1747
2012
  add(id, options) {
1748
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1749
- return this.client.sendOperationRequest({ id, options: operationOptions }, addOperationSpec);
2013
+ return this.client.sendOperationRequest({ id, options }, addOperationSpec);
1750
2014
  }
1751
2015
  /**
1752
2016
  * Deletes an event route.
@@ -1758,21 +2022,19 @@ class EventRoutes {
1758
2022
  * @param options The options parameters.
1759
2023
  */
1760
2024
  delete(id, options) {
1761
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1762
- return this.client.sendOperationRequest({ id, options: operationOptions }, deleteOperationSpec);
2025
+ return this.client.sendOperationRequest({ id, options }, deleteOperationSpec);
1763
2026
  }
1764
2027
  /**
1765
2028
  * ListNext
1766
2029
  * @param nextLink The nextLink from the previous successful call to the List method.
1767
2030
  * @param options The options parameters.
1768
2031
  */
1769
- listNext(nextLink, options) {
1770
- const operationOptions = coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {});
1771
- return this.client.sendOperationRequest({ nextLink, options: operationOptions }, listNextOperationSpec);
2032
+ _listNext(nextLink, options) {
2033
+ return this.client.sendOperationRequest({ nextLink, options }, listNextOperationSpec);
1772
2034
  }
1773
2035
  }
1774
2036
  // Operation Specifications
1775
- const serializer = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
2037
+ const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
1776
2038
  const listOperationSpec = {
1777
2039
  path: "/eventroutes",
1778
2040
  httpMethod: "GET",
@@ -1786,11 +2048,7 @@ const listOperationSpec = {
1786
2048
  },
1787
2049
  queryParameters: [apiVersion],
1788
2050
  urlParameters: [$host],
1789
- headerParameters: [
1790
- traceparent,
1791
- tracestate,
1792
- maxItemsPerPage
1793
- ],
2051
+ headerParameters: [accept, resultsPerPage],
1794
2052
  serializer
1795
2053
  };
1796
2054
  const getByIdOperationSpec = {
@@ -1806,7 +2064,7 @@ const getByIdOperationSpec = {
1806
2064
  },
1807
2065
  queryParameters: [apiVersion],
1808
2066
  urlParameters: [$host, id],
1809
- headerParameters: [traceparent, tracestate],
2067
+ headerParameters: [accept],
1810
2068
  serializer
1811
2069
  };
1812
2070
  const addOperationSpec = {
@@ -1821,11 +2079,7 @@ const addOperationSpec = {
1821
2079
  requestBody: eventRoute,
1822
2080
  queryParameters: [apiVersion],
1823
2081
  urlParameters: [$host, id],
1824
- headerParameters: [
1825
- contentType,
1826
- traceparent,
1827
- tracestate
1828
- ],
2082
+ headerParameters: [contentType, accept],
1829
2083
  mediaType: "json",
1830
2084
  serializer
1831
2085
  };
@@ -1840,7 +2094,7 @@ const deleteOperationSpec = {
1840
2094
  },
1841
2095
  queryParameters: [apiVersion],
1842
2096
  urlParameters: [$host, id],
1843
- headerParameters: [traceparent, tracestate],
2097
+ headerParameters: [accept],
1844
2098
  serializer
1845
2099
  };
1846
2100
  const listNextOperationSpec = {
@@ -1854,13 +2108,8 @@ const listNextOperationSpec = {
1854
2108
  bodyMapper: ErrorResponse
1855
2109
  }
1856
2110
  },
1857
- queryParameters: [apiVersion],
1858
2111
  urlParameters: [$host, nextLink],
1859
- headerParameters: [
1860
- traceparent,
1861
- tracestate,
1862
- maxItemsPerPage
1863
- ],
2112
+ headerParameters: [accept, resultsPerPage],
1864
2113
  serializer
1865
2114
  };
1866
2115
 
@@ -1871,57 +2120,67 @@ const listNextOperationSpec = {
1871
2120
  * Code generated by Microsoft (R) AutoRest Code Generator.
1872
2121
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1873
2122
  */
1874
- const packageName = "@azure/digital-twins-core";
1875
- const packageVersion = "1.1.1";
1876
- class AzureDigitalTwinsAPIContext extends coreHttp__namespace.ServiceClient {
2123
+ class AzureDigitalTwinsAPI extends coreClient__namespace.ServiceClient {
1877
2124
  /**
1878
- * Initializes a new instance of the AzureDigitalTwinsAPIContext class.
2125
+ * Initializes a new instance of the AzureDigitalTwinsAPI class.
1879
2126
  * @param options The parameter options
1880
2127
  */
1881
2128
  constructor(options) {
2129
+ var _a, _b;
1882
2130
  // Initializing default values for options
1883
2131
  if (!options) {
1884
2132
  options = {};
1885
2133
  }
1886
- if (!options.userAgent) {
1887
- const defaultUserAgent = coreHttp__namespace.getDefaultUserAgentValue();
1888
- options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
1889
- }
1890
- super(undefined, options);
1891
- this.requestContentType = "application/json; charset=utf-8";
1892
- this.baseUri =
1893
- options.endpoint || "https://digitaltwins-name.digitaltwins.azure.net";
2134
+ const defaults = {
2135
+ requestContentType: "application/json; charset=utf-8"
2136
+ };
2137
+ const packageDetails = `azsdk-js-digital-twins-core/2.0.0`;
2138
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2139
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2140
+ : `${packageDetails}`;
2141
+ const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
2142
+ userAgentPrefix
2143
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://digitaltwins-hostname" });
2144
+ super(optionsWithDefaults);
1894
2145
  // Assigning values to Constant parameters
1895
- this.$host =
1896
- options.$host || "https://digitaltwins-name.digitaltwins.azure.net";
1897
- this.apiVersion = options.apiVersion || "2022-05-31";
1898
- }
1899
- }
1900
-
1901
- /*
1902
- * Copyright (c) Microsoft Corporation.
1903
- * Licensed under the MIT License.
1904
- *
1905
- * Code generated by Microsoft (R) AutoRest Code Generator.
1906
- * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1907
- */
1908
- class AzureDigitalTwinsAPI extends AzureDigitalTwinsAPIContext {
1909
- /**
1910
- * Initializes a new instance of the AzureDigitalTwinsAPI class.
1911
- * @param options The parameter options
1912
- */
1913
- constructor(options) {
1914
- super(options);
1915
- this.digitalTwinModels = new DigitalTwinModels(this);
1916
- this.query = new Query(this);
1917
- this.digitalTwins = new DigitalTwins(this);
1918
- this.eventRoutes = new EventRoutes(this);
2146
+ this.$host = options.$host || "https://digitaltwins-hostname";
2147
+ this.apiVersion = options.apiVersion || "2020-10-31";
2148
+ this.digitalTwinModels = new DigitalTwinModelsImpl(this);
2149
+ this.query = new QueryImpl(this);
2150
+ this.digitalTwins = new DigitalTwinsImpl(this);
2151
+ this.eventRoutes = new EventRoutesImpl(this);
2152
+ this.addCustomApiVersionPolicy(options.apiVersion);
2153
+ }
2154
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
2155
+ addCustomApiVersionPolicy(apiVersion) {
2156
+ if (!apiVersion) {
2157
+ return;
2158
+ }
2159
+ const apiVersionPolicy = {
2160
+ name: "CustomApiVersionPolicy",
2161
+ async sendRequest(request, next) {
2162
+ const param = request.url.split("?");
2163
+ if (param.length > 1) {
2164
+ const newParams = param[1].split("&").map((item) => {
2165
+ if (item.indexOf("api-version") > -1) {
2166
+ return "api-version=" + apiVersion;
2167
+ }
2168
+ else {
2169
+ return item;
2170
+ }
2171
+ });
2172
+ request.url = param[0] + "?" + newParams.join("&");
2173
+ }
2174
+ return next(request);
2175
+ }
2176
+ };
2177
+ this.pipeline.addPolicy(apiVersionPolicy);
1919
2178
  }
1920
2179
  }
1921
2180
 
1922
2181
  // Copyright (c) Microsoft Corporation.
1923
2182
  // Licensed under the MIT license.
1924
- const SDK_VERSION$1 = "1.1.1";
2183
+ const SDK_VERSION = "2.0.0";
1925
2184
 
1926
2185
  // Copyright (c) Microsoft Corporation.
1927
2186
  /**
@@ -1931,7 +2190,7 @@ const SDK_VERSION$1 = "1.1.1";
1931
2190
  const tracingClient = coreTracing.createTracingClient({
1932
2191
  namespace: "Microsoft.DigitalTwins",
1933
2192
  packageName: "@azure/digital-twins-core",
1934
- packageVersion: SDK_VERSION$1,
2193
+ packageVersion: SDK_VERSION,
1935
2194
  });
1936
2195
 
1937
2196
  // Copyright (c) Microsoft Corporation.
@@ -1941,7 +2200,6 @@ const tracingClient = coreTracing.createTracingClient({
1941
2200
  const logger = logger$1.createClientLogger("azure-digitaltwins-core");
1942
2201
 
1943
2202
  // Copyright (c) Microsoft Corporation.
1944
- const SDK_VERSION = "1.1.0";
1945
2203
  const DEFAULT_DIGITALTWINS_SCOPE = "https://digitaltwins.azure.net/.default";
1946
2204
  /**
1947
2205
  * Client for Azure IoT DigitalTwins API.
@@ -1964,33 +2222,18 @@ class DigitalTwinsClient {
1964
2222
  * @param options - Used to configure the service client.
1965
2223
  */
1966
2224
  constructor(endpointUrl, credential, options = {}) {
1967
- const authPolicy = coreHttp.bearerTokenAuthenticationPolicy(credential, DEFAULT_DIGITALTWINS_SCOPE);
1968
- const libInfo = `azsdk-js-digital-twins-core/${SDK_VERSION}`;
1969
- const { apiVersion } = options, pipelineOptions = tslib.__rest(options, ["apiVersion"]);
1970
- if (!pipelineOptions.userAgentOptions) {
1971
- pipelineOptions.userAgentOptions = {};
1972
- }
1973
- if (pipelineOptions.userAgentOptions.userAgentPrefix) {
1974
- pipelineOptions.userAgentOptions.userAgentPrefix = `${pipelineOptions.userAgentOptions.userAgentPrefix} ${libInfo}`;
1975
- }
1976
- else {
1977
- pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;
1978
- }
1979
- const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
1980
- loggingOptions: {
2225
+ const internalPipelineOptions = Object.assign(Object.assign({}, options), { loggingOptions: {
1981
2226
  logger: logger.info,
1982
- allowedHeaderNames: ["x-ms-request-id"],
1983
- },
1984
- });
1985
- const pipeline = coreHttp.createPipelineFromOptions(internalPipelineOptions, authPolicy);
1986
- this.client = new AzureDigitalTwinsAPI(Object.assign({ endpoint: endpointUrl, apiVersion }, pipeline));
2227
+ additionalAllowedHeaderNames: ["x-ms-request-id"],
2228
+ } });
2229
+ this.client = new AzureDigitalTwinsAPI(Object.assign({ endpoint: endpointUrl, credential, credentialScopes: DEFAULT_DIGITALTWINS_SCOPE }, internalPipelineOptions));
1987
2230
  }
1988
2231
  /**
1989
2232
  * Get a digital twin
1990
2233
  *
1991
2234
  * @param digitalTwinId - The Id of the digital twin.
1992
2235
  * @param options - The operation options
1993
- * @returns The application/json digital twin and the http response.
2236
+ * @returns The application/json digital twin.
1994
2237
  */
1995
2238
  getDigitalTwin(digitalTwinId, options = {}) {
1996
2239
  return tracingClient.withSpan("DigitalTwinsClient.getDigitalTwin", options, async (updatedOptions) => {
@@ -2004,7 +2247,7 @@ class DigitalTwinsClient {
2004
2247
  * @param digitalTwinJson - The application/json digital twin to create.
2005
2248
  * @param options - Extended operation options including
2006
2249
  * ifNoneMatch: Only perform the operation if the entity does not already exist.
2007
- * @returns The created application/json digital twin and the http response.
2250
+ * @returns The created application/json digital twin.
2008
2251
  */
2009
2252
  upsertDigitalTwin(digitalTwinId, digitalTwinJson, options = {}) {
2010
2253
  return tracingClient.withSpan("DigitalTwinsClient.upsertDigitalTwin", options, async (updatedOptions) => {
@@ -2021,11 +2264,9 @@ class DigitalTwinsClient {
2021
2264
  * remove.
2022
2265
  * @param options - Extended operation options including
2023
2266
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
2024
- * @returns The http response.
2267
+
2025
2268
  */
2026
- updateDigitalTwin(digitalTwinId,
2027
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
2028
- jsonPatch, options = {}) {
2269
+ updateDigitalTwin(digitalTwinId, jsonPatch, options = {}) {
2029
2270
  return tracingClient.withSpan("DigitalTwinsClient.updateDigitalTwin", options, async (updatedOptions) => {
2030
2271
  return this.client.digitalTwins.update(digitalTwinId, jsonPatch, updatedOptions);
2031
2272
  });
@@ -2036,7 +2277,7 @@ class DigitalTwinsClient {
2036
2277
  * @param digitalTwinId - The Id of the digital twin to delete.
2037
2278
  * @param options - Extended operation options including
2038
2279
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
2039
- * @returns The http response.
2280
+
2040
2281
  */
2041
2282
  deleteDigitalTwin(digitalTwinId, options = {}) {
2042
2283
  return tracingClient.withSpan("DigitalTwinsClient.deleteDigitalTwin", options, async (updatedOptions) => {
@@ -2049,7 +2290,7 @@ class DigitalTwinsClient {
2049
2290
  * @param digitalTwinId - The Id of the digital twin.
2050
2291
  * @param componentName - The component being retrieved.
2051
2292
  * @param options - The operation options
2052
- * @returns Json string representation of the component corresponding to the provided componentName and the HTTP response.
2293
+ * @returns Json string representation of the component corresponding to the provided componentName.
2053
2294
  */
2054
2295
  getComponent(digitalTwinId, componentName, options = {}) {
2055
2296
  return tracingClient.withSpan("DigitalTwinsClient.getComponent", options, async (updatedOptions) => {
@@ -2065,7 +2306,7 @@ class DigitalTwinsClient {
2065
2306
  * @param enableUpdate - If true then update of an existing digital twin is enabled.
2066
2307
  * @param options - Extended operation options including
2067
2308
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is provided.
2068
- * @returns The http response.
2309
+
2069
2310
  */
2070
2311
  updateComponent(digitalTwinId, componentName, jsonPatch, options = {}) {
2071
2312
  return tracingClient.withSpan("DigitalTwinsClient.updateComponent", options, async (updatedOptions) => {
@@ -2078,7 +2319,7 @@ class DigitalTwinsClient {
2078
2319
  * @param digitalTwinId - The Id of the source digital twin.
2079
2320
  * @param relationshipId - The Id of the relationship to retrieve.
2080
2321
  * @param options - The operation options
2081
- * @returns The pageable list of application/json relationships belonging to the specified digital twin and the http response.
2322
+ * @returns The pageable list of application/json relationships belonging to the specified digital twin.
2082
2323
  */
2083
2324
  getRelationship(digitalTwinId, relationshipId, options = {}) {
2084
2325
  return tracingClient.withSpan("DigitalTwinsClient.getRelationship", options, async (updatedOptions) => {
@@ -2094,9 +2335,7 @@ class DigitalTwinsClient {
2094
2335
  * @param options - Extended operation options including
2095
2336
  * ifNoneMatch: Only perform the operation if the entity does not already exist.
2096
2337
  */
2097
- upsertRelationship(digitalTwinId, relationshipId,
2098
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
2099
- relationship, options = {}) {
2338
+ upsertRelationship(digitalTwinId, relationshipId, relationship, options = {}) {
2100
2339
  return tracingClient.withSpan("DigitalTwinsClient.upsertRelationship", options, async (updatedOptions) => {
2101
2340
  return this.client.digitalTwins.addRelationship(digitalTwinId, relationshipId, relationship, updatedOptions);
2102
2341
  });
@@ -2122,141 +2361,28 @@ class DigitalTwinsClient {
2122
2361
  * @param relationshipId - The Id of the relationship to delete.
2123
2362
  * @param options - The operation options
2124
2363
  * ifMatch: Only perform the operation if the entity's etag matches one of the etags provided or * is
2125
- * @returns The http response.
2364
+
2126
2365
  */
2127
2366
  deleteRelationship(digitalTwinId, relationshipId, options = {}) {
2128
2367
  return tracingClient.withSpan("DigitalTwinsClient.deleteRelationship", options, async (updatedOptions) => {
2129
2368
  return this.client.digitalTwins.deleteRelationship(digitalTwinId, relationshipId, updatedOptions);
2130
2369
  });
2131
2370
  }
2132
- /**
2133
- * Deals with the pagination of {@link listRelationships}.
2134
- *
2135
- * @param digitalTwinId - The Id of the digital twin.
2136
- * @param options - Common options for the iterative endpoints.
2137
- * @param continuationState - An object that indicates the position of the paginated request.
2138
- *
2139
- */
2140
- listRelationshipsPage(digitalTwinId, options, continuationState) {
2141
- return tslib.__asyncGenerator(this, arguments, function* listRelationshipsPage_1() {
2142
- if (continuationState.continuationToken == null) {
2143
- const optionsComplete = Object.assign({}, options);
2144
- const listRelationshipResponse = yield tslib.__await(this.client.digitalTwins.listRelationships(digitalTwinId, optionsComplete));
2145
- continuationState.continuationToken = listRelationshipResponse.nextLink;
2146
- yield yield tslib.__await(listRelationshipResponse);
2147
- }
2148
- while (continuationState.continuationToken) {
2149
- const listRelationshipResponse = yield tslib.__await(this.client.digitalTwins.listRelationshipsNext("", continuationState.continuationToken, options));
2150
- continuationState.continuationToken = listRelationshipResponse.nextLink;
2151
- yield yield tslib.__await(listRelationshipResponse);
2152
- }
2153
- });
2154
- }
2155
- /**
2156
- * Deals with the iteration of all the available results of {@link listRelationships}.
2157
- * @param options - Common options for the iterative endpoints.
2158
- */
2159
- listRelationshipsAll(digitalTwinId, options) {
2160
- return tslib.__asyncGenerator(this, arguments, function* listRelationshipsAll_1() {
2161
- var e_1, _a;
2162
- try {
2163
- for (var _b = tslib.__asyncValues(this.listRelationshipsPage(digitalTwinId, options, {})), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
2164
- const page = _c.value;
2165
- const value = page.value || [];
2166
- for (const item of value) {
2167
- yield yield tslib.__await(item);
2168
- }
2169
- }
2170
- }
2171
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2172
- finally {
2173
- try {
2174
- if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
2175
- }
2176
- finally { if (e_1) throw e_1.error; }
2177
- }
2178
- });
2179
- }
2180
2371
  /**
2181
2372
  * Retrieve relationships for a digital twin.
2182
2373
  *
2183
2374
  * @param digitalTwinId - The Id of the digital twin.
2184
2375
  */
2185
- listRelationships(digitalTwinId, options = {}) {
2186
- const iter = this.listRelationshipsAll(digitalTwinId, options);
2187
- return {
2188
- next() {
2189
- return iter.next();
2190
- },
2191
- [Symbol.asyncIterator]() {
2192
- return this;
2193
- },
2194
- byPage: (settings = {}) => this.listRelationshipsPage(digitalTwinId, options, settings),
2195
- };
2196
- }
2197
- /**
2198
- * Deals with the pagination of {@link listIncomingRelationships}.
2199
- *
2200
- * @param digitalTwinId - The Id of the digital twin.
2201
- * @param options - Common options for the iterative endpoints.
2202
- * @param continuationState - An object that indicates the position of the paginated request.
2203
- *
2204
- */
2205
- listIncomingRelationshipsPage(digitalTwinId, options, continuationState) {
2206
- return tslib.__asyncGenerator(this, arguments, function* listIncomingRelationshipsPage_1() {
2207
- if (continuationState.continuationToken == null) {
2208
- const optionsComplete = Object.assign({}, options);
2209
- const listIncomingRelationshipsResponse = yield tslib.__await(this.client.digitalTwins.listIncomingRelationships(digitalTwinId, optionsComplete));
2210
- continuationState.continuationToken = listIncomingRelationshipsResponse.nextLink;
2211
- yield yield tslib.__await(listIncomingRelationshipsResponse);
2212
- }
2213
- while (continuationState.continuationToken) {
2214
- const listIncomingRelationshipsResponse = yield tslib.__await(this.client.digitalTwins.listIncomingRelationshipsNext("", continuationState.continuationToken, options));
2215
- continuationState.continuationToken = listIncomingRelationshipsResponse.nextLink;
2216
- yield yield tslib.__await(listIncomingRelationshipsResponse);
2217
- }
2218
- });
2219
- }
2220
- /**
2221
- * Deals with the iteration of all the available results of {@link listIncomingRelationships}.
2222
- * @param digitalTwinId - The Id of the digital twin.
2223
- * @param options - Common options for the iterative endpoints.
2224
- */
2225
- listIncomingRelationshipsAll(digitalTwinId, options) {
2226
- return tslib.__asyncGenerator(this, arguments, function* listIncomingRelationshipsAll_1() {
2227
- var e_2, _a;
2228
- try {
2229
- for (var _b = tslib.__asyncValues(this.listIncomingRelationshipsPage(digitalTwinId, options, {})), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
2230
- const page = _c.value;
2231
- const value = page.value || [];
2232
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(value)));
2233
- }
2234
- }
2235
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2236
- finally {
2237
- try {
2238
- if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
2239
- }
2240
- finally { if (e_2) throw e_2.error; }
2241
- }
2242
- });
2376
+ listRelationships(digitalTwinId, options) {
2377
+ return this.client.digitalTwins.listRelationships(digitalTwinId, options);
2243
2378
  }
2244
2379
  /**
2245
2380
  * Retrieve all incoming relationships for a digital twin.
2246
2381
  *
2247
2382
  * @param digitalTwinId - The Id of the digital twin.
2248
2383
  */
2249
- listIncomingRelationships(digitalTwinId, options = {}) {
2250
- const iter = this.listIncomingRelationshipsAll(digitalTwinId, options);
2251
- return {
2252
- next() {
2253
- return iter.next();
2254
- },
2255
- [Symbol.asyncIterator]() {
2256
- return this;
2257
- },
2258
- byPage: (settings = {}) => this.listIncomingRelationshipsPage(digitalTwinId, options, settings),
2259
- };
2384
+ listIncomingRelationships(digitalTwinId, options) {
2385
+ return this.client.digitalTwins.listIncomingRelationships(digitalTwinId, options);
2260
2386
  }
2261
2387
  /**
2262
2388
  * Publish telemetry from a digital twin, which is then consumed by one or many destination endpoints (subscribers) defined under.
@@ -2265,18 +2391,11 @@ class DigitalTwinsClient {
2265
2391
  * @param payload - The application/json telemetry payload to be sent.
2266
2392
  * @param messageId - The message Id.
2267
2393
  * @param options - The operation options
2268
- * @returns The http response.
2269
- */
2270
- publishTelemetry(digitalTwinId,
2271
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- changing the type any would be a breaking change
2272
- payload, messageId, options = {}) {
2273
- const digitalTwinsSendTelemetryOptionalParams = options;
2274
- digitalTwinsSendTelemetryOptionalParams.telemetrySourceTime = new Date().toISOString();
2275
- if (!messageId) {
2276
- messageId = coreHttp.generateUuid();
2277
- }
2278
- return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", digitalTwinsSendTelemetryOptionalParams, async (updatedOptions) => {
2279
- return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId, payload, updatedOptions);
2394
+
2395
+ */
2396
+ publishTelemetry(digitalTwinId, payload, messageId, options = {}) {
2397
+ return tracingClient.withSpan("DigitalTwinsClient.publishTelemetry", options, async (updatedOptions) => {
2398
+ return this.client.digitalTwins.sendTelemetry(digitalTwinId, messageId || uuid.v4(), payload, Object.assign(Object.assign({}, updatedOptions), { telemetrySourceTime: new Date().toISOString() }));
2280
2399
  });
2281
2400
  }
2282
2401
  /**
@@ -2287,119 +2406,45 @@ class DigitalTwinsClient {
2287
2406
  * @param payload - The application/json telemetry payload to be sent.
2288
2407
  * @param messageId - The message Id.
2289
2408
  * @param options - The operation options
2290
- * @returns The http response.
2409
+
2291
2410
  */
2292
2411
  publishComponentTelemetry(digitalTwinId, componentName, payload, messageId, options = {}) {
2293
- const digitalTwinsSendComponentTelemetryOptionalParams = options;
2294
- digitalTwinsSendComponentTelemetryOptionalParams.telemetrySourceTime = new Date().toISOString();
2295
- if (!messageId) {
2296
- messageId = coreHttp.generateUuid();
2297
- }
2298
- return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", digitalTwinsSendComponentTelemetryOptionalParams, async (updatedOptions) => {
2299
- return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, payload, messageId, updatedOptions);
2412
+ return tracingClient.withSpan("DigitalTwinsClient.publishComponentTelemetry", options, async (updatedOptions) => {
2413
+ return this.client.digitalTwins.sendComponentTelemetry(digitalTwinId, componentName, messageId || uuid.v4(), payload, Object.assign(Object.assign({}, updatedOptions), { telemetrySourceTime: new Date().toISOString() }));
2300
2414
  });
2301
2415
  }
2302
2416
  /**
2303
2417
  * Get a model, including the model metadata and the model definition.
2304
2418
  *
2305
2419
  * @param modelId - The Id of the model.
2306
- * @param options - Extended operation options including
2307
- * includeModelDefinition: When true the model definition will be returned as part of the result. Default value: false.
2308
- * @returns The application/json model and the http response.
2420
+ * @param options - Options for this operation
2421
+ * @returns The application/json model.
2309
2422
  */
2310
- getModel(modelId, includeModelDefinition = false, options = {}) {
2311
- const digitalTwinModelsGetByIdOptionalParams = options;
2312
- digitalTwinModelsGetByIdOptionalParams.includeModelDefinition = includeModelDefinition;
2313
- return tracingClient.withSpan("DigitalTwinsClient.getModel", digitalTwinModelsGetByIdOptionalParams, async (updatedOptions) => {
2423
+ getModel(modelId, options = {}) {
2424
+ var _a;
2425
+ return tracingClient.withSpan("DigitalTwinsClient.getModel", Object.assign(Object.assign({}, options), { includeModelDefinition: (_a = options === null || options === void 0 ? void 0 : options.includeModelDefinition) !== null && _a !== void 0 ? _a : false }), async (updatedOptions) => {
2314
2426
  return this.client.digitalTwinModels.getById(modelId, updatedOptions);
2315
2427
  });
2316
2428
  }
2317
- /**
2318
- * Deals with the pagination of {@link list}.
2319
- *
2320
- * @param options - Common options for the iterative endpoints.
2321
- * @param continuationState - An object that indicates the position of the paginated request.
2322
- *
2323
- */
2324
- getModelsPage(options, continuationState) {
2325
- return tslib.__asyncGenerator(this, arguments, function* getModelsPage_1() {
2326
- if (continuationState.continuationToken == null) {
2327
- const optionsComplete = options;
2328
- optionsComplete.maxItemsPerPage = continuationState.maxPageSize;
2329
- const listResponse = yield tslib.__await(this.client.digitalTwinModels.list(optionsComplete));
2330
- continuationState.continuationToken = listResponse.nextLink;
2331
- yield yield tslib.__await(listResponse);
2332
- }
2333
- while (continuationState.continuationToken) {
2334
- const listResponse = yield tslib.__await(this.client.digitalTwinModels.listNext(continuationState.continuationToken, options));
2335
- continuationState.continuationToken = listResponse.nextLink;
2336
- yield yield tslib.__await(listResponse);
2337
- }
2338
- });
2339
- }
2340
- /**
2341
- * Deals with the iteration of all the available results of {@link list}.
2342
- * @param options - Common options for the iterative endpoints.
2343
- */
2344
- getModelsAll(options) {
2345
- return tslib.__asyncGenerator(this, arguments, function* getModelsAll_1() {
2346
- var e_3, _a;
2347
- const f = {};
2348
- try {
2349
- for (var _b = tslib.__asyncValues(this.getModelsPage(options, f)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
2350
- const page = _c.value;
2351
- const value = page.value || [];
2352
- for (const item of value) {
2353
- yield yield tslib.__await(item);
2354
- }
2355
- }
2356
- }
2357
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2358
- finally {
2359
- try {
2360
- if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
2361
- }
2362
- finally { if (e_3) throw e_3.error; }
2363
- }
2364
- });
2365
- }
2366
2429
  /**
2367
2430
  * Get the list of models
2368
2431
  *
2369
- * @param dependeciesFor - The model Ids to have dependencies retrieved. If omitted, all models are retrieved.
2370
- * @param includeModelDefinition - Whether to include the model definition in the result. If false, only the model metadata will be returned.
2371
- * @param resultsPerPage - The maximum number of items to retrieve per request. The server may choose to return less than the requested max.
2372
- * @returns A pageable set of application/json models and the http response.
2373
- */
2374
- listModels(dependeciesFor, includeModelDefinition = false, resultsPerPage, options = {}) {
2375
- let digitalTwinModelsListOptionalParams = options;
2376
- digitalTwinModelsListOptionalParams = {
2377
- maxItemsPerPage: resultsPerPage,
2378
- dependenciesFor: dependeciesFor,
2379
- includeModelDefinition: includeModelDefinition,
2380
- };
2381
- const iter = this.getModelsAll(digitalTwinModelsListOptionalParams);
2382
- return {
2383
- next() {
2384
- return iter.next();
2385
- },
2386
- [Symbol.asyncIterator]() {
2387
- return this;
2388
- },
2389
- byPage: (settings = {}) => this.getModelsPage(digitalTwinModelsListOptionalParams, settings),
2390
- };
2432
+ * @param options - Options for listing models.
2433
+ * @returns A pageable set of application/json models.
2434
+ */
2435
+ listModels(options = {}) {
2436
+ var _a;
2437
+ return this.client.digitalTwinModels.list(Object.assign(Object.assign({}, options), { includeModelDefinition: (_a = options === null || options === void 0 ? void 0 : options.includeModelDefinition) !== null && _a !== void 0 ? _a : false }));
2391
2438
  }
2392
2439
  /**
2393
2440
  * Create one or many
2394
2441
  *
2395
- * @param models - The set of models to create. Each string corresponds to exactly one model.
2442
+ * @param dtdlModels - The set of models to create. Each string corresponds to exactly one model.
2396
2443
  * @param options - The operation options
2397
- * @returns The created application/json models and the http response.
2444
+ * @returns The created application/json models.
2398
2445
  */
2399
2446
  createModels(dtdlModels, options = {}) {
2400
- const digitalTwinModelsAddOptionalParams = options;
2401
- digitalTwinModelsAddOptionalParams.models = dtdlModels;
2402
- return tracingClient.withSpan("DigitalTwinsClient.createModels", digitalTwinModelsAddOptionalParams, async (updatedOptions) => {
2447
+ return tracingClient.withSpan("DigitalTwinsClient.createModels", Object.assign(Object.assign({}, options), { models: dtdlModels }), async (updatedOptions) => {
2403
2448
  return this.client.digitalTwinModels.add(updatedOptions);
2404
2449
  });
2405
2450
  }
@@ -2412,7 +2457,7 @@ class DigitalTwinsClient {
2412
2457
  * @param modelId - The Id of the model to decommission.
2413
2458
  * property can be replaced.
2414
2459
  * @param options - The operation options
2415
- * @returns The http response.
2460
+
2416
2461
  *
2417
2462
  */
2418
2463
  decomissionModel(modelId, options = {}) {
@@ -2426,7 +2471,7 @@ class DigitalTwinsClient {
2426
2471
  *
2427
2472
  * @param modelId - The Id of the model to delete.
2428
2473
  * @param options - The operation options
2429
- * @returns The http response.
2474
+
2430
2475
  */
2431
2476
  deleteModel(modelId, options = {}) {
2432
2477
  return tracingClient.withSpan("DigitalTwinsClient.deleteModel", options, async (updatedOptions) => {
@@ -2438,84 +2483,21 @@ class DigitalTwinsClient {
2438
2483
  *
2439
2484
  * @param modelId - The Id of the event route.
2440
2485
  * @param options - The operation options
2441
- * @returns The application/json event route and the http response.
2486
+ * @returns The application/json event route.
2442
2487
  */
2443
2488
  getEventRoute(eventRouteId, options = {}) {
2444
2489
  return tracingClient.withSpan("DigitalTwinsClient.getEventRoute", options, async (updatedOptions) => {
2445
2490
  return this.client.eventRoutes.getById(eventRouteId, updatedOptions);
2446
2491
  });
2447
2492
  }
2448
- /**
2449
- * Deals with the pagination of {@link list}.
2450
- *
2451
- * @param options - Common options for the iterative endpoints.
2452
- * @param continuationState - An object that indicates the position of the paginated request.
2453
- *
2454
- */
2455
- getEventRoutesPage(options, continuationState) {
2456
- return tslib.__asyncGenerator(this, arguments, function* getEventRoutesPage_1() {
2457
- if (continuationState.continuationToken == null) {
2458
- const optionsComplete = options;
2459
- optionsComplete.maxItemsPerPage = continuationState.maxPageSize;
2460
- const listResponse = yield tslib.__await(this.client.eventRoutes.list(optionsComplete));
2461
- continuationState.continuationToken = listResponse.nextLink;
2462
- yield yield tslib.__await(listResponse);
2463
- }
2464
- while (continuationState.continuationToken) {
2465
- const listResponse = yield tslib.__await(this.client.eventRoutes.listNext(continuationState.continuationToken, options));
2466
- continuationState.continuationToken = listResponse.nextLink;
2467
- yield yield tslib.__await(listResponse);
2468
- }
2469
- });
2470
- }
2471
- /**
2472
- * Deals with the iteration of all the available results of {@link list}.
2473
- * @param options - Common options for the iterative endpoints.
2474
- */
2475
- getEventRoutesAll(options) {
2476
- return tslib.__asyncGenerator(this, arguments, function* getEventRoutesAll_1() {
2477
- var e_4, _a;
2478
- const f = {};
2479
- try {
2480
- for (var _b = tslib.__asyncValues(this.getEventRoutesPage(options, f)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
2481
- const page = _c.value;
2482
- const value = page.value || [];
2483
- for (const item of value) {
2484
- yield yield tslib.__await(item);
2485
- }
2486
- }
2487
- }
2488
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
2489
- finally {
2490
- try {
2491
- if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
2492
- }
2493
- finally { if (e_4) throw e_4.error; }
2494
- }
2495
- });
2496
- }
2497
2493
  /**
2498
2494
  * List the event routes in a digital twins instance.
2499
2495
  *
2500
- * @param resultsPerPage - The maximum number of items to retrieve per request. The server may choose to return less than
2501
- * the requested max.
2502
- * @returns The application/json event route and the http response.
2503
- */
2504
- listEventRoutes(resultsPerPage, options = {}) {
2505
- let eventRoutesListOptionalParams = options;
2506
- eventRoutesListOptionalParams = {
2507
- maxItemsPerPage: resultsPerPage,
2508
- };
2509
- const iter = this.getEventRoutesAll(eventRoutesListOptionalParams);
2510
- return {
2511
- next() {
2512
- return iter.next();
2513
- },
2514
- [Symbol.asyncIterator]() {
2515
- return this;
2516
- },
2517
- byPage: (settings = {}) => this.getEventRoutesPage(eventRoutesListOptionalParams, settings),
2518
- };
2496
+ * @param options - Options for listEventRoutes.
2497
+ * @returns The application/json event route.
2498
+ */
2499
+ listEventRoutes(options) {
2500
+ return this.client.eventRoutes.list(options);
2519
2501
  }
2520
2502
  /**
2521
2503
  * Create or update an event route.
@@ -2524,16 +2506,13 @@ class DigitalTwinsClient {
2524
2506
  * @param endpointId - The id of the endpoint this event route is bound to.
2525
2507
  * @param filter - An expression which describes the events which are routed to the endpoint.
2526
2508
  * @param options - The operation options
2527
- * @returns The http response.
2509
+
2528
2510
  */
2529
2511
  upsertEventRoute(eventRouteId, endpointId, filter, options = {}) {
2530
- const eventRoutesAddOptionalParams = options;
2531
- const eventRoute = {
2532
- endpointName: endpointId,
2533
- filter: filter,
2534
- };
2535
- eventRoutesAddOptionalParams.eventRoute = eventRoute;
2536
- return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", eventRoutesAddOptionalParams, async (updatedOptions) => {
2512
+ return tracingClient.withSpan("DigitalTwinsClient.upsertEventRoute", Object.assign({ eventRoute: {
2513
+ endpointName: endpointId,
2514
+ filter,
2515
+ } }, options), async (updatedOptions) => {
2537
2516
  return this.client.eventRoutes.add(eventRouteId, updatedOptions);
2538
2517
  });
2539
2518
  }
@@ -2542,7 +2521,7 @@ class DigitalTwinsClient {
2542
2521
  *
2543
2522
  * @param eventRouteId - The Id of the eventRoute to delete.
2544
2523
  * @param options - The operation options
2545
- * @returns The http response.
2524
+
2546
2525
  */
2547
2526
  deleteEventRoute(eventRouteId, options = {}) {
2548
2527
  return tracingClient.withSpan("DigitalTwinsClient.deleteEventRoute", options, async (updatedOptions) => {
@@ -2559,22 +2538,15 @@ class DigitalTwinsClient {
2559
2538
  */
2560
2539
  queryTwinsPage(query, options, continuationState) {
2561
2540
  return tslib.__asyncGenerator(this, arguments, function* queryTwinsPage_1() {
2562
- if (continuationState.continuationToken == null) {
2563
- const querySpecification = {
2564
- query: query,
2565
- continuationToken: continuationState.continuationToken,
2566
- };
2567
- const queryResult = yield tslib.__await(this.client.query.queryTwins(querySpecification, options));
2568
- continuationState.continuationToken = queryResult.continuationToken;
2541
+ let { continuationToken } = continuationState !== null && continuationState !== void 0 ? continuationState : {};
2542
+ if (!continuationToken) {
2543
+ const queryResult = yield tslib.__await(this.client.query.queryTwins({ query }, options));
2544
+ continuationToken = queryResult.continuationToken;
2569
2545
  yield yield tslib.__await(queryResult);
2570
2546
  }
2571
- while (continuationState.continuationToken) {
2572
- const querySpecification = {
2573
- query: query,
2574
- continuationToken: continuationState.continuationToken,
2575
- };
2576
- const queryResult = yield tslib.__await(this.client.query.queryTwins(querySpecification, options));
2577
- continuationState.continuationToken = queryResult.continuationToken;
2547
+ while (continuationToken) {
2548
+ const queryResult = yield tslib.__await(this.client.query.queryTwins({ query, continuationToken }, options));
2549
+ continuationToken = queryResult.continuationToken;
2578
2550
  yield yield tslib.__await(queryResult);
2579
2551
  }
2580
2552
  });
@@ -2586,24 +2558,21 @@ class DigitalTwinsClient {
2586
2558
  */
2587
2559
  queryTwinsAll(query, options) {
2588
2560
  return tslib.__asyncGenerator(this, arguments, function* queryTwinsAll_1() {
2589
- var e_5, _a;
2590
- const f = {};
2561
+ var e_1, _a;
2591
2562
  try {
2592
- for (var _b = tslib.__asyncValues(this.queryTwinsPage(query, options, f)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
2563
+ for (var _b = tslib.__asyncValues(this.queryTwinsPage(query, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
2593
2564
  const page = _c.value;
2594
2565
  if (page.value) {
2595
- for (const item of page.value) {
2596
- yield yield tslib.__await(item);
2597
- }
2566
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page.value)));
2598
2567
  }
2599
2568
  }
2600
2569
  }
2601
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2570
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2602
2571
  finally {
2603
2572
  try {
2604
2573
  if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
2605
2574
  }
2606
- finally { if (e_5) throw e_5.error; }
2575
+ finally { if (e_1) throw e_1.error; }
2607
2576
  }
2608
2577
  });
2609
2578
  }
@@ -2611,15 +2580,11 @@ class DigitalTwinsClient {
2611
2580
  * Query for digital twins.
2612
2581
  *
2613
2582
  * @param query - The query string, in SQL-like syntax.
2614
- * @param resultsPerPage - The maximum number of items to retrieve per request. The server may choose to return less than the requested max.
2583
+ * @param options - Options for the query operation.
2615
2584
  * @returns The pageable list of query results.
2616
2585
  */
2617
- queryTwins(query, resultsPerPage, options = {}) {
2618
- let queryQueryTwinsOptionalParams = options;
2619
- queryQueryTwinsOptionalParams = {
2620
- maxItemsPerPage: resultsPerPage,
2621
- };
2622
- const iter = this.queryTwinsAll(query, queryQueryTwinsOptionalParams);
2586
+ queryTwins(query, options = {}) {
2587
+ const iter = this.queryTwinsAll(query, options);
2623
2588
  return {
2624
2589
  next() {
2625
2590
  return iter.next();
@@ -2627,7 +2592,7 @@ class DigitalTwinsClient {
2627
2592
  [Symbol.asyncIterator]() {
2628
2593
  return this;
2629
2594
  },
2630
- byPage: (settings = {}) => this.queryTwinsPage(query, queryQueryTwinsOptionalParams, settings),
2595
+ byPage: (settings = {}) => this.queryTwinsPage(query, options, settings),
2631
2596
  };
2632
2597
  }
2633
2598
  }