@autorest/powershell 4.0.0-dev.8 → 4.0.0

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 (494) hide show
  1. package/.rush/temp/package-deps_build.json +214 -206
  2. package/.rush/temp/shrinkwrap-deps.json +253 -280
  3. package/autorest-configuration-for-sdk.md +9 -3
  4. package/autorest-configuration.md +1 -1
  5. package/dist/cmdlets/class.d.ts +27 -2
  6. package/dist/cmdlets/class.d.ts.map +1 -1
  7. package/dist/cmdlets/class.js +913 -549
  8. package/dist/cmdlets/class.js.map +1 -1
  9. package/dist/cmdlets/namespace.d.ts.map +1 -1
  10. package/dist/cmdlets/namespace.js +39 -5
  11. package/dist/cmdlets/namespace.js.map +1 -1
  12. package/dist/enums/namespace.js +5 -5
  13. package/dist/enums/namespace.js.map +1 -1
  14. package/dist/exports.d.ts +3 -0
  15. package/dist/exports.d.ts.map +1 -0
  16. package/dist/exports.js +19 -0
  17. package/dist/exports.js.map +1 -0
  18. package/dist/generators/gitignore.d.ts.map +1 -1
  19. package/dist/generators/gitignore.js +2 -0
  20. package/dist/generators/gitignore.js.map +1 -1
  21. package/dist/generators/psm1.custom.js +2 -2
  22. package/dist/generators/psm1.custom.js.map +1 -1
  23. package/dist/generators/psm1.d.ts.map +1 -1
  24. package/dist/generators/psm1.internal.js +2 -2
  25. package/dist/generators/psm1.internal.js.map +1 -1
  26. package/dist/generators/psm1.js +17 -11
  27. package/dist/generators/psm1.js.map +1 -1
  28. package/dist/generators/readme.d.ts.map +1 -1
  29. package/dist/generators/readme.js +0 -3
  30. package/dist/generators/readme.js.map +1 -1
  31. package/dist/generators/script-cmdlet.js +18 -18
  32. package/dist/generators/script-cmdlet.js.map +1 -1
  33. package/dist/internal/name-inferrer.d.ts +1 -1
  34. package/dist/internal/name-inferrer.d.ts.map +1 -1
  35. package/dist/internal/name-inferrer.js +12 -12
  36. package/dist/internal/name-inferrer.js.map +1 -1
  37. package/dist/internal/powershell-declarations.d.ts +3 -0
  38. package/dist/internal/powershell-declarations.d.ts.map +1 -1
  39. package/dist/internal/powershell-declarations.js +5 -2
  40. package/dist/internal/powershell-declarations.js.map +1 -1
  41. package/dist/internal/project.d.ts +14 -8
  42. package/dist/internal/project.d.ts.map +1 -1
  43. package/dist/internal/project.js +27 -20
  44. package/dist/internal/project.js.map +1 -1
  45. package/dist/internal/state.d.ts +3 -2
  46. package/dist/internal/state.d.ts.map +1 -1
  47. package/dist/internal/state.js.map +1 -1
  48. package/dist/llcsharp/clientruntime.d.ts +1 -0
  49. package/dist/llcsharp/clientruntime.d.ts.map +1 -1
  50. package/dist/llcsharp/clientruntime.js +12 -11
  51. package/dist/llcsharp/clientruntime.js.map +1 -1
  52. package/dist/llcsharp/code-model.d.ts +7 -7
  53. package/dist/llcsharp/code-model.d.ts.map +1 -1
  54. package/dist/llcsharp/enums/enum.d.ts +1 -1
  55. package/dist/llcsharp/enums/enum.d.ts.map +1 -1
  56. package/dist/llcsharp/enums/enum.js +42 -42
  57. package/dist/llcsharp/enums/enum.js.map +1 -1
  58. package/dist/llcsharp/exports.js +5 -1
  59. package/dist/llcsharp/exports.js.map +1 -1
  60. package/dist/llcsharp/generator.d.ts +3 -2
  61. package/dist/llcsharp/generator.d.ts.map +1 -1
  62. package/dist/llcsharp/generator.js.map +1 -1
  63. package/dist/llcsharp/model/idictionary.js +16 -16
  64. package/dist/llcsharp/model/idictionary.js.map +1 -1
  65. package/dist/llcsharp/model/interface.d.ts +1 -1
  66. package/dist/llcsharp/model/interface.d.ts.map +1 -1
  67. package/dist/llcsharp/model/interface.js +25 -11
  68. package/dist/llcsharp/model/interface.js.map +1 -1
  69. package/dist/llcsharp/model/model-class-dictionary.js +18 -18
  70. package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
  71. package/dist/llcsharp/model/model-class-json.js +20 -20
  72. package/dist/llcsharp/model/model-class-json.js.map +1 -1
  73. package/dist/llcsharp/model/model-class-serializer.d.ts +1 -1
  74. package/dist/llcsharp/model/model-class-serializer.d.ts.map +1 -1
  75. package/dist/llcsharp/model/model-class-serializer.js +6 -6
  76. package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
  77. package/dist/llcsharp/model/model-class.d.ts +1 -1
  78. package/dist/llcsharp/model/model-class.d.ts.map +1 -1
  79. package/dist/llcsharp/model/model-class.js +108 -97
  80. package/dist/llcsharp/model/model-class.js.map +1 -1
  81. package/dist/llcsharp/model/namespace.d.ts +1 -1
  82. package/dist/llcsharp/model/namespace.d.ts.map +1 -1
  83. package/dist/llcsharp/model/namespace.js +4 -12
  84. package/dist/llcsharp/model/namespace.js.map +1 -1
  85. package/dist/llcsharp/model/property.d.ts +1 -1
  86. package/dist/llcsharp/model/property.d.ts.map +1 -1
  87. package/dist/llcsharp/model/property.js +20 -20
  88. package/dist/llcsharp/model/property.js.map +1 -1
  89. package/dist/llcsharp/operation/api-class.d.ts.map +1 -1
  90. package/dist/llcsharp/operation/api-class.js +26 -1
  91. package/dist/llcsharp/operation/api-class.js.map +1 -1
  92. package/dist/llcsharp/operation/method.d.ts +10 -5
  93. package/dist/llcsharp/operation/method.d.ts.map +1 -1
  94. package/dist/llcsharp/operation/method.js +287 -134
  95. package/dist/llcsharp/operation/method.js.map +1 -1
  96. package/dist/llcsharp/operation/parameter.d.ts +1 -1
  97. package/dist/llcsharp/operation/parameter.d.ts.map +1 -1
  98. package/dist/llcsharp/operation/parameter.js +10 -10
  99. package/dist/llcsharp/operation/parameter.js.map +1 -1
  100. package/dist/llcsharp/project.d.ts +10 -5
  101. package/dist/llcsharp/project.d.ts.map +1 -1
  102. package/dist/llcsharp/project.js +15 -4
  103. package/dist/llcsharp/project.js.map +1 -1
  104. package/dist/llcsharp/schema/Uuid.d.ts +1 -1
  105. package/dist/llcsharp/schema/Uuid.d.ts.map +1 -1
  106. package/dist/llcsharp/schema/Uuid.js +2 -2
  107. package/dist/llcsharp/schema/Uuid.js.map +1 -1
  108. package/dist/llcsharp/schema/array.d.ts +1 -1
  109. package/dist/llcsharp/schema/array.d.ts.map +1 -1
  110. package/dist/llcsharp/schema/array.js +45 -43
  111. package/dist/llcsharp/schema/array.js.map +1 -1
  112. package/dist/llcsharp/schema/binary.d.ts +1 -1
  113. package/dist/llcsharp/schema/binary.d.ts.map +1 -1
  114. package/dist/llcsharp/schema/binary.js +9 -9
  115. package/dist/llcsharp/schema/binary.js.map +1 -1
  116. package/dist/llcsharp/schema/boolean.d.ts +1 -1
  117. package/dist/llcsharp/schema/boolean.d.ts.map +1 -1
  118. package/dist/llcsharp/schema/byte-array.d.ts +1 -1
  119. package/dist/llcsharp/schema/byte-array.d.ts.map +1 -1
  120. package/dist/llcsharp/schema/byte-array.js +24 -24
  121. package/dist/llcsharp/schema/byte-array.js.map +1 -1
  122. package/dist/llcsharp/schema/char.d.ts +1 -1
  123. package/dist/llcsharp/schema/char.d.ts.map +1 -1
  124. package/dist/llcsharp/schema/char.js +1 -1
  125. package/dist/llcsharp/schema/char.js.map +1 -1
  126. package/dist/llcsharp/schema/date-time.d.ts +1 -1
  127. package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
  128. package/dist/llcsharp/schema/date-time.js +45 -41
  129. package/dist/llcsharp/schema/date-time.js.map +1 -1
  130. package/dist/llcsharp/schema/date.d.ts +1 -1
  131. package/dist/llcsharp/schema/date.d.ts.map +1 -1
  132. package/dist/llcsharp/schema/duration.d.ts +1 -1
  133. package/dist/llcsharp/schema/duration.d.ts.map +1 -1
  134. package/dist/llcsharp/schema/duration.js +9 -7
  135. package/dist/llcsharp/schema/duration.js.map +1 -1
  136. package/dist/llcsharp/schema/enum.d.ts +6 -2
  137. package/dist/llcsharp/schema/enum.d.ts.map +1 -1
  138. package/dist/llcsharp/schema/enum.js +13 -4
  139. package/dist/llcsharp/schema/enum.js.map +1 -1
  140. package/dist/llcsharp/schema/extended-type-declaration.d.ts +1 -1
  141. package/dist/llcsharp/schema/extended-type-declaration.d.ts.map +1 -1
  142. package/dist/llcsharp/schema/fixed-array.d.ts +1 -1
  143. package/dist/llcsharp/schema/fixed-array.d.ts.map +1 -1
  144. package/dist/llcsharp/schema/fixed-array.js +44 -42
  145. package/dist/llcsharp/schema/fixed-array.js.map +1 -1
  146. package/dist/llcsharp/schema/integer.d.ts +1 -1
  147. package/dist/llcsharp/schema/integer.d.ts.map +1 -1
  148. package/dist/llcsharp/schema/integer.js +5 -5
  149. package/dist/llcsharp/schema/integer.js.map +1 -1
  150. package/dist/llcsharp/schema/object.d.ts +1 -1
  151. package/dist/llcsharp/schema/object.d.ts.map +1 -1
  152. package/dist/llcsharp/schema/object.js +28 -28
  153. package/dist/llcsharp/schema/object.js.map +1 -1
  154. package/dist/llcsharp/schema/password.d.ts +1 -1
  155. package/dist/llcsharp/schema/password.d.ts.map +1 -1
  156. package/dist/llcsharp/schema/password.js +13 -13
  157. package/dist/llcsharp/schema/password.js.map +1 -1
  158. package/dist/llcsharp/schema/primitive.d.ts +1 -1
  159. package/dist/llcsharp/schema/primitive.d.ts.map +1 -1
  160. package/dist/llcsharp/schema/primitive.js +40 -37
  161. package/dist/llcsharp/schema/primitive.js.map +1 -1
  162. package/dist/llcsharp/schema/schema-resolver.d.ts +1 -1
  163. package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
  164. package/dist/llcsharp/schema/schema-resolver.js +5 -9
  165. package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
  166. package/dist/llcsharp/schema/string.d.ts +1 -1
  167. package/dist/llcsharp/schema/string.d.ts.map +1 -1
  168. package/dist/llcsharp/schema/string.js +48 -44
  169. package/dist/llcsharp/schema/string.js.map +1 -1
  170. package/dist/llcsharp/schema/uri.d.ts +1 -1
  171. package/dist/llcsharp/schema/uri.d.ts.map +1 -1
  172. package/dist/llcsharp/schema/uri.js +2 -2
  173. package/dist/llcsharp/schema/uri.js.map +1 -1
  174. package/dist/llcsharp/validations.js +2 -2
  175. package/dist/llcsharp/validations.js.map +1 -1
  176. package/dist/main.d.ts.map +1 -1
  177. package/dist/main.js +5 -2
  178. package/dist/main.js.map +1 -1
  179. package/dist/models/model-extensions.d.ts +1 -1
  180. package/dist/models/model-extensions.d.ts.map +1 -1
  181. package/dist/models/model-extensions.js +39 -39
  182. package/dist/models/model-extensions.js.map +1 -1
  183. package/dist/module/module-class.d.ts.map +1 -1
  184. package/dist/module/module-class.js +45 -15
  185. package/dist/module/module-class.js.map +1 -1
  186. package/dist/module/module-namespace.js +3 -3
  187. package/dist/module/module-namespace.js.map +1 -1
  188. package/dist/plugins/add-azure-completers-v2.d.ts +6 -1
  189. package/dist/plugins/add-azure-completers-v2.d.ts.map +1 -1
  190. package/dist/plugins/add-azure-completers-v2.js +5 -4
  191. package/dist/plugins/add-azure-completers-v2.js.map +1 -1
  192. package/dist/plugins/create-commands-v2.d.ts +17 -7
  193. package/dist/plugins/create-commands-v2.d.ts.map +1 -1
  194. package/dist/plugins/create-commands-v2.js +302 -66
  195. package/dist/plugins/create-commands-v2.js.map +1 -1
  196. package/dist/plugins/cs-namer-v2.d.ts +6 -1
  197. package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
  198. package/dist/plugins/cs-namer-v2.js +42 -41
  199. package/dist/plugins/cs-namer-v2.js.map +1 -1
  200. package/dist/plugins/llcsharp-v2.d.ts +5 -2
  201. package/dist/plugins/llcsharp-v2.d.ts.map +1 -1
  202. package/dist/plugins/llcsharp-v2.js +14 -9
  203. package/dist/plugins/llcsharp-v2.js.map +1 -1
  204. package/dist/plugins/modifiers-v2.d.ts +6 -1
  205. package/dist/plugins/modifiers-v2.d.ts.map +1 -1
  206. package/dist/plugins/modifiers-v2.js +135 -88
  207. package/dist/plugins/modifiers-v2.js.map +1 -1
  208. package/dist/plugins/plugin-create-inline-properties.d.ts +6 -1
  209. package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
  210. package/dist/plugins/plugin-create-inline-properties.js +44 -32
  211. package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
  212. package/dist/plugins/plugin-tweak-m4-model.d.ts +7 -1
  213. package/dist/plugins/plugin-tweak-m4-model.d.ts.map +1 -1
  214. package/dist/plugins/plugin-tweak-m4-model.js +39 -10
  215. package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
  216. package/dist/plugins/plugin-tweak-model-azure-v2.d.ts +6 -1
  217. package/dist/plugins/plugin-tweak-model-azure-v2.d.ts.map +1 -1
  218. package/dist/plugins/plugin-tweak-model-azure-v2.js +32 -22
  219. package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
  220. package/dist/plugins/plugin-tweak-model.d.ts +6 -1
  221. package/dist/plugins/plugin-tweak-model.d.ts.map +1 -1
  222. package/dist/plugins/plugin-tweak-model.js +33 -32
  223. package/dist/plugins/plugin-tweak-model.js.map +1 -1
  224. package/dist/plugins/powershell-v2.d.ts +5 -2
  225. package/dist/plugins/powershell-v2.d.ts.map +1 -1
  226. package/dist/plugins/powershell-v2.js +32 -28
  227. package/dist/plugins/powershell-v2.js.map +1 -1
  228. package/dist/plugins/ps-namer-v2.d.ts +6 -1
  229. package/dist/plugins/ps-namer-v2.d.ts.map +1 -1
  230. package/dist/plugins/ps-namer-v2.js +33 -32
  231. package/dist/plugins/ps-namer-v2.js.map +1 -1
  232. package/dist/plugins/sdk-create-inline-properties.d.ts +1 -1
  233. package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -1
  234. package/dist/plugins/sdk-create-inline-properties.js +129 -39
  235. package/dist/plugins/sdk-create-inline-properties.js.map +1 -1
  236. package/dist/plugins/sdk-cs-namer.d.ts +1 -1
  237. package/dist/plugins/sdk-cs-namer.d.ts.map +1 -1
  238. package/dist/plugins/sdk-cs-namer.js +59 -34
  239. package/dist/plugins/sdk-cs-namer.js.map +1 -1
  240. package/dist/plugins/sdk-cs-simplifier.d.ts +1 -1
  241. package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -1
  242. package/dist/plugins/sdk-cs-simplifier.js +3 -3
  243. package/dist/plugins/sdk-cs-simplifier.js.map +1 -1
  244. package/dist/plugins/sdk-generate.d.ts +1 -1
  245. package/dist/plugins/sdk-generate.d.ts.map +1 -1
  246. package/dist/plugins/sdk-generate.js +23 -18
  247. package/dist/plugins/sdk-generate.js.map +1 -1
  248. package/dist/plugins/sdk-modifiers.d.ts +4 -0
  249. package/dist/plugins/sdk-modifiers.d.ts.map +1 -0
  250. package/dist/plugins/sdk-modifiers.js +175 -0
  251. package/dist/plugins/sdk-modifiers.js.map +1 -0
  252. package/dist/plugins/sdk-tweak-model.d.ts +1 -1
  253. package/dist/plugins/sdk-tweak-model.d.ts.map +1 -1
  254. package/dist/plugins/sdk-tweak-model.js +140 -44
  255. package/dist/plugins/sdk-tweak-model.js.map +1 -1
  256. package/dist/sdk/project.d.ts +2 -2
  257. package/dist/sdk/project.d.ts.map +1 -1
  258. package/dist/sdk/project.js +10 -9
  259. package/dist/sdk/project.js.map +1 -1
  260. package/dist/sdk/state.d.ts +2 -2
  261. package/dist/sdk/state.d.ts.map +1 -1
  262. package/dist/sdk/utility.d.ts +12 -3
  263. package/dist/sdk/utility.d.ts.map +1 -1
  264. package/dist/sdk/utility.js +122 -30
  265. package/dist/sdk/utility.js.map +1 -1
  266. package/dist/utils/PwshModel.d.ts +1 -1
  267. package/dist/utils/PwshModel.d.ts.map +1 -1
  268. package/dist/utils/PwshModel.js +1 -1
  269. package/dist/utils/PwshModel.js.map +1 -1
  270. package/dist/utils/SdkModel.d.ts +1 -1
  271. package/dist/utils/SdkModel.d.ts.map +1 -1
  272. package/dist/utils/SdkModel.js +1 -1
  273. package/dist/utils/SdkModel.js.map +1 -1
  274. package/dist/utils/command-operation.d.ts +11 -3
  275. package/dist/utils/command-operation.d.ts.map +1 -1
  276. package/dist/utils/command-operation.js +26 -4
  277. package/dist/utils/command-operation.js.map +1 -1
  278. package/dist/utils/components.d.ts +1 -1
  279. package/dist/utils/components.d.ts.map +1 -1
  280. package/dist/utils/components.js +2 -2
  281. package/dist/utils/components.js.map +1 -1
  282. package/dist/utils/http-operation.d.ts +2 -0
  283. package/dist/utils/http-operation.d.ts.map +1 -1
  284. package/dist/utils/http-operation.js +16 -12
  285. package/dist/utils/http-operation.js.map +1 -1
  286. package/dist/utils/model-state.d.ts +7 -5
  287. package/dist/utils/model-state.d.ts.map +1 -1
  288. package/dist/utils/model-state.js +28 -20
  289. package/dist/utils/model-state.js.map +1 -1
  290. package/dist/utils/programatic-operation.d.ts +1 -1
  291. package/dist/utils/programatic-operation.d.ts.map +1 -1
  292. package/dist/utils/programatic-operation.js +1 -1
  293. package/dist/utils/programatic-operation.js.map +1 -1
  294. package/dist/utils/resolve-conflicts.js +8 -8
  295. package/dist/utils/resolve-conflicts.js.map +1 -1
  296. package/dist/utils/resourceName.d.ts +3 -0
  297. package/dist/utils/resourceName.d.ts.map +1 -0
  298. package/dist/utils/resourceName.js +29 -0
  299. package/dist/utils/resourceName.js.map +1 -0
  300. package/dist/utils/schema.d.ts +1 -1
  301. package/dist/utils/schema.d.ts.map +1 -1
  302. package/dist/utils/schema.js +11 -11
  303. package/dist/utils/schema.js.map +1 -1
  304. package/dist/utils/security-scheme.d.ts +2 -2
  305. package/dist/utils/security-scheme.d.ts.map +1 -1
  306. package/dist/utils/security-scheme.js +2 -2
  307. package/dist/utils/security-scheme.js.map +1 -1
  308. package/dist/utils/sort-parameters.d.ts +3 -0
  309. package/dist/utils/sort-parameters.d.ts.map +1 -0
  310. package/dist/utils/sort-parameters.js +33 -0
  311. package/dist/utils/sort-parameters.js.map +1 -0
  312. package/dist/utils/tsp-generator.d.ts +3 -0
  313. package/dist/utils/tsp-generator.d.ts.map +1 -0
  314. package/dist/utils/tsp-generator.js +65 -0
  315. package/dist/utils/tsp-generator.js.map +1 -0
  316. package/dist/utils/tsp-host.d.ts +42 -0
  317. package/dist/utils/tsp-host.d.ts.map +1 -0
  318. package/dist/utils/tsp-host.js +56 -0
  319. package/dist/utils/tsp-host.js.map +1 -0
  320. package/generators/readme.ts +0 -3
  321. package/package.json +11 -10
  322. package/resources/assets/build-module.ps1 +31 -4
  323. package/resources/assets/check-dependencies.ps1 +3 -3
  324. package/resources/assets/create-model-cmdlets.ps1 +34 -5
  325. package/resources/assets/export-surface.ps1 +3 -3
  326. package/resources/assets/generate-help.ps1 +5 -5
  327. package/resources/assets/generate-portal-ux.ps1 +9 -25
  328. package/resources/assets/run-module.ps1 +4 -4
  329. package/resources/assets/test/loadEnv.ps1 +1 -1
  330. package/resources/assets/test-module.ps1 +11 -7
  331. package/resources/assets/tools/Resources/README.md +0 -3
  332. package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
  333. package/resources/assets/tools/Resources/how-to.md +2 -0
  334. package/resources/built-time-cmdlets.csproj +1 -0
  335. package/resources/modules/Az.Accounts/2.13.1/Accounts.format.ps1xml +554 -0
  336. package/resources/modules/Az.Accounts/2.13.1/Accounts.generated.format.ps1xml +471 -0
  337. package/resources/modules/Az.Accounts/2.13.1/Accounts.types.ps1xml +306 -0
  338. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Az.Accounts.nuspec +4 -5
  339. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psd1 +389 -0
  340. package/resources/modules/Az.Accounts/2.13.1/Az.Accounts.psm1 +365 -0
  341. package/resources/modules/Az.Accounts/2.13.1/FuzzySharp.dll +0 -0
  342. package/resources/modules/Az.Accounts/2.13.1/Microsoft.ApplicationInsights.dll +0 -0
  343. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AssemblyLoading.dll +0 -0
  344. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  345. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  346. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  347. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  348. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  349. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  350. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Authorization.dll +0 -0
  351. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Compute.dll +0 -0
  352. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  353. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.KeyVault.dll +0 -0
  354. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Monitor.dll +0 -0
  355. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Network.dll +0 -0
  356. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.PolicyInsights.dll +0 -0
  357. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  358. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Storage.Management.dll +0 -0
  359. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Clients.Websites.dll +0 -0
  360. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  361. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +2510 -779
  362. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  363. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Azure.PowerShell.Common.dll +0 -0
  364. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Storage.dll +0 -0
  365. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.PowerShell.Strategies.dll +0 -0
  366. package/resources/modules/Az.Accounts/2.13.1/Microsoft.Rest.ClientRuntime.dll +0 -0
  367. package/resources/modules/Az.Accounts/2.13.1/PostImportScripts/LoadAuthenticators.ps1 +222 -0
  368. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/AzError.ps1 +281 -0
  369. package/resources/modules/Az.Accounts/2.13.1/StartupScripts/InitializeAssemblyResolver.ps1 +242 -0
  370. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/[Content_Types].xml +2 -3
  371. package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/_rels/.rels +2 -2
  372. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Azure.Core.dll +0 -0
  373. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp2.1/Microsoft.Identity.Client.dll +0 -0
  374. package/resources/modules/Az.Accounts/2.13.1/lib/netcoreapp3.1/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  375. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Azure.Core.dll +0 -0
  376. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  377. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Microsoft.Identity.Client.dll +0 -0
  378. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/Newtonsoft.Json.dll +0 -0
  379. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Diagnostics.DiagnosticSource.dll +0 -0
  380. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Reflection.DispatchProxy.dll +0 -0
  381. package/resources/modules/Az.Accounts/2.13.1/lib/netfx/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  382. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.BrokeredAuthentication.dll +0 -0
  383. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Azure.Identity.dll +0 -0
  384. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.Broker.dll +0 -0
  385. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.Identity.Client.NativeInterop.dll +0 -0
  386. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/Microsoft.IdentityModel.Abstractions.dll +0 -0
  387. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.AccessControl.dll +0 -0
  388. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Permissions.dll +0 -0
  389. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/System.Security.Principal.Windows.dll +0 -0
  390. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime.dll +0 -0
  391. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_arm64.dll +0 -0
  392. package/resources/modules/Az.Accounts/2.13.1/lib/netstandard2.0/msalruntime_x86.dll +0 -0
  393. package/resources/modules/Az.Accounts/2.13.1/package/services/metadata/core-properties/f9ac9c2e40914e78a646a7b0b997403b.psmdcp +11 -0
  394. package/resources/psruntime/Attributes/PSArgumentCompleterAttribute.cs +52 -0
  395. package/resources/psruntime/BuildTime/Cmdlets/ExportHelpMarkdown.cs +4 -1
  396. package/resources/psruntime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +6 -3
  397. package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +7 -4
  398. package/resources/psruntime/BuildTime/Cmdlets/ExportTestStub.cs +130 -81
  399. package/resources/psruntime/BuildTime/Cmdlets/NewAssemblyInfo.cs +64 -0
  400. package/resources/psruntime/BuildTime/MarkdownRenderer.cs +17 -9
  401. package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +53 -8
  402. package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +35 -11
  403. package/resources/psruntime/BuildTime/PsAttributes.cs +5 -0
  404. package/resources/psruntime/BuildTime/PsHelpers.cs +4 -3
  405. package/resources/psruntime/MessageAttribute.cs +45 -55
  406. package/resources/psruntime/MessageAttributeHelper.cs +30 -7
  407. package/resources/psruntime/Properties/Resources.Designer.cs +25 -3
  408. package/resources/psruntime/Properties/Resources.resx +8 -2
  409. package/resources/runtime/csharp/pipeline/ISendAsync.cs +113 -0
  410. package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
  411. package/resources/templates/azureMethod.ejs +2 -2
  412. package/resources/templates/azureMethodGroup.ejs +2 -2
  413. package/resources/templates/azureServiceClient.ejs +11 -4
  414. package/resources/templates/enum.ejs +3 -3
  415. package/resources/templates/extensionMethod.ejs +18 -12
  416. package/resources/templates/extensions.ejs +9 -2
  417. package/resources/templates/longRunningOperationMethod.ejs +10 -8
  418. package/resources/templates/method.ejs +10 -8
  419. package/resources/templates/methodBodyRestCall.ejs +77 -32
  420. package/resources/templates/methodGroupInterface.ejs +2 -61
  421. package/resources/templates/methodGroupInterfaceBody.ejs +60 -0
  422. package/resources/templates/model.ejs +15 -15
  423. package/resources/templates/serviceClientBody.ejs +8 -8
  424. package/resources/templates/serviceClientInterface.ejs +10 -4
  425. package/resources/utils/Get-SubscriptionIdTestSafe.ps1 +7 -0
  426. package/dist/utils/WrapComments.d.ts +0 -2
  427. package/dist/utils/WrapComments.d.ts.map +0 -1
  428. package/dist/utils/WrapComments.js +0 -46
  429. package/dist/utils/WrapComments.js.map +0 -1
  430. package/resources/modules/Az.Accounts/2.7.5/Accounts.format.ps1xml +0 -496
  431. package/resources/modules/Az.Accounts/2.7.5/Accounts.generated.format.ps1xml +0 -468
  432. package/resources/modules/Az.Accounts/2.7.5/Accounts.types.ps1xml +0 -303
  433. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +0 -387
  434. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psm1 +0 -375
  435. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Core.dll +0 -0
  436. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Azure.Identity.dll +0 -0
  437. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  438. package/resources/modules/Az.Accounts/2.7.5/AzSharedAlcAssemblies/Microsoft.Identity.Client.dll +0 -0
  439. package/resources/modules/Az.Accounts/2.7.5/Microsoft.ApplicationInsights.dll +0 -0
  440. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.Abstractions.dll +0 -0
  441. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.deps.json +0 -2309
  442. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll +0 -0
  443. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.deps.json +0 -2273
  444. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authentication.dll +0 -0
  445. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.deps.json +0 -1316
  446. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.AuthenticationAssemblyLoadContext.dll +0 -0
  447. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  448. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Aks.dll +0 -0
  449. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.Graph.Rbac.dll +0 -0
  450. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Clients.ResourceManager.dll +0 -0
  451. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.deps.json +0 -2413
  452. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll +0 -0
  453. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.Share.dll +0 -0
  454. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Common.dll +0 -0
  455. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Rest.ClientRuntime.dll +0 -0
  456. package/resources/modules/Az.Accounts/2.7.5/PostImportScripts/LoadAuthenticators.ps1 +0 -219
  457. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Core.dll +0 -0
  458. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Azure.Identity.dll +0 -0
  459. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Azure.PowerShell.Authenticators.dll +0 -0
  460. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  461. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  462. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Microsoft.Identity.Client.dll +0 -0
  463. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.12.0.3.dll +0 -0
  464. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/Newtonsoft.Json.dll +0 -0
  465. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Diagnostics.DiagnosticSource.dll +0 -0
  466. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Memory.Data.dll +0 -0
  467. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Reflection.DispatchProxy.dll +0 -0
  468. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  469. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.AccessControl.dll +0 -0
  470. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Permissions.dll +0 -0
  471. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Security.Principal.Windows.dll +0 -0
  472. package/resources/modules/Az.Accounts/2.7.5/PreloadAssemblies/System.Text.Json.dll +0 -0
  473. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/AzError.ps1 +0 -278
  474. package/resources/modules/Az.Accounts/2.7.5/StartupScripts/InitializeAssemblyResolver.ps1 +0 -234
  475. package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +0 -11
  476. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Hyak.Common.dll +0 -0
  477. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Azure.Common.dll +0 -0
  478. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.Rest.ClientRuntime.Azure.dll +0 -0
  479. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.DataMovement.dll +0 -0
  480. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/Microsoft.WindowsAzure.Storage.dll +0 -0
  481. /package/resources/modules/Az.Accounts/{2.7.5 → 2.13.1}/en-US/about_az.help.txt +0 -0
  482. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Numerics.Vectors.dll +0 -0
  483. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Security.Cryptography.Cng.dll +0 -0
  484. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Text.Encodings.Web.dll +0 -0
  485. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netfx}/System.Xml.ReaderWriter.dll +0 -0
  486. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  487. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Buffers.dll +0 -0
  488. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.Data.dll +0 -0
  489. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Memory.dll +0 -0
  490. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Net.Http.WinHttpHandler.dll +0 -0
  491. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Private.ServiceModel.dll +0 -0
  492. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.ServiceModel.Primitives.dll +0 -0
  493. /package/resources/modules/Az.Accounts/{2.7.5/AzSharedAlcAssemblies → 2.13.1/lib/netstandard2.0}/System.Text.Json.dll +0 -0
  494. /package/resources/modules/Az.Accounts/{2.7.5/PreloadAssemblies → 2.13.1/lib/netstandard2.0}/System.Threading.Tasks.Extensions.dll +0 -0
@@ -4,9 +4,9 @@
4
4
  * Licensed under the MIT License. See License.txt in the project root for license information.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ValidationMethod = exports.CallMethod = exports.OperationMethod = exports.EventListener = void 0;
7
+ exports.ValidationMethod = exports.CallMethod = exports.ResolveResponseType = exports.OperationMethod = exports.EventListener = void 0;
8
8
  const codemodel_v3_1 = require("@azure-tools/codemodel-v3");
9
- const codemodel_1 = require("@azure-tools/codemodel");
9
+ const codemodel_1 = require("@autorest/codemodel");
10
10
  const linq_1 = require("@azure-tools/linq");
11
11
  const codegen_1 = require("@azure-tools/codegen");
12
12
  const codegen_csharp_1 = require("@azure-tools/codegen-csharp");
@@ -24,6 +24,7 @@ const codegen_csharp_11 = require("@azure-tools/codegen-csharp");
24
24
  const codegen_csharp_12 = require("@azure-tools/codegen-csharp");
25
25
  const clientruntime_1 = require("../clientruntime");
26
26
  const parameter_1 = require("../operation/parameter");
27
+ const schema_1 = require("../../utils/schema");
27
28
  const codemodel_v3_2 = require("@azure-tools/codemodel-v3");
28
29
  const codegen_csharp_13 = require("@azure-tools/codegen-csharp");
29
30
  const codegen_csharp_14 = require("@azure-tools/codegen-csharp");
@@ -32,26 +33,27 @@ function removeEncoding(pp, paramName, kmt) {
32
33
  return pp.param.extensions && pp.param.extensions['x-ms-skip-url-encoding'] ? up.replace(/global::System.Uri.EscapeDataString|System.Uri.EscapeDataString/g, '') : up;
33
34
  }
34
35
  class EventListener {
35
- constructor(expression, emitSignals) {
36
+ constructor(expression, emitSignals, withResult) {
36
37
  this.expression = expression;
37
38
  this.emitSignals = emitSignals;
39
+ this.withResult = withResult;
38
40
  }
39
41
  *signalNoCheck(eventName, ...additionalParameters) {
40
42
  if (this.emitSignals) {
41
- const params = linq_1.length(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
43
+ const params = (0, linq_1.length)(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
42
44
  yield `await ${this.expression.value}.Signal(${eventName}${params});`;
43
45
  }
44
46
  }
45
47
  *syncSignalNoCheck(eventName, ...additionalParameters) {
46
48
  if (this.emitSignals) {
47
- const params = linq_1.length(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
49
+ const params = (0, linq_1.length)(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
48
50
  yield `${this.expression.value}.Signal(${eventName}${params}).Wait();`;
49
51
  }
50
52
  }
51
53
  *signal(eventName, ...additionalParameters) {
52
54
  if (this.emitSignals) {
53
- const params = linq_1.length(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
54
- yield `await ${this.expression.value}.Signal(${eventName}${params}); if( ${this.expression.value}.Token.IsCancellationRequested ) { return; }`;
55
+ const params = (0, linq_1.length)(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
56
+ yield `await ${this.expression.value}.Signal(${eventName}${params}); if( ${this.expression.value}.Token.IsCancellationRequested ) { return${this.withResult ? ' null' : ''}; }`;
55
57
  }
56
58
  else {
57
59
  yield `if( ${this.expression.value}.CancellationToken.IsCancellationRequested ) { throw ${codegen_csharp_13.System.OperationCanceledException.new()}; }`;
@@ -59,8 +61,8 @@ class EventListener {
59
61
  }
60
62
  *syncSignal(eventName, ...additionalParameters) {
61
63
  if (this.emitSignals) {
62
- const params = linq_1.length(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
63
- yield `${this.expression.value}.Signal(${eventName}${params}).Wait(); if( ${this.expression.value}.Token.IsCancellationRequested ) { return; }`;
64
+ const params = (0, linq_1.length)(additionalParameters) > 0 ? `, ${additionalParameters.joinWith(each => typeof each === 'string' ? each : each.value)}` : '';
65
+ yield `${this.expression.value}.Signal(${eventName}${params}).Wait(); if( ${this.expression.value}.Token.IsCancellationRequested ) { return${this.withResult ? ' null' : ''}; }`;
64
66
  }
65
67
  else {
66
68
  yield `if( ${this.expression.value}.CancellationToken.IsCancellationRequested ) { throw ${codegen_csharp_13.System.OperationCanceledException.new()} }`;
@@ -69,20 +71,25 @@ class EventListener {
69
71
  }
70
72
  exports.EventListener = EventListener;
71
73
  class OperationMethod extends codegen_csharp_3.Method {
72
- constructor(parent, operation, viaIdentity, state, objectInitializer) {
73
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
74
- super(viaIdentity ? `${(_a = operation.language.csharp) === null || _a === void 0 ? void 0 : _a.name}ViaIdentity` : ((_b = operation.language.csharp) === null || _b === void 0 ? void 0 : _b.name) || '', codegen_csharp_13.System.Threading.Tasks.Task());
74
+ constructor(parent, operation, viaIdentity, state, viaJson = false, withResult, objectInitializer) {
75
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
76
+ super(viaJson
77
+ ? `${(_a = operation.language.csharp) === null || _a === void 0 ? void 0 : _a.name}ViaJsonString${withResult ? 'WithResult' : ''}`
78
+ : viaIdentity
79
+ ? `${(_b = operation.language.csharp) === null || _b === void 0 ? void 0 : _b.name}ViaIdentity${withResult ? 'WithResult' : ''}`
80
+ : `${(_c = operation.language.csharp) === null || _c === void 0 ? void 0 : _c.name}${withResult ? 'WithResult' : ''}` || '', withResult ? codegen_csharp_13.System.Threading.Tasks.Task(ResolveResponseType(undefined, operation, state)) : codegen_csharp_13.System.Threading.Tasks.Task());
75
81
  this.parent = parent;
76
82
  this.operation = operation;
77
83
  this.viaIdentity = viaIdentity;
78
84
  this.state = state;
85
+ this.viaJson = viaJson;
79
86
  this.callbacks = new Array();
80
87
  this.apply(objectInitializer);
81
88
  this.async = codegen_csharp_1.Modifier.Async;
82
- this.returnsDescription = `A <see cref="${codegen_csharp_13.System.Threading.Tasks.Task()}" /> that will be complete when handling of the response is completed.`;
89
+ this.returnsDescription = `A <see cref="${withResult ? codegen_csharp_13.System.Threading.Tasks.Task(ResolveResponseType(undefined, operation, state)) : codegen_csharp_13.System.Threading.Tasks.Task()}" /> that will be complete when handling of the response is completed.`;
83
90
  const $this = this;
84
- this.callName = `${(_c = operation.language.csharp) === null || _c === void 0 ? void 0 : _c.name}_Call`;
85
- this.push(codegen_csharp_11.Using('NoSynchronizationContext', ''));
91
+ this.callName = `${(_d = operation.language.csharp) === null || _d === void 0 ? void 0 : _d.name}${withResult ? 'WithResult' : ''}_Call`;
92
+ this.push((0, codegen_csharp_11.Using)('NoSynchronizationContext', ''));
86
93
  // add parameters
87
94
  this.methodParameters = [];
88
95
  const identity = new codegen_csharp_4.Parameter('viaIdentity', codegen_csharp_13.System.String);
@@ -90,20 +97,37 @@ class OperationMethod extends codegen_csharp_3.Method {
90
97
  this.addParameter(identity);
91
98
  }
92
99
  let baseUrl = '';
93
- for (let index = 0; index < linq_1.length(this.operation.parameters) && this.operation.parameters; index++) {
100
+ const paths = [];
101
+ const headers = [];
102
+ const queries = [];
103
+ const others = [];
104
+ for (let index = 0; index < (0, linq_1.length)(this.operation.parameters) && this.operation.parameters; index++) {
94
105
  const value = this.operation.parameters[index];
95
106
  if (value.language.default.name === '$host') {
96
107
  baseUrl = value.clientDefaultValue;
97
108
  continue;
98
109
  }
99
110
  const p = new parameter_1.OperationParameter(this, value, this.state.path('parameters', index));
100
- if ((_d = value.language.csharp) === null || _d === void 0 ? void 0 : _d.constantValue) {
111
+ if ((_e = value.language.csharp) === null || _e === void 0 ? void 0 : _e.constantValue) {
101
112
  const constTd = state.project.modelsNamespace.NewResolveTypeDeclaration(value.schema, true, state);
102
- p.defaultInitializer = constTd.deserializeFromString(codemodel_v3_2.KnownMediaType.UriParameter, new codegen_csharp_2.StringExpression(`${value.language.csharp.constantValue}`), codegen_csharp_2.toExpression(constTd.defaultOfType));
113
+ p.defaultInitializer = constTd.deserializeFromString(codemodel_v3_2.KnownMediaType.UriParameter, new codegen_csharp_2.StringExpression(`${value.language.csharp.constantValue}`), (0, codegen_csharp_2.toExpression)(constTd.defaultOfType));
103
114
  }
104
115
  // don't add path parameters when we're in identity mode
105
- if (!this.viaIdentity || ((_e = value.protocol.http) === null || _e === void 0 ? void 0 : _e.in) !== codemodel_v3_1.ParameterLocation.Path) {
106
- this.addParameter(p);
116
+ if (!this.viaIdentity || ((_f = value.protocol.http) === null || _f === void 0 ? void 0 : _f.in) !== codemodel_v3_1.ParameterLocation.Path) {
117
+ switch ((_g = value.protocol.http) === null || _g === void 0 ? void 0 : _g.in) {
118
+ case codemodel_v3_1.ParameterLocation.Path:
119
+ paths.push(p);
120
+ break;
121
+ case codemodel_v3_1.ParameterLocation.Header:
122
+ headers.push(p);
123
+ break;
124
+ case codemodel_v3_1.ParameterLocation.Query:
125
+ queries.push(p);
126
+ break;
127
+ default:
128
+ others.push(p);
129
+ break;
130
+ }
107
131
  }
108
132
  else {
109
133
  this.add(function* () {
@@ -112,43 +136,55 @@ class OperationMethod extends codegen_csharp_3.Method {
112
136
  }
113
137
  this.methodParameters.push(p);
114
138
  }
139
+ [...paths, ...headers, ...queries, ...others].forEach(p => this.addParameter(p));
115
140
  if (baseUrl === '') {
116
141
  // Some services will make the host as an input parameter
117
- baseUrl = this.operation.requests ? (_f = this.operation.requests[0].protocol.http) === null || _f === void 0 ? void 0 : _f.uri : '';
142
+ baseUrl = this.operation.requests ? (_h = this.operation.requests[0].protocol.http) === null || _h === void 0 ? void 0 : _h.uri : '';
118
143
  }
119
- this.description = ((_g = this.operation.language.csharp) === null || _g === void 0 ? void 0 : _g.description) || '';
144
+ this.description = ((_j = this.operation.language.csharp) === null || _j === void 0 ? void 0 : _j.description) || '';
120
145
  // add body paramter if there should be one.
121
146
  if (this.operation.requests && this.operation.requests.length && this.operation.requests[0].parameters && this.operation.requests[0].parameters.length) {
122
147
  // this request does have a request body.
123
148
  const param = this.operation.requests[0].parameters.find((p) => !p.origin || p.origin.indexOf('modelerfour:synthesized') < 0);
124
149
  if (param) {
125
- this.bodyParameter = new parameter_1.OperationBodyParameter(this, 'body', param.language.default.description, param.schema, (_h = param.required) !== null && _h !== void 0 ? _h : false, this.state, {
126
- // TODO: temp solution. We need a class like NewKnowMediaType
127
- mediaType: codemodel_v3_2.knownMediaType(codemodel_v3_2.KnownMediaType.Json),
128
- contentType: codemodel_v3_2.KnownMediaType.Json
129
- });
130
- this.addParameter(this.bodyParameter);
150
+ if (!viaJson) {
151
+ this.bodyParameter = new parameter_1.OperationBodyParameter(this, 'body', param.language.default.description, param.schema, (_k = param.required) !== null && _k !== void 0 ? _k : false, this.state, {
152
+ // TODO: temp solution. We need a class like NewKnowMediaType
153
+ mediaType: (0, codemodel_v3_2.knownMediaType)(codemodel_v3_2.KnownMediaType.Json),
154
+ contentType: codemodel_v3_2.KnownMediaType.Json
155
+ });
156
+ this.addParameter(this.bodyParameter);
157
+ }
158
+ else {
159
+ this.addParameter(new codegen_csharp_4.Parameter('jsonString', codegen_csharp_13.System.String, {
160
+ description: `Json string supplied to the ${(_l = operation.language.csharp) === null || _l === void 0 ? void 0 : _l.name} operation`,
161
+ }));
162
+ }
131
163
  }
132
164
  }
133
- for (const response of [...linq_1.values(this.operation.responses), ...linq_1.values(this.operation.exceptions)]) {
165
+ for (const response of [...(0, linq_1.values)(this.operation.responses), ...(0, linq_1.values)(this.operation.exceptions)]) {
134
166
  const responseType = response.binary ? new binary_1.Binary(new codemodel_1.BinarySchema(''), true) : (response.schema ? state.project.modelsNamespace.NewResolveTypeDeclaration((response.schema), true, state) : null);
135
167
  const headerType = response.language.default.headerSchema ? state.project.modelsNamespace.NewResolveTypeDeclaration(response.language.default.headerSchema, true, state) : null;
136
- const newCallbackParameter = new parameter_1.CallbackParameter(((_j = response.language.csharp) === null || _j === void 0 ? void 0 : _j.name) || '', responseType, headerType, this.state, { description: (_k = response.language.csharp) === null || _k === void 0 ? void 0 : _k.description });
137
- this.addParameter(newCallbackParameter);
168
+ const newCallbackParameter = new parameter_1.CallbackParameter(((_m = response.language.csharp) === null || _m === void 0 ? void 0 : _m.name) || '', responseType, headerType, this.state, { description: (_o = response.language.csharp) === null || _o === void 0 ? void 0 : _o.description });
169
+ if (!withResult) {
170
+ this.addParameter(newCallbackParameter);
171
+ }
138
172
  this.callbacks.push(newCallbackParameter);
139
173
  }
140
174
  // add eventhandler parameter
141
175
  this.contextParameter = this.addParameter(new codegen_csharp_4.Parameter('eventListener', clientruntime_1.ClientRuntime.IEventListener, { description: `an <see cref="${clientruntime_1.ClientRuntime.IEventListener}" /> instance that will receive events.` }));
142
176
  // add optional parameter for sender
143
177
  this.senderParameter = this.addParameter(new codegen_csharp_4.Parameter('sender', clientruntime_1.ClientRuntime.ISendAsync, { description: `an instance of an ${clientruntime_1.ClientRuntime.ISendAsync} pipeline to use to make the request.` }));
144
- let rx = this.operation.requests ? (_l = this.operation.requests[0].protocol.http) === null || _l === void 0 ? void 0 : _l.path : '';
178
+ let rx = this.operation.requests ? (_p = this.operation.requests[0].protocol.http) === null || _p === void 0 ? void 0 : _p.path : '';
145
179
  const path = rx;
180
+ let pathWithoutOperation = path;
146
181
  // For post API, Some URI may contain an action string .e.x '/start' at the end
147
182
  // of the URI, for such cases, we will drop the action string if identityCorrection
148
183
  // is set in the configuration
149
- if (this.operation.requests && this.operation.requests.length && ((_m = this.operation.requests[0].protocol.http) === null || _m === void 0 ? void 0 : _m.method) === 'post' && this.state.project.identityCorrection) {
184
+ if (this.operation.requests && this.operation.requests.length && ((_q = this.operation.requests[0].protocol.http) === null || _q === void 0 ? void 0 : _q.method) === 'post' && this.state.project.identityCorrection) {
150
185
  const idx = rx.lastIndexOf('/');
151
186
  rx = rx.substr(0, idx);
187
+ pathWithoutOperation = rx;
152
188
  }
153
189
  let url = `/${path.startsWith('/') ? path.substr(1) : path}`;
154
190
  const serverParams = this.methodParameters.filter(each => { var _a; return ((_a = each.param.protocol.http) === null || _a === void 0 ? void 0 : _a.in) === codemodel_v3_1.ParameterLocation.Uri; });
@@ -189,14 +225,14 @@ class OperationMethod extends codegen_csharp_3.Method {
189
225
  // add method implementation...
190
226
  this.add(function* () {
191
227
  var _a;
192
- const eventListener = new EventListener($this.contextParameter, $this.state.project.emitSignals);
228
+ const eventListener = new EventListener($this.contextParameter, $this.state.project.emitSignals, withResult);
193
229
  yield codegen_1.EOL;
194
230
  if ($this.viaIdentity) {
195
231
  yield '// verify that Identity format is an exact match for uri';
196
232
  yield codegen_1.EOL;
197
- const match = codegen_csharp_12.Local('_match', `${codegen_csharp_13.System.Text.RegularExpressions.Regex.new(rx, 'global::System.Text.RegularExpressions.RegexOptions.IgnoreCase').value}.Match(${identity.value})`);
233
+ const match = (0, codegen_csharp_12.Local)('_match', `${codegen_csharp_13.System.Text.RegularExpressions.Regex.new(rx, 'global::System.Text.RegularExpressions.RegexOptions.IgnoreCase').value}.Match(${identity.value})`);
198
234
  yield match.declarationStatement;
199
- yield codegen_csharp_7.If(`!${match}.Success`, `throw new global::System.Exception("Invalid identity for URI '${path}'");`);
235
+ yield (0, codegen_csharp_7.If)(`!${match}.Success`, `throw new global::System.Exception("Invalid identity for URI '${pathWithoutOperation}'");`);
200
236
  yield codegen_1.EOL;
201
237
  yield '// replace URI parameters with values from identity';
202
238
  for (const pp of pathParams) {
@@ -204,7 +240,7 @@ class OperationMethod extends codegen_csharp_3.Method {
204
240
  }
205
241
  }
206
242
  yield '// construct URL';
207
- const pathAndQueryV = codegen_csharp_12.Local('pathAndQuery', `${codegen_csharp_13.System.Text.RegularExpressions.Regex.declaration}.Replace(
243
+ const pathAndQueryV = (0, codegen_csharp_12.Local)('pathAndQuery', `${codegen_csharp_13.System.Text.RegularExpressions.Regex.declaration}.Replace(
208
244
  "${url}"
209
245
  ${queryParams.length > 0 ? '+ "?"' : ''}${queryParams.joinWith(pp => `
210
246
  + ${removeEncoding(pp, pp.param.language.default.serializedName, codemodel_v3_2.KnownMediaType.QueryParameter)}`, `
@@ -223,7 +259,7 @@ class OperationMethod extends codegen_csharp_3.Method {
223
259
  yield `var request = ${codegen_csharp_13.System.Net.Http.HttpRequestMessage.new(`${clientruntime_1.ClientRuntime.fullName}.Method.${method.capitalize()}, ${urlV.value}`)};`;
224
260
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.RequestCreated, 'request.RequestUri.PathAndQuery');
225
261
  yield codegen_1.EOL;
226
- if (linq_1.length(headerParams) > 0) {
262
+ if ((0, linq_1.length)(headerParams) > 0) {
227
263
  yield '// add headers parameters';
228
264
  for (const hp of headerParams) {
229
265
  if (hp.param.language.default.name === 'Content-Length') {
@@ -241,18 +277,24 @@ class OperationMethod extends codegen_csharp_3.Method {
241
277
  yield `request.Content.Headers.ContentType = ${codegen_csharp_13.System.Net.Http.Headers.MediaTypeHeaderValue.Parse(bp.contentType)};`;
242
278
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.BodyContentSet);
243
279
  }
280
+ if (viaJson) {
281
+ yield '// set body content';
282
+ yield 'request.Content = new global::System.Net.Http.StringContent(jsonString, global::System.Text.Encoding.UTF8);';
283
+ yield 'request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");';
284
+ yield eventListener.signal(clientruntime_1.ClientRuntime.Events.BodyContentSet);
285
+ }
244
286
  yield '// make the call ';
245
287
  });
246
288
  }
247
- emitCall(returnFromCall) {
289
+ emitCall(returnFromCall, withResult) {
248
290
  // storage will return from the call for download, etc.
249
291
  if (returnFromCall) {
250
292
  this.returnType = codegen_csharp_13.System.Threading.Tasks.Task(codegen_csharp_13.System.Net.Http.HttpResponseMessage);
251
293
  }
252
- this.add(`await this.${this.callName}(request,${this.callbacks.joinWith(each => each.use, ',')},${this.contextParameter.use},${this.senderParameter.use});`);
294
+ this.add(`${withResult ? 'return ' : ''}await this.${this.callName} (request, ${withResult ? '' : `${this.callbacks.joinWith(each => each.use, ',')},`}${this.contextParameter.use},${this.senderParameter.use}); `);
253
295
  // remove constant parameters and make them locals instead.
254
296
  this.insert('// Constant Parameters');
255
- for (let i = linq_1.length(this.parameters); i--; i < 0) {
297
+ for (let i = (0, linq_1.length)(this.parameters); i--; i < 0) {
256
298
  const p = this.parameters[i];
257
299
  if (p && p.defaultInitializer && p.name !== 'serializationMode') {
258
300
  this.parameters.splice(i, 1);
@@ -262,77 +304,118 @@ class OperationMethod extends codegen_csharp_3.Method {
262
304
  }
263
305
  }
264
306
  exports.OperationMethod = OperationMethod;
307
+ function ResolveResponseType(opMethod, operation, state) {
308
+ let typeCount = 0;
309
+ let responseType = undefined;
310
+ if (opMethod) {
311
+ opMethod.callbacks.filter(each => each.name !== 'onDefault').forEach(each => {
312
+ if (each.responseType && responseType && each.responseType !== responseType) {
313
+ typeCount++;
314
+ }
315
+ else if (each.responseType && !responseType) {
316
+ responseType = each.responseType;
317
+ typeCount = 1;
318
+ }
319
+ });
320
+ }
321
+ else if (operation && state) {
322
+ for (const response of [...(0, linq_1.values)(operation.responses), ...(0, linq_1.values)(operation.exceptions)].filter(each => { var _a, _b; return ((_b = (_a = each.language) === null || _a === void 0 ? void 0 : _a.csharp) === null || _b === void 0 ? void 0 : _b.name) !== 'onDefault'; })) {
323
+ const eachResponseType = response.binary ? new binary_1.Binary(new codemodel_1.BinarySchema(''), true) : (response.schema ? state.project.modelsNamespace.NewResolveTypeDeclaration((response.schema), true, state) : undefined);
324
+ if (eachResponseType && responseType && eachResponseType !== responseType) {
325
+ typeCount++;
326
+ }
327
+ else if (eachResponseType && !responseType) {
328
+ responseType = eachResponseType;
329
+ typeCount = 1;
330
+ }
331
+ }
332
+ }
333
+ return typeCount === 1 ? responseType : undefined;
334
+ }
335
+ exports.ResolveResponseType = ResolveResponseType;
265
336
  class CallMethod extends codegen_csharp_3.Method {
266
- constructor(parent, opMethod, state, objectInitializer) {
267
- super(`${opMethod.name}_Call`, codegen_csharp_13.System.Threading.Tasks.Task());
337
+ constructor(parent, opMethod, state, objectInitializer, withResult) {
338
+ super(`${opMethod.name}_Call`, withResult && ResolveResponseType(opMethod) ? codegen_csharp_13.System.Threading.Tasks.Task(ResolveResponseType(opMethod)) : codegen_csharp_13.System.Threading.Tasks.Task());
268
339
  this.parent = parent;
269
340
  this.opMethod = opMethod;
270
341
  this.state = state;
271
342
  this.returnNull = false;
272
- this.description = `Actual wire call for <see cref="${opMethod.name}" /> method.`;
343
+ this.description = `Actual wire call for <see cref= "${opMethod.name}" /> method.`;
273
344
  this.returnsDescription = opMethod.returnsDescription;
274
345
  this.apply(objectInitializer);
275
346
  this.access = codegen_csharp_1.Access.Internal;
276
347
  this.async = codegen_csharp_1.Modifier.Async;
277
- this.push(codegen_csharp_11.Using('NoSynchronizationContext', ''));
348
+ this.push((0, codegen_csharp_11.Using)('NoSynchronizationContext', ''));
278
349
  const $this = this;
279
350
  // add parameters
280
351
  // request, listener, sender
281
352
  const reqParameter = this.addParameter(new codegen_csharp_4.Parameter('request', codegen_csharp_13.System.Net.Http.HttpRequestMessage, { description: 'the prepared HttpRequestMessage to send.' }));
282
- opMethod.callbacks.forEach(each => this.addParameter(each));
353
+ if (!withResult) {
354
+ opMethod.callbacks.forEach(each => this.addParameter(each));
355
+ }
283
356
  this.addParameter(opMethod.contextParameter);
284
357
  this.addParameter(opMethod.senderParameter);
285
358
  // add statements to this method
286
359
  this.add(function* () {
287
- const eventListener = new EventListener(opMethod.contextParameter, $this.state.project.emitSignals);
288
- const response = codegen_csharp_12.Local('_response', codegen_csharp_13.dotnet.Null, codegen_csharp_13.System.Net.Http.HttpResponseMessage);
360
+ const eventListener = new EventListener(opMethod.contextParameter, $this.state.project.emitSignals, withResult);
361
+ const response = (0, codegen_csharp_12.Local)('_response', codegen_csharp_13.dotnet.Null, codegen_csharp_13.System.Net.Http.HttpResponseMessage);
289
362
  yield response;
290
- yield codegen_csharp_10.Try(function* () {
363
+ yield (0, codegen_csharp_10.Try)(function* () {
291
364
  var _a, _b, _c, _d, _e;
292
365
  const responder = function* () {
293
366
  // TODO: omit generating _contentType var if it will never be used
294
367
  // const contentType = new LocalVariable('_contentType', dotnet.Var, { initializer: `_response.Content.Headers.ContentType?.MediaType` });
295
- const contentType = codegen_csharp_12.Local('_contentType', `${response}.Content.Headers.ContentType?.MediaType`);
368
+ const contentType = (0, codegen_csharp_12.Local)('_contentType', `${response}.Content.Headers.ContentType?.MediaType`);
296
369
  yield contentType;
297
370
  // add response handlers
298
- yield codegen_csharp_9.Switch(`${response}.StatusCode`, function* () {
299
- var _a, _b;
300
- const responses = [...linq_1.values(opMethod.operation.responses), ...linq_1.values(opMethod.operation.exceptions)].sort(function (a, b) { var _a, _b; return ((_a = a.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0]).localeCompare(((_b = b.protocol.http) === null || _b === void 0 ? void 0 : _b.statusCodes[0])); });
371
+ yield (0, codegen_csharp_9.Switch)(`${response}.StatusCode`, function* () {
372
+ var _a;
373
+ const responses = [...(0, linq_1.values)(opMethod.operation.responses), ...(0, linq_1.values)(opMethod.operation.exceptions)].sort(function (a, b) { var _a, _b; return ((_a = a.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0]).localeCompare(((_b = b.protocol.http) === null || _b === void 0 ? void 0 : _b.statusCodes[0])); });
301
374
  for (const resp of responses) {
302
- if (((_a = resp.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0]) !== 'default') {
303
- const responseCode = (_b = resp.protocol.http) === null || _b === void 0 ? void 0 : _b.statusCodes[0];
375
+ const responseCode = (_a = resp.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0];
376
+ if (responseCode !== 'default' /*TODO: !== not found, handle other exception response */) {
304
377
  const leadNum = parseInt(responseCode[0]);
305
378
  // will use enum when it can, fall back to casting int when it can't
306
- yield codegen_csharp_5.Case(codegen_csharp_13.System.Net.HttpStatusCode[responseCode] ? codegen_csharp_13.System.Net.HttpStatusCode[responseCode].value : `${codegen_csharp_13.System.Net.HttpStatusCode.declaration} n when((int)n >= ${leadNum * 100} && (int)n < ${leadNum * 100 + 100})`, $this.responsesEmitter($this, opMethod, [resp], eventListener));
379
+ if (withResult) {
380
+ yield (0, codegen_csharp_5.TerminalCase)(codegen_csharp_13.System.Net.HttpStatusCode[responseCode] ? codegen_csharp_13.System.Net.HttpStatusCode[responseCode].value : `${codegen_csharp_13.System.Net.HttpStatusCode.declaration} n when((int)n >= ${leadNum * 100} && (int)n < ${leadNum * 100 + 100})`, $this.responsesEmitter($this, opMethod, [resp], response, eventListener, withResult));
381
+ }
382
+ else {
383
+ yield (0, codegen_csharp_5.Case)(codegen_csharp_13.System.Net.HttpStatusCode[responseCode] ? codegen_csharp_13.System.Net.HttpStatusCode[responseCode].value : `${codegen_csharp_13.System.Net.HttpStatusCode.declaration} n when((int)n >= ${leadNum * 100} && (int)n < ${leadNum * 100 + 100})`, $this.responsesEmitter($this, opMethod, [resp], response, eventListener, false));
384
+ }
307
385
  }
308
386
  else {
309
- yield codegen_csharp_5.DefaultCase($this.responsesEmitter($this, opMethod, [resp], eventListener));
387
+ if (withResult) {
388
+ yield (0, codegen_csharp_5.TerminalDefaultCase)($this.responsesEmitter($this, opMethod, [resp], response, eventListener, withResult));
389
+ }
390
+ else {
391
+ yield (0, codegen_csharp_5.DefaultCase)($this.responsesEmitter($this, opMethod, [resp], response, eventListener, false));
392
+ }
310
393
  }
311
394
  }
312
395
  // missing default response?
313
396
  if (!opMethod.operation.exceptions) {
314
397
  // if no default, we need one that handles the rest of the stuff.
315
- yield codegen_csharp_5.TerminalDefaultCase(function* () {
398
+ yield (0, codegen_csharp_5.TerminalDefaultCase)(function* () {
316
399
  yield `throw new ${clientruntime_1.ClientRuntime.fullName}.UndeclaredResponseException(_response);`;
317
400
  });
318
401
  }
319
402
  });
320
403
  };
321
404
  // try statements
322
- const sendTask = codegen_csharp_12.Local('sendTask', new codegen_csharp_2.LiteralExpression(`${opMethod.senderParameter.value}.SendAsync(${reqParameter.use}, ${opMethod.contextParameter.value})`));
405
+ const sendTask = (0, codegen_csharp_12.Local)('sendTask', new codegen_csharp_2.LiteralExpression(`${opMethod.senderParameter.value}.SendAsync(${reqParameter.use}, ${opMethod.contextParameter.value})`));
323
406
  yield sendTask;
324
407
  // delay sending BeforeCall event until URI has been replaced by HTTP pipeline
325
408
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.BeforeCall, reqParameter.use);
326
409
  if ((_a = $this.opMethod.operation.language.csharp) === null || _a === void 0 ? void 0 : _a.lro) {
327
410
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.Progress, new codegen_csharp_2.LiteralExpression('"intentional placeholder"'), new codegen_csharp_2.LiteralExpression('0'));
328
411
  }
329
- yield `${response.value} = await ${sendTask.value};`;
412
+ yield `${response.value} = await ${sendTask.value}; `;
330
413
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.ResponseCreated, response.value);
331
414
  const EOL = 'EOL';
332
415
  // LRO processing (if appropriate)
333
416
  if ((_b = $this.opMethod.operation.language.csharp) === null || _b === void 0 ? void 0 : _b.lro) {
334
417
  yield '// this operation supports x-ms-long-running-operation';
335
- const originalUri = codegen_csharp_12.Local('_originalUri', new codegen_csharp_2.LiteralExpression(`${reqParameter.use}.RequestUri.AbsoluteUri`));
418
+ const originalUri = (0, codegen_csharp_12.Local)('_originalUri', new codegen_csharp_2.LiteralExpression(`${reqParameter.use}.RequestUri.AbsoluteUri`));
336
419
  yield originalUri;
337
420
  yield `// declared final-state-via: ${$this.opMethod.operation.language.csharp.lro['final-state-via']}`;
338
421
  const fsv = $this.opMethod.operation.language.csharp.lro['final-state-via'];
@@ -344,7 +427,12 @@ class CallMethod extends codegen_csharp_3.Method {
344
427
  break;
345
428
  case 'location':
346
429
  // perform a final GET on the uri in Location header
347
- finalUri = codegen_csharp_12.Local('_finalUri', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Location')));
430
+ finalUri = (0, codegen_csharp_12.Local)('_finalUri', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Location')));
431
+ yield finalUri;
432
+ break;
433
+ case 'operation-location':
434
+ // perform a final GET on the uri in Operation-Location header
435
+ finalUri = (0, codegen_csharp_12.Local)('_finalUri', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Operation-Location')));
348
436
  yield finalUri;
349
437
  break;
350
438
  case 'azure-asyncoperation':
@@ -353,7 +441,7 @@ class CallMethod extends codegen_csharp_3.Method {
353
441
  switch ((_d = (_c = $this.opMethod.operation.requests) === null || _c === void 0 ? void 0 : _c[0].protocol.http) === null || _d === void 0 ? void 0 : _d.method.toLowerCase()) {
354
442
  case 'post':
355
443
  case 'delete':
356
- finalUri = codegen_csharp_12.Local('_finalUri', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Azure-AsyncOperation')));
444
+ finalUri = (0, codegen_csharp_12.Local)('_finalUri', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Azure-AsyncOperation')));
357
445
  yield finalUri;
358
446
  break;
359
447
  case 'patch':
@@ -369,7 +457,7 @@ class CallMethod extends codegen_csharp_3.Method {
369
457
  switch ((_e = $this.opMethod.operation.requests[0].protocol.http) === null || _e === void 0 ? void 0 : _e.method.toLowerCase()) {
370
458
  case 'post':
371
459
  case 'delete':
372
- finalUri = codegen_csharp_12.Local('_finalUri', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Location')));
460
+ finalUri = (0, codegen_csharp_12.Local)('_finalUri', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Location')));
373
461
  yield finalUri;
374
462
  break;
375
463
  case 'patch':
@@ -381,11 +469,13 @@ class CallMethod extends codegen_csharp_3.Method {
381
469
  }
382
470
  break;
383
471
  }
384
- const asyncOperation = codegen_csharp_12.Local('asyncOperation', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Azure-AsyncOperation')));
472
+ const asyncOperation = (0, codegen_csharp_12.Local)('asyncOperation', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Azure-AsyncOperation')));
385
473
  yield asyncOperation;
386
- const location = codegen_csharp_12.Local('location', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Location')));
474
+ const location = (0, codegen_csharp_12.Local)('location', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Location')));
387
475
  yield location;
388
- yield codegen_csharp_7.While(new codegen_csharp_2.LiteralExpression(`${reqParameter.use}.Method == System.Net.Http.HttpMethod.Put && ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[200].value} || ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[201].value} || ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[202].value} `), function* () {
476
+ const operationLocation = (0, codegen_csharp_12.Local)('operationLocation', response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Operation-Location')));
477
+ yield operationLocation;
478
+ yield (0, codegen_csharp_7.While)(new codegen_csharp_2.LiteralExpression(`${reqParameter.use}.Method == System.Net.Http.HttpMethod.Put && ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[200].value} || ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[201].value} || ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[202].value} `), function* () {
389
479
  yield '// delay before making the next polling request';
390
480
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.DelayBeforePolling, response.value);
391
481
  yield EOL;
@@ -396,12 +486,15 @@ class CallMethod extends codegen_csharp_3.Method {
396
486
  yield 'if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) {';
397
487
  yield ' ' + location.assign(response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Location')));
398
488
  yield '}';
399
- const uriLocal = codegen_csharp_12.Local('_uri', codegen_csharp_14.Ternery(codegen_csharp_13.System.String.IsNullOrEmpty(asyncOperation), codegen_csharp_14.Ternery(codegen_csharp_13.System.String.IsNullOrEmpty(location), originalUri, location), asyncOperation));
489
+ yield 'if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Operation-Location"))) {';
490
+ yield ' ' + operationLocation.assign(response.invokeMethod('GetFirstHeader', new codegen_csharp_2.StringExpression('Operation-Location')));
491
+ yield '}';
492
+ const uriLocal = (0, codegen_csharp_12.Local)('_uri', (0, codegen_csharp_14.Ternery)(codegen_csharp_13.System.String.IsNullOrEmpty(asyncOperation), (0, codegen_csharp_14.Ternery)(codegen_csharp_13.System.String.IsNullOrEmpty(location), (0, codegen_csharp_14.Ternery)(codegen_csharp_13.System.String.IsNullOrEmpty(operationLocation), originalUri, operationLocation), location), asyncOperation));
400
493
  yield uriLocal;
401
494
  yield `${reqParameter.use} = ${reqParameter.use}.CloneAndDispose(${codegen_csharp_13.System.Uri.new(uriLocal)}, ${clientruntime_1.ClientRuntime.Method.Get});`;
402
495
  yield EOL;
403
496
  yield '// and let\'s look at the current response body and see if we have some information we can give back to the listener';
404
- const content = codegen_csharp_12.Local('content', new codegen_csharp_2.LiteralExpression(`await ${response.value}.Content.ReadAsStringAsync()`));
497
+ const content = (0, codegen_csharp_12.Local)('content', new codegen_csharp_2.LiteralExpression(`await ${response.value}.Content.ReadAsStringAsync()`));
405
498
  yield content;
406
499
  yield EOL;
407
500
  yield '// drop the old response';
@@ -412,59 +505,60 @@ class CallMethod extends codegen_csharp_3.Method {
412
505
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.Polling, response.value);
413
506
  yield EOL;
414
507
  yield `
415
- // if we got back an OK, take a peek inside and see if it's done
416
- if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode.OK})
417
- {
418
- var error = false;
419
- try {
420
- if( ${clientruntime_1.ClientRuntime.JsonNode.Parse(codegen_csharp_2.toExpression(`await ${response.value}.Content.ReadAsStringAsync()`))} is ${clientruntime_1.ClientRuntime.JsonObject} json)
421
- {
422
- var state = json.Property("properties")?.PropertyT<${clientruntime_1.ClientRuntime.JsonString}>("provisioningState") ?? json.PropertyT<${clientruntime_1.ClientRuntime.JsonString}>("status");
423
- if( state is null )
424
- {
425
- // the body doesn't contain any information that has the state of the LRO
426
- // we're going to just get out, and let the consumer have the result
427
- break;
428
- }
508
+ // if we got back an OK, take a peek inside and see if it's done
509
+ if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode.OK})
510
+ {
511
+ var error = false;
512
+ try {
513
+ if( ${clientruntime_1.ClientRuntime.JsonNode.Parse((0, codegen_csharp_2.toExpression)(`await ${response.value}.Content.ReadAsStringAsync()`))} is ${clientruntime_1.ClientRuntime.JsonObject} json)
514
+ {
515
+ var state = json.Property("properties")?.PropertyT<${clientruntime_1.ClientRuntime.JsonString}>("provisioningState") ?? json.PropertyT<${clientruntime_1.ClientRuntime.JsonString}>("status");
516
+ if( state is null )
517
+ {
518
+ // the body doesn't contain any information that has the state of the LRO
519
+ // we're going to just get out, and let the consumer have the result
520
+ break;
521
+ }
429
522
 
430
- switch( state?.ToString()?.ToLower() )
431
- {
432
- case "failed":
433
- error = true;
523
+ switch( state?.ToString()?.ToLower() )
524
+ {
525
+ case "failed":
526
+ error = true;
527
+ break;
528
+ case "succeeded":
529
+ case "canceled":
530
+ // we're done polling.
434
531
  break;
435
- case "succeeded":
436
- case "canceled":
437
- // we're done polling.
438
- break;
439
532
 
440
- default:
441
- // need to keep polling!
442
- ${response.value}.StatusCode = ${codegen_csharp_13.System.Net.HttpStatusCode.Created};
443
- continue;
444
- }
445
- }
446
- } catch {
447
- // if we run into a problem peeking into the result,
448
- // we really don't want to do anything special.
449
- }
450
- if (error) {
451
- throw new ${clientruntime_1.ClientRuntime.fullName}.UndeclaredResponseException(${response.value});
452
- }
453
- }`;
533
+ default:
534
+ // need to keep polling!
535
+ ${response.value}.StatusCode = ${codegen_csharp_13.System.Net.HttpStatusCode.Created};
536
+ continue;
537
+ }
538
+ }
539
+ } catch {
540
+ // if we run into a problem peeking into the result,
541
+ // we really don't want to do anything special.
542
+ }
543
+ if (error) {
544
+ throw new ${clientruntime_1.ClientRuntime.fullName}.UndeclaredResponseException(${response.value});
545
+ }
546
+ }`;
454
547
  yield EOL;
455
548
  yield '// check for terminal status code';
456
- yield codegen_csharp_7.If(new codegen_csharp_2.LiteralExpression(`${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[201].value} || ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[202].value} `), 'continue;');
549
+ yield (0, codegen_csharp_7.If)(new codegen_csharp_2.LiteralExpression(`${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[201].value} || ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCode[202].value} `), 'continue;');
457
550
  yield '// we are done polling, do a request on final target?';
458
551
  switch (fsv) {
459
552
  case 'original-uri':
460
553
  case 'azure-asyncoperation':
461
554
  case 'azure-async-operation':
462
555
  case 'location':
556
+ case 'operation-location':
463
557
  // perform a final GET on the specified final URI.
464
558
  yield $this.finalGet(eventListener, finalUri, reqParameter, response);
465
559
  break;
466
560
  default:
467
- yield codegen_csharp_7.If(`!string.IsNullOrWhiteSpace(${finalUri})`, function* () {
561
+ yield (0, codegen_csharp_7.If)(`!string.IsNullOrWhiteSpace(${finalUri})`, function* () {
468
562
  yield $this.finalGet(eventListener, finalUri, reqParameter, response);
469
563
  });
470
564
  break;
@@ -474,50 +568,50 @@ if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCod
474
568
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.Progress, new codegen_csharp_2.LiteralExpression('"intentional placeholder"'), new codegen_csharp_2.LiteralExpression('100'));
475
569
  yield responder();
476
570
  });
477
- yield codegen_csharp_6.Finally(function* () {
571
+ yield (0, codegen_csharp_6.Finally)(function* () {
478
572
  yield '// finally statements';
479
573
  yield eventListener.signalNoCheck(clientruntime_1.ClientRuntime.Events.Finally, 'request', '_response');
480
574
  yield `${response.value}?.Dispose();`;
481
575
  yield `${reqParameter.use}?.Dispose();`;
482
576
  });
483
577
  if ($this.returnNull) {
484
- yield codegen_csharp_8.Return('result');
578
+ yield (0, codegen_csharp_8.Return)('result');
485
579
  $this.insert(new codegen_csharp_12.LocalVariable('result', codegen_csharp_13.System.Net.Http.HttpResponseMessage, { initializer: codegen_csharp_13.dotnet.Null }));
486
580
  }
487
581
  });
488
- this.opMethod.emitCall($this.returnNull);
582
+ this.opMethod.emitCall($this.returnNull, withResult);
489
583
  }
490
584
  *finalGet(eventListener, finalLocation, reqParameter, response) {
491
585
  yield '// create a new request with the final uri';
492
- yield reqParameter.assign(`${codegen_csharp_2.valueOf(reqParameter)}.CloneAndDispose(${codegen_csharp_13.System.Uri.new(finalLocation)}, ${clientruntime_1.ClientRuntime.Method.Get})`);
586
+ yield reqParameter.assign(`${(0, codegen_csharp_2.valueOf)(reqParameter)}.CloneAndDispose(${codegen_csharp_13.System.Uri.new(finalLocation)}, ${clientruntime_1.ClientRuntime.Method.Get})`);
493
587
  yield codegen_1.EOL;
494
588
  yield '// drop the old response';
495
589
  yield `${response.value}?.Dispose();`;
496
590
  yield codegen_1.EOL;
497
591
  yield '// make the final call';
498
- yield response.assign(`await ${this.opMethod.senderParameter}.SendAsync(${codegen_csharp_2.valueOf(reqParameter)}, ${this.opMethod.contextParameter})`);
592
+ yield response.assign(`await ${this.opMethod.senderParameter}.SendAsync(${(0, codegen_csharp_2.valueOf)(reqParameter)}, ${this.opMethod.contextParameter})`);
499
593
  yield eventListener.signal(clientruntime_1.ClientRuntime.Events.Polling, response.value);
500
594
  // make sure we're not polling anymore.
501
595
  yield 'break;';
502
596
  }
503
- *responsesEmitter($this, opMethod, responses, eventListener) {
597
+ *responsesEmitter($this, opMethod, responses, responseVariable, eventListener, withResult) {
504
598
  var _a;
505
- if (linq_1.length(responses) > 1) {
506
- yield codegen_csharp_9.Switch('_contentType', function* () {
599
+ if ((0, linq_1.length)(responses) > 1) {
600
+ yield (0, codegen_csharp_9.Switch)('_contentType', function* () {
507
601
  var _a, _b, _c, _d;
508
- for (const eachResponse of linq_1.values(responses)) {
509
- const mimetype = linq_1.length((_a = eachResponse.protocol.http) === null || _a === void 0 ? void 0 : _a.mediaTypes) > 0 ? (_b = eachResponse.protocol.http) === null || _b === void 0 ? void 0 : _b.mimeTypes[0] : '';
510
- const callbackParameter = linq_1.values(opMethod.callbacks).first(each => { var _a; return each.name === ((_a = eachResponse.language.csharp) === null || _a === void 0 ? void 0 : _a.name); });
511
- let count = linq_1.length((_c = eachResponse.protocol.http) === null || _c === void 0 ? void 0 : _c.mediaTypes);
512
- for (const mt of linq_1.values((_d = eachResponse.protocol.http) === null || _d === void 0 ? void 0 : _d.mediaTypes)) {
602
+ for (const eachResponse of (0, linq_1.values)(responses)) {
603
+ const mimetype = (0, linq_1.length)((_a = eachResponse.protocol.http) === null || _a === void 0 ? void 0 : _a.mediaTypes) > 0 ? (_b = eachResponse.protocol.http) === null || _b === void 0 ? void 0 : _b.mimeTypes[0] : '';
604
+ const callbackParameter = (0, linq_1.values)(opMethod.callbacks).first(each => { var _a; return each.name === ((_a = eachResponse.language.csharp) === null || _a === void 0 ? void 0 : _a.name); });
605
+ let count = (0, linq_1.length)((_c = eachResponse.protocol.http) === null || _c === void 0 ? void 0 : _c.mediaTypes);
606
+ for (const mt of (0, linq_1.values)((_d = eachResponse.protocol.http) === null || _d === void 0 ? void 0 : _d.mediaTypes)) {
513
607
  count--;
514
- const mediaType = codemodel_v3_2.normalizeMediaType(mt);
608
+ const mediaType = (0, codemodel_v3_2.normalizeMediaType)(mt);
515
609
  if (mediaType) {
516
610
  if (count === 0) {
517
- yield codegen_csharp_5.Case(new codegen_csharp_2.StringExpression(mediaType).toString(), $this.NewResponseHandler(mimetype, eachResponse, callbackParameter));
611
+ yield (0, codegen_csharp_5.Case)(new codegen_csharp_2.StringExpression(mediaType).toString(), $this.NewResponseHandler(mimetype, eachResponse, callbackParameter, responseVariable, withResult));
518
612
  }
519
613
  else {
520
- yield codegen_csharp_5.TerminalCase(new codegen_csharp_2.StringExpression(mediaType).toString(), '');
614
+ yield (0, codegen_csharp_5.TerminalCase)(new codegen_csharp_2.StringExpression(mediaType).toString(), '');
521
615
  }
522
616
  }
523
617
  }
@@ -526,17 +620,17 @@ if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCod
526
620
  }
527
621
  else {
528
622
  const response = responses[0];
529
- const callbackParameter = linq_1.values(opMethod.callbacks).first(each => { var _a; return each.name === ((_a = response.language.csharp) === null || _a === void 0 ? void 0 : _a.name); });
623
+ const callbackParameter = (0, linq_1.values)(opMethod.callbacks).first(each => { var _a; return each.name === ((_a = response.language.csharp) === null || _a === void 0 ? void 0 : _a.name); });
530
624
  // all mimeTypes per for this response code.
531
- yield eventListener.signal(clientruntime_1.ClientRuntime.Events.BeforeResponseDispatch, '_response');
532
- yield $this.NewResponseHandler(linq_1.values((_a = response.protocol.http) === null || _a === void 0 ? void 0 : _a.mediaTypes).first() || '', response, callbackParameter);
625
+ yield eventListener.signal(clientruntime_1.ClientRuntime.Events.BeforeResponseDispatch, responseVariable.value);
626
+ yield $this.NewResponseHandler((0, linq_1.values)((_a = response.protocol.http) === null || _a === void 0 ? void 0 : _a.mediaTypes).first() || '', response, callbackParameter, responseVariable, withResult);
533
627
  }
534
628
  }
535
629
  *responseHandlerForNormalPipeline(mimetype, eachResponse, callbackParameter) {
536
630
  const callbackParameters = new Array();
537
631
  if (callbackParameter.responseType) {
538
632
  // hande the body response
539
- const r = callbackParameter.responseType.deserializeFromResponse(codemodel_v3_2.knownMediaType(mimetype), codegen_csharp_2.toExpression('_response'), codegen_csharp_2.toExpression('null'));
633
+ const r = callbackParameter.responseType.deserializeFromResponse((0, codemodel_v3_2.knownMediaType)(mimetype), (0, codegen_csharp_2.toExpression)('_response'), (0, codegen_csharp_2.toExpression)('null'));
540
634
  if (r) {
541
635
  callbackParameters.push(r);
542
636
  }
@@ -547,7 +641,7 @@ if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCod
547
641
  }
548
642
  if (callbackParameter.headerType) {
549
643
  // header model deserialization...
550
- const r = callbackParameter.headerType.deserializeFromResponse(codemodel_v3_2.KnownMediaType.Header, codegen_csharp_2.toExpression('_response'), codegen_csharp_2.toExpression('null'));
644
+ const r = callbackParameter.headerType.deserializeFromResponse(codemodel_v3_2.KnownMediaType.Header, (0, codegen_csharp_2.toExpression)('_response'), (0, codegen_csharp_2.toExpression)('null'));
551
645
  if (r) {
552
646
  callbackParameters.push(r);
553
647
  }
@@ -555,12 +649,12 @@ if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCod
555
649
  // make the callback with the appropriate parameters
556
650
  yield `await ${eachResponse.details.csharp.name}(_response${callbackParameters.length === 0 ? '' : ','}${callbackParameters.joinWith(codegen_csharp_2.valueOf)});`;
557
651
  }
558
- *NewResponseHandlerForNormalPipeline(mimetype, eachResponse, callbackParameter) {
652
+ *NewResponseHandlerForNormalPipeline(mimetype, eachResponse, callbackParameter, responseVariable) {
559
653
  var _a;
560
654
  const callbackParameters = new Array();
561
655
  if (callbackParameter.responseType) {
562
656
  // hande the body response
563
- const r = callbackParameter.responseType.deserializeFromResponse(codemodel_v3_2.knownMediaType(mimetype), codegen_csharp_2.toExpression('_response'), codegen_csharp_2.toExpression('null'));
657
+ const r = callbackParameter.responseType.deserializeFromResponse((0, codemodel_v3_2.knownMediaType)(mimetype), (0, codegen_csharp_2.toExpression)(responseVariable.value), (0, codegen_csharp_2.toExpression)('null'));
564
658
  if (r) {
565
659
  callbackParameters.push(r);
566
660
  }
@@ -571,7 +665,7 @@ if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCod
571
665
  }
572
666
  if (callbackParameter.headerType) {
573
667
  // header model deserialization...
574
- const r = callbackParameter.headerType.deserializeFromResponse(codemodel_v3_2.KnownMediaType.Header, codegen_csharp_2.toExpression('_response'), codegen_csharp_2.toExpression('null'));
668
+ const r = callbackParameter.headerType.deserializeFromResponse(codemodel_v3_2.KnownMediaType.Header, (0, codegen_csharp_2.toExpression)(responseVariable.value), (0, codegen_csharp_2.toExpression)('null'));
575
669
  if (r) {
576
670
  callbackParameters.push(r);
577
671
  }
@@ -579,11 +673,70 @@ if( ${response.value}.StatusCode == ${codegen_csharp_13.System.Net.HttpStatusCod
579
673
  // make the callback with the appropriate parameters
580
674
  yield `await ${(_a = eachResponse.language.csharp) === null || _a === void 0 ? void 0 : _a.name}(_response${callbackParameters.length === 0 ? '' : ','}${callbackParameters.joinWith(codegen_csharp_2.valueOf)});`;
581
675
  }
676
+ *NewResponseHandlerWithResult(mimetype, response, callbackParameter, responseVariable) {
677
+ var _a, _b, _c, _d;
678
+ const responseType = callbackParameter.responseType;
679
+ if (!responseType) {
680
+ yield `throw new ${clientruntime_1.ClientRuntime.fullName}.UndeclaredResponseException(${responseVariable.value});`;
681
+ return;
682
+ }
683
+ const deserializeResponseAsync = responseType.deserializeFromResponse((0, codemodel_v3_2.knownMediaType)(mimetype), (0, codegen_csharp_2.toExpression)(responseVariable.value), (0, codegen_csharp_2.toExpression)('null'));
684
+ yield `var _result = ${deserializeResponseAsync};`;
685
+ switch ((_a = response.protocol.http) === null || _a === void 0 ? void 0 : _a.statusCodes[0]) {
686
+ case 'default': {
687
+ // this should write an error to the error channel.
688
+ yield `// Error Response : ${(_b = response.protocol.http) === null || _b === void 0 ? void 0 : _b.statusCodes[0]}`;
689
+ const unexpected = function* () {
690
+ yield '// Unrecognized Response. Create an error record based on what we have.';
691
+ const ex = responseType ?
692
+ (0, codegen_csharp_12.Local)('ex', `new ${clientruntime_1.ClientRuntime.name}.RestException<${responseType}>(${responseVariable.value}, await _result)`) :
693
+ (0, codegen_csharp_12.Local)('ex', `new ${clientruntime_1.ClientRuntime.name}.RestException(responseMessage)`);
694
+ yield ex.declarationStatement;
695
+ yield `throw ${ex};`;
696
+ };
697
+ if (response.schema !== undefined) {
698
+ // the schema should be the error information.
699
+ // this supports both { error { message, code} } and { message, code}
700
+ let props = (0, schema_1.getAllPublicVirtualProperties)((_c = response.schema.language.csharp) === null || _c === void 0 ? void 0 : _c.virtualProperties);
701
+ const errorProperty = (0, linq_1.values)(props).first(p => p.property.serializedName === 'error');
702
+ let ep = '';
703
+ if (errorProperty) {
704
+ props = (0, schema_1.getAllPublicVirtualProperties)((_d = errorProperty.property.schema.language.csharp) === null || _d === void 0 ? void 0 : _d.virtualProperties);
705
+ ep = `${errorProperty.name}?.`;
706
+ }
707
+ const codeProp = props.find(p => p.name.toLowerCase().indexOf('code') > -1); // first property with 'code'
708
+ const messageProp = props.find(p => p.name.toLowerCase().indexOf('message') > -1); // first property with 'message'
709
+ const actionProp = props.find(p => p.name.toLowerCase().indexOf('action') > -1); // first property with 'action'
710
+ if (codeProp && messageProp) {
711
+ const lcode = new codegen_csharp_12.LocalVariable('code', codegen_csharp_13.dotnet.Var, { initializer: `(await _result)?.${ep}${codeProp.name}` });
712
+ const lmessage = new codegen_csharp_12.LocalVariable('message', codegen_csharp_13.dotnet.Var, { initializer: `(await _result)?.${ep}${messageProp.name}` });
713
+ const laction = actionProp ? new codegen_csharp_12.LocalVariable('action', codegen_csharp_13.dotnet.Var, { initializer: `(await _result)?.${ep}${actionProp.name} ?? ${codegen_csharp_13.System.String.Empty}` }) : undefined;
714
+ yield lcode;
715
+ yield lmessage;
716
+ yield laction;
717
+ yield (0, codegen_csharp_7.If)((0, codegen_csharp_1.Or)((0, codegen_csharp_1.IsNull)(lcode), ((0, codegen_csharp_1.IsNull)(lmessage))), unexpected);
718
+ yield (0, codegen_csharp_1.Else)(`throw new global::System.Exception($"[{${lcode}}] : {${lmessage}}");`);
719
+ }
720
+ else {
721
+ yield unexpected;
722
+ }
723
+ }
724
+ else {
725
+ yield unexpected;
726
+ }
727
+ break;
728
+ }
729
+ default: {
730
+ yield 'return await _result;';
731
+ break;
732
+ }
733
+ }
734
+ }
582
735
  responseHandler(mimetype, eachResponse, callbackParameter) {
583
736
  return this.responseHandlerForNormalPipeline(mimetype, eachResponse, callbackParameter);
584
737
  }
585
- NewResponseHandler(mimetype, eachResponse, callbackParameter) {
586
- return this.NewResponseHandlerForNormalPipeline(mimetype, eachResponse, callbackParameter);
738
+ NewResponseHandler(mimetype, eachResponse, callbackParameter, responseVariable, withResult) {
739
+ return withResult ? this.NewResponseHandlerWithResult(mimetype, eachResponse, callbackParameter, responseVariable) : this.NewResponseHandlerForNormalPipeline(mimetype, eachResponse, callbackParameter, responseVariable);
587
740
  }
588
741
  }
589
742
  exports.CallMethod = CallMethod;
@@ -598,7 +751,7 @@ class ValidationMethod extends codegen_csharp_3.Method {
598
751
  this.returnsDescription = opMethod.returnsDescription;
599
752
  this.access = codegen_csharp_1.Access.Internal;
600
753
  this.async = codegen_csharp_1.Modifier.Async;
601
- this.push(codegen_csharp_11.Using('NoSynchronizationContext', ''));
754
+ this.push((0, codegen_csharp_11.Using)('NoSynchronizationContext', ''));
602
755
  // add the method parameters
603
756
  for (const parameter of opMethod.methodParameters) {
604
757
  if (!parameter.defaultInitializer) {