@azure/arm-healthbot 1.0.0 → 2.0.1-alpha.20220113.4

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 (118) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +21 -0
  3. package/README.md +70 -74
  4. package/dist/index.js +1301 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/dist/index.min.js.map +1 -0
  8. package/dist-esm/src/healthbotClient.d.ts +19 -0
  9. package/dist-esm/src/healthbotClient.d.ts.map +1 -0
  10. package/dist-esm/src/healthbotClient.js +52 -0
  11. package/dist-esm/src/healthbotClient.js.map +1 -0
  12. package/dist-esm/src/index.d.ts +5 -0
  13. package/dist-esm/src/index.d.ts.map +1 -0
  14. package/dist-esm/src/index.js +12 -0
  15. package/dist-esm/src/index.js.map +1 -0
  16. package/dist-esm/src/lroImpl.d.ts +16 -0
  17. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  18. package/dist-esm/src/lroImpl.js +29 -0
  19. package/dist-esm/src/lroImpl.js.map +1 -0
  20. package/dist-esm/src/models/index.d.ts +309 -0
  21. package/dist-esm/src/models/index.d.ts.map +1 -0
  22. package/dist-esm/src/models/index.js +16 -0
  23. package/dist-esm/src/models/index.js.map +1 -0
  24. package/dist-esm/src/models/mappers.d.ts +19 -0
  25. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  26. package/{esm → dist-esm/src}/models/mappers.js +252 -199
  27. package/dist-esm/src/models/mappers.js.map +1 -0
  28. package/dist-esm/src/models/parameters.d.ts +12 -0
  29. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  30. package/dist-esm/src/models/parameters.js +112 -0
  31. package/dist-esm/src/models/parameters.js.map +1 -0
  32. package/dist-esm/src/operations/bots.d.ts +99 -0
  33. package/dist-esm/src/operations/bots.d.ts.map +1 -0
  34. package/dist-esm/src/operations/bots.js +454 -0
  35. package/dist-esm/src/operations/bots.js.map +1 -0
  36. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  37. package/dist-esm/src/operations/index.d.ts.map +1 -0
  38. package/{esm → dist-esm/src}/operations/index.js +1 -2
  39. package/dist-esm/src/operations/index.js.map +1 -0
  40. package/dist-esm/src/operations/operations.d.ts +32 -0
  41. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  42. package/dist-esm/src/operations/operations.js +120 -0
  43. package/dist-esm/src/operations/operations.js.map +1 -0
  44. package/dist-esm/src/operationsInterfaces/bots.d.ts +63 -0
  45. package/dist-esm/src/operationsInterfaces/bots.d.ts.map +1 -0
  46. package/{esm/models/index.js → dist-esm/src/operationsInterfaces/bots.js} +2 -1
  47. package/dist-esm/src/operationsInterfaces/bots.js.map +1 -0
  48. package/dist-esm/src/operationsInterfaces/index.d.ts +3 -0
  49. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  50. package/{esm/models/operationsMappers.js → dist-esm/src/operationsInterfaces/index.js} +3 -2
  51. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  52. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  53. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  54. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  55. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  56. package/dist-esm/test/sampleTest.d.ts +2 -0
  57. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  58. package/dist-esm/test/sampleTest.js +40 -0
  59. package/dist-esm/test/sampleTest.js.map +1 -0
  60. package/package.json +65 -21
  61. package/review/arm-healthbot.api.md +271 -0
  62. package/rollup.config.js +181 -30
  63. package/src/healthbotClient.ts +62 -28
  64. package/src/index.ts +12 -0
  65. package/src/lroImpl.ts +34 -0
  66. package/src/models/index.ts +239 -394
  67. package/src/models/mappers.ts +260 -204
  68. package/src/models/parameters.ts +81 -33
  69. package/src/operations/bots.ts +424 -322
  70. package/src/operations/index.ts +1 -2
  71. package/src/operations/operations.ts +87 -75
  72. package/src/operationsInterfaces/bots.ts +116 -0
  73. package/src/{models/operationsMappers.ts → operationsInterfaces/index.ts} +2 -8
  74. package/src/operationsInterfaces/operations.ts +22 -0
  75. package/tsconfig.json +3 -3
  76. package/types/arm-healthbot.d.ts +439 -0
  77. package/types/tsdoc-metadata.json +11 -0
  78. package/dist/arm-healthbot.js +0 -1133
  79. package/dist/arm-healthbot.js.map +0 -1
  80. package/dist/arm-healthbot.min.js +0 -1
  81. package/dist/arm-healthbot.min.js.map +0 -1
  82. package/esm/healthbotClient.d.ts +0 -19
  83. package/esm/healthbotClient.d.ts.map +0 -1
  84. package/esm/healthbotClient.js +0 -33
  85. package/esm/healthbotClient.js.map +0 -1
  86. package/esm/healthbotClientContext.d.ts +0 -16
  87. package/esm/healthbotClientContext.d.ts.map +0 -1
  88. package/esm/healthbotClientContext.js +0 -55
  89. package/esm/healthbotClientContext.js.map +0 -1
  90. package/esm/models/botsMappers.d.ts +0 -2
  91. package/esm/models/botsMappers.d.ts.map +0 -1
  92. package/esm/models/botsMappers.js +0 -9
  93. package/esm/models/botsMappers.js.map +0 -1
  94. package/esm/models/index.d.ts +0 -464
  95. package/esm/models/index.d.ts.map +0 -1
  96. package/esm/models/index.js.map +0 -1
  97. package/esm/models/mappers.d.ts +0 -19
  98. package/esm/models/mappers.d.ts.map +0 -1
  99. package/esm/models/mappers.js.map +0 -1
  100. package/esm/models/operationsMappers.d.ts +0 -2
  101. package/esm/models/operationsMappers.d.ts.map +0 -1
  102. package/esm/models/operationsMappers.js.map +0 -1
  103. package/esm/models/parameters.d.ts +0 -8
  104. package/esm/models/parameters.d.ts.map +0 -1
  105. package/esm/models/parameters.js +0 -80
  106. package/esm/models/parameters.js.map +0 -1
  107. package/esm/operations/bots.d.ts +0 -162
  108. package/esm/operations/bots.d.ts.map +0 -1
  109. package/esm/operations/bots.js +0 -319
  110. package/esm/operations/bots.js.map +0 -1
  111. package/esm/operations/index.d.ts.map +0 -1
  112. package/esm/operations/index.js.map +0 -1
  113. package/esm/operations/operations.d.ts +0 -46
  114. package/esm/operations/operations.d.ts.map +0 -1
  115. package/esm/operations/operations.js +0 -79
  116. package/esm/operations/operations.js.map +0 -1
  117. package/src/healthbotClientContext.ts +0 -61
  118. package/src/models/botsMappers.ts +0 -22
@@ -0,0 +1,271 @@
1
+ ## API Report File for "@azure/arm-healthbot"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import * as coreAuth from '@azure/core-auth';
8
+ import * as coreClient from '@azure/core-client';
9
+ import { PagedAsyncIterableIterator } from '@azure/core-paging';
10
+ import { PollerLike } from '@azure/core-lro';
11
+ import { PollOperationState } from '@azure/core-lro';
12
+
13
+ // @public
14
+ export interface AvailableOperations {
15
+ nextLink?: string;
16
+ value?: OperationDetail[];
17
+ }
18
+
19
+ // @public
20
+ export interface BotResponseList {
21
+ readonly nextLink?: string;
22
+ readonly value?: HealthBot[];
23
+ }
24
+
25
+ // @public
26
+ export interface Bots {
27
+ beginCreate(resourceGroupName: string, botName: string, parameters: HealthBot, options?: BotsCreateOptionalParams): Promise<PollerLike<PollOperationState<BotsCreateResponse>, BotsCreateResponse>>;
28
+ beginCreateAndWait(resourceGroupName: string, botName: string, parameters: HealthBot, options?: BotsCreateOptionalParams): Promise<BotsCreateResponse>;
29
+ beginDelete(resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams): Promise<PollerLike<PollOperationState<void>, void>>;
30
+ beginDeleteAndWait(resourceGroupName: string, botName: string, options?: BotsDeleteOptionalParams): Promise<void>;
31
+ get(resourceGroupName: string, botName: string, options?: BotsGetOptionalParams): Promise<BotsGetResponse>;
32
+ list(options?: BotsListOptionalParams): PagedAsyncIterableIterator<HealthBot>;
33
+ listByResourceGroup(resourceGroupName: string, options?: BotsListByResourceGroupOptionalParams): PagedAsyncIterableIterator<HealthBot>;
34
+ update(resourceGroupName: string, botName: string, parameters: HealthBotUpdateParameters, options?: BotsUpdateOptionalParams): Promise<BotsUpdateResponse>;
35
+ }
36
+
37
+ // @public
38
+ export interface BotsCreateOptionalParams extends coreClient.OperationOptions {
39
+ resumeFrom?: string;
40
+ updateIntervalInMs?: number;
41
+ }
42
+
43
+ // @public
44
+ export type BotsCreateResponse = HealthBot;
45
+
46
+ // @public
47
+ export interface BotsDeleteOptionalParams extends coreClient.OperationOptions {
48
+ resumeFrom?: string;
49
+ updateIntervalInMs?: number;
50
+ }
51
+
52
+ // @public
53
+ export interface BotsGetOptionalParams extends coreClient.OperationOptions {
54
+ }
55
+
56
+ // @public
57
+ export type BotsGetResponse = HealthBot;
58
+
59
+ // @public
60
+ export interface BotsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
61
+ }
62
+
63
+ // @public
64
+ export type BotsListByResourceGroupNextResponse = BotResponseList;
65
+
66
+ // @public
67
+ export interface BotsListByResourceGroupOptionalParams extends coreClient.OperationOptions {
68
+ }
69
+
70
+ // @public
71
+ export type BotsListByResourceGroupResponse = BotResponseList;
72
+
73
+ // @public
74
+ export interface BotsListNextOptionalParams extends coreClient.OperationOptions {
75
+ }
76
+
77
+ // @public
78
+ export type BotsListNextResponse = BotResponseList;
79
+
80
+ // @public
81
+ export interface BotsListOptionalParams extends coreClient.OperationOptions {
82
+ }
83
+
84
+ // @public
85
+ export type BotsListResponse = BotResponseList;
86
+
87
+ // @public
88
+ export interface BotsUpdateOptionalParams extends coreClient.OperationOptions {
89
+ }
90
+
91
+ // @public
92
+ export type BotsUpdateResponse = HealthBot;
93
+
94
+ // @public
95
+ export interface ErrorAdditionalInfo {
96
+ readonly info?: Record<string, unknown>;
97
+ readonly type?: string;
98
+ }
99
+
100
+ // @public
101
+ export interface ErrorError {
102
+ readonly additionalInfo?: ErrorAdditionalInfo[];
103
+ readonly code?: string;
104
+ readonly details?: ErrorModel[];
105
+ readonly message?: string;
106
+ readonly target?: string;
107
+ }
108
+
109
+ // @public
110
+ export interface ErrorModel {
111
+ error?: ErrorError;
112
+ }
113
+
114
+ // @public
115
+ export type HealthBot = TrackedResource & {
116
+ sku: Sku;
117
+ identity?: Identity;
118
+ properties?: HealthBotProperties;
119
+ };
120
+
121
+ // @public (undocumented)
122
+ export class HealthbotClient extends coreClient.ServiceClient {
123
+ // (undocumented)
124
+ $host: string;
125
+ constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: HealthbotClientOptionalParams);
126
+ // (undocumented)
127
+ apiVersion: string;
128
+ // (undocumented)
129
+ bots: Bots;
130
+ // (undocumented)
131
+ operations: Operations;
132
+ // (undocumented)
133
+ subscriptionId: string;
134
+ }
135
+
136
+ // @public
137
+ export interface HealthbotClientOptionalParams extends coreClient.ServiceClientOptions {
138
+ $host?: string;
139
+ apiVersion?: string;
140
+ endpoint?: string;
141
+ }
142
+
143
+ // @public
144
+ export interface HealthBotProperties {
145
+ readonly botManagementPortalLink?: string;
146
+ readonly provisioningState?: string;
147
+ }
148
+
149
+ // @public
150
+ export interface HealthBotUpdateParameters {
151
+ identity?: Identity;
152
+ // (undocumented)
153
+ location?: string;
154
+ sku?: Sku;
155
+ tags?: {
156
+ [propertyName: string]: string;
157
+ };
158
+ }
159
+
160
+ // @public
161
+ export interface Identity {
162
+ readonly principalId?: string;
163
+ readonly tenantId?: string;
164
+ type?: ResourceIdentityType;
165
+ userAssignedIdentities?: {
166
+ [propertyName: string]: UserAssignedIdentity;
167
+ };
168
+ }
169
+
170
+ // @public
171
+ export type IdentityType = string;
172
+
173
+ // @public
174
+ export enum KnownIdentityType {
175
+ // (undocumented)
176
+ Application = "Application",
177
+ // (undocumented)
178
+ Key = "Key",
179
+ // (undocumented)
180
+ ManagedIdentity = "ManagedIdentity",
181
+ // (undocumented)
182
+ User = "User"
183
+ }
184
+
185
+ // @public
186
+ export interface OperationDetail {
187
+ display?: OperationDisplay;
188
+ isDataAction?: boolean;
189
+ name?: string;
190
+ origin?: string;
191
+ properties?: Record<string, unknown>;
192
+ }
193
+
194
+ // @public
195
+ export interface OperationDisplay {
196
+ description?: string;
197
+ operation?: string;
198
+ provider?: string;
199
+ resource?: string;
200
+ }
201
+
202
+ // @public
203
+ export interface Operations {
204
+ list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator<OperationDetail>;
205
+ }
206
+
207
+ // @public
208
+ export interface OperationsListNextOptionalParams extends coreClient.OperationOptions {
209
+ }
210
+
211
+ // @public
212
+ export type OperationsListNextResponse = AvailableOperations;
213
+
214
+ // @public
215
+ export interface OperationsListOptionalParams extends coreClient.OperationOptions {
216
+ }
217
+
218
+ // @public
219
+ export type OperationsListResponse = AvailableOperations;
220
+
221
+ // @public
222
+ export interface Resource {
223
+ readonly id?: string;
224
+ readonly name?: string;
225
+ readonly systemData?: SystemData;
226
+ readonly type?: string;
227
+ }
228
+
229
+ // @public
230
+ export type ResourceIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None";
231
+
232
+ // @public
233
+ export interface Sku {
234
+ name: SkuName;
235
+ }
236
+
237
+ // @public
238
+ export type SkuName = "F0" | "S1" | "C0";
239
+
240
+ // @public
241
+ export interface SystemData {
242
+ createdAt?: Date;
243
+ createdBy?: string;
244
+ createdByType?: IdentityType;
245
+ lastModifiedAt?: Date;
246
+ lastModifiedBy?: string;
247
+ lastModifiedByType?: IdentityType;
248
+ }
249
+
250
+ // @public
251
+ export type TrackedResource = Resource & {
252
+ tags?: {
253
+ [propertyName: string]: string;
254
+ };
255
+ location: string;
256
+ };
257
+
258
+ // @public
259
+ export interface UserAssignedIdentity {
260
+ readonly clientId?: string;
261
+ readonly principalId?: string;
262
+ }
263
+
264
+ // @public
265
+ export interface ValidationResult {
266
+ status?: string;
267
+ }
268
+
269
+ // (No @packageDocumentation comment for this package)
270
+
271
+ ```
package/rollup.config.js CHANGED
@@ -1,37 +1,188 @@
1
- import rollup from "rollup";
2
- import nodeResolve from "rollup-plugin-node-resolve";
3
- import sourcemaps from "rollup-plugin-sourcemaps";
4
-
5
- /**
6
- * @type {rollup.RollupFileOptions}
7
- */
8
- const config = {
9
- input: "./esm/healthbotClient.js",
10
- external: [
11
- "@azure/ms-rest-js",
12
- "@azure/ms-rest-azure-js"
13
- ],
14
- output: {
15
- file: "./dist/arm-healthbot.js",
16
- format: "umd",
17
- name: "Azure.ArmHealthbot",
18
- sourcemap: true,
19
- globals: {
20
- "@azure/ms-rest-js": "msRest",
21
- "@azure/ms-rest-azure-js": "msRestAzure"
22
- },
23
- banner: `/*
1
+ /*
24
2
  * Copyright (c) Microsoft Corporation.
25
3
  * Licensed under the MIT License.
26
4
  *
27
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
28
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
29
- */`
30
- },
31
- plugins: [
32
- nodeResolve({ mainFields: ['module', 'main'] }),
33
- sourcemaps()
34
- ]
7
+ */
8
+
9
+ import nodeResolve from "@rollup/plugin-node-resolve";
10
+ import cjs from "@rollup/plugin-commonjs";
11
+ import sourcemaps from "rollup-plugin-sourcemaps";
12
+ import multiEntry from "@rollup/plugin-multi-entry";
13
+ import json from "@rollup/plugin-json";
14
+
15
+ import nodeBuiltins from "builtin-modules";
16
+
17
+ /**
18
+ * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
19
+ *
20
+ * NOTE: this manual configuration is only needed because OpenTelemetry uses an
21
+ * __exportStar downleveled helper function to declare its exports which confuses
22
+ * rollup's automatic discovery mechanism.
23
+ *
24
+ * @returns an object reference that can be `...`'d into your cjs() configuration.
25
+ */
26
+ export function openTelemetryCommonJs() {
27
+ const namedExports = {};
28
+
29
+ for (const key of [
30
+ "@opentelemetry/api",
31
+ "@azure/core-tracing/node_modules/@opentelemetry/api"
32
+ ]) {
33
+ namedExports[key] = [
34
+ "SpanKind",
35
+ "TraceFlags",
36
+ "getSpan",
37
+ "setSpan",
38
+ "SpanStatusCode",
39
+ "getSpanContext",
40
+ "setSpanContext"
41
+ ];
42
+ }
43
+
44
+ const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
45
+
46
+ for (const version of releasedOpenTelemetryVersions) {
47
+ namedExports[
48
+ // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
49
+ `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
50
+ ] = [
51
+ "SpanKind",
52
+ "TraceFlags",
53
+ "getSpan",
54
+ "setSpan",
55
+ "StatusCode",
56
+ "CanonicalCode",
57
+ "getSpanContext",
58
+ "setSpanContext"
59
+ ];
60
+ }
61
+
62
+ return namedExports;
63
+ }
64
+
65
+ // #region Warning Handler
66
+
67
+ /**
68
+ * A function that can determine whether a rollupwarning should be ignored. If
69
+ * the function returns `true`, then the warning will not be displayed.
70
+ */
71
+
72
+ function ignoreNiseSinonEvalWarnings(warning) {
73
+ return (
74
+ warning.code === "EVAL" &&
75
+ warning.id &&
76
+ (warning.id.includes("node_modules/nise") ||
77
+ warning.id.includes("node_modules/sinon")) === true
78
+ );
79
+ }
80
+
81
+ function ignoreChaiCircularDependencyWarnings(warning) {
82
+ return (
83
+ warning.code === "CIRCULAR_DEPENDENCY" &&
84
+ warning.importer && warning.importer.includes("node_modules/chai") === true
85
+ );
86
+ }
87
+
88
+ const warningInhibitors = [
89
+ ignoreChaiCircularDependencyWarnings,
90
+ ignoreNiseSinonEvalWarnings
91
+ ];
92
+
93
+ /**
94
+ * Construct a warning handler for the shared rollup configuration
95
+ * that ignores certain warnings that are not relevant to testing.
96
+ */
97
+ function makeOnWarnForTesting() {
98
+ return (warning, warn) => {
99
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
100
+ if (warningInhibitors.every((inhib) => !inhib(warning))) {
101
+ warn(warning);
102
+ }
103
+ };
104
+ }
105
+
106
+ // #endregion
107
+
108
+ function makeBrowserTestConfig() {
109
+ const config = {
110
+ input: {
111
+ include: ["dist-esm/test/**/*.spec.js"],
112
+ exclude: ["dist-esm/test/**/node/**"]
113
+ },
114
+ output: {
115
+ file: `dist-test/index.browser.js`,
116
+ format: "umd",
117
+ sourcemap: true
118
+ },
119
+ preserveSymlinks: false,
120
+ plugins: [
121
+ multiEntry({ exports: false }),
122
+ nodeResolve({
123
+ mainFields: ["module", "browser"]
124
+ }),
125
+ cjs({
126
+ namedExports: {
127
+ // Chai's strange internal architecture makes it impossible to statically
128
+ // analyze its exports.
129
+ chai: [
130
+ "version",
131
+ "use",
132
+ "util",
133
+ "config",
134
+ "expect",
135
+ "should",
136
+ "assert"
137
+ ],
138
+ ...openTelemetryCommonJs()
139
+ }
140
+ }),
141
+ json(),
142
+ sourcemaps()
143
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
144
+ ],
145
+ onwarn: makeOnWarnForTesting(),
146
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
147
+ // rollup started respecting the "sideEffects" field in package.json. Since
148
+ // our package.json sets "sideEffects=false", this also applies to test
149
+ // code, which causes all tests to be removed by tree-shaking.
150
+ treeshake: false
151
+ };
152
+
153
+ return config;
154
+ }
155
+
156
+ const defaultConfigurationOptions = {
157
+ disableBrowserBundle: false
35
158
  };
36
159
 
37
- export default config;
160
+ export function makeConfig(pkg, options) {
161
+ options = {
162
+ ...defaultConfigurationOptions,
163
+ ...(options || {})
164
+ };
165
+
166
+ const baseConfig = {
167
+ // Use the package's module field if it has one
168
+ input: pkg["module"] || "dist-esm/src/index.js",
169
+ external: [
170
+ ...nodeBuiltins,
171
+ ...Object.keys(pkg.dependencies),
172
+ ...Object.keys(pkg.devDependencies)
173
+ ],
174
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
175
+ preserveSymlinks: false,
176
+ plugins: [sourcemaps(), nodeResolve(), cjs()]
177
+ };
178
+
179
+ const config = [baseConfig];
180
+
181
+ if (!options.disableBrowserBundle) {
182
+ config.push(makeBrowserTestConfig());
183
+ }
184
+
185
+ return config;
186
+ }
187
+
188
+ export default makeConfig(require("./package.json"));
@@ -3,41 +3,75 @@
3
3
  * Licensed under the MIT License.
4
4
  *
5
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is
7
- * regenerated.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
7
  */
9
8
 
10
- import * as msRest from "@azure/ms-rest-js";
11
- import * as Models from "./models";
12
- import * as Mappers from "./models/mappers";
13
- import * as operations from "./operations";
14
- import { HealthbotClientContext } from "./healthbotClientContext";
9
+ import * as coreClient from "@azure/core-client";
10
+ import * as coreAuth from "@azure/core-auth";
11
+ import { BotsImpl, OperationsImpl } from "./operations";
12
+ import { Bots, Operations } from "./operationsInterfaces";
13
+ import { HealthbotClientOptionalParams } from "./models";
15
14
 
16
-
17
- class HealthbotClient extends HealthbotClientContext {
18
- // Operation groups
19
- bots: operations.Bots;
20
- operations: operations.Operations;
15
+ export class HealthbotClient extends coreClient.ServiceClient {
16
+ $host: string;
17
+ subscriptionId: string;
18
+ apiVersion: string;
21
19
 
22
20
  /**
23
21
  * Initializes a new instance of the HealthbotClient class.
24
- * @param credentials Credentials needed for the client to connect to Azure.
22
+ * @param credentials Subscription credentials which uniquely identify client subscription.
25
23
  * @param subscriptionId Azure Subscription ID.
26
- * @param [options] The parameter options
24
+ * @param options The parameter options
27
25
  */
28
- constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.HealthbotClientOptions) {
29
- super(credentials, subscriptionId, options);
30
- this.bots = new operations.Bots(this);
31
- this.operations = new operations.Operations(this);
32
- }
33
- }
26
+ constructor(
27
+ credentials: coreAuth.TokenCredential,
28
+ subscriptionId: string,
29
+ options?: HealthbotClientOptionalParams
30
+ ) {
31
+ if (credentials === undefined) {
32
+ throw new Error("'credentials' cannot be null");
33
+ }
34
+ if (subscriptionId === undefined) {
35
+ throw new Error("'subscriptionId' cannot be null");
36
+ }
37
+
38
+ // Initializing default values for options
39
+ if (!options) {
40
+ options = {};
41
+ }
42
+ const defaults: HealthbotClientOptionalParams = {
43
+ requestContentType: "application/json; charset=utf-8",
44
+ credential: credentials
45
+ };
34
46
 
35
- // Operation Specifications
47
+ const packageDetails = `azsdk-js-arm-healthbot/2.0.0`;
48
+ const userAgentPrefix =
49
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
50
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
51
+ : `${packageDetails}`;
36
52
 
37
- export {
38
- HealthbotClient,
39
- HealthbotClientContext,
40
- Models as HealthbotModels,
41
- Mappers as HealthbotMappers
42
- };
43
- export * from "./operations";
53
+ if (!options.credentialScopes) {
54
+ options.credentialScopes = ["https://management.azure.com/.default"];
55
+ }
56
+ const optionsWithDefaults = {
57
+ ...defaults,
58
+ ...options,
59
+ userAgentOptions: {
60
+ userAgentPrefix
61
+ },
62
+ baseUri: options.endpoint || "https://management.azure.com"
63
+ };
64
+ super(optionsWithDefaults);
65
+ // Parameter assignments
66
+ this.subscriptionId = subscriptionId;
67
+
68
+ // Assigning values to Constant parameters
69
+ this.$host = options.$host || "https://management.azure.com";
70
+ this.apiVersion = options.apiVersion || "2021-06-10";
71
+ this.bots = new BotsImpl(this);
72
+ this.operations = new OperationsImpl(this);
73
+ }
74
+
75
+ bots: Bots;
76
+ operations: Operations;
77
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ /// <reference lib="esnext.asynciterable" />
10
+ export * from "./models";
11
+ export { HealthbotClient } from "./healthbotClient";
12
+ export * from "./operationsInterfaces";
package/src/lroImpl.ts ADDED
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ import { LongRunningOperation, LroResponse } from "@azure/core-lro";
10
+
11
+ export class LroImpl<T> implements LongRunningOperation<T> {
12
+ constructor(
13
+ private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,
14
+ private args: Record<string, unknown>,
15
+ private spec: {
16
+ readonly requestBody?: unknown;
17
+ readonly path?: string;
18
+ readonly httpMethod: string;
19
+ } & Record<string, any>,
20
+ public requestPath: string = spec.path!,
21
+ public requestMethod: string = spec.httpMethod
22
+ ) {}
23
+ public async sendInitialRequest(): Promise<LroResponse<T>> {
24
+ return this.sendOperationFn(this.args, this.spec);
25
+ }
26
+ public async sendPollRequest(path: string): Promise<LroResponse<T>> {
27
+ const { requestBody, ...restSpec } = this.spec;
28
+ return this.sendOperationFn(this.args, {
29
+ ...restSpec,
30
+ path,
31
+ httpMethod: "GET"
32
+ });
33
+ }
34
+ }