@autorest/powershell 4.0.0-dev.1 → 4.0.0-dev.10

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 (306) hide show
  1. package/.rush/temp/package-deps_build.json +94 -60
  2. package/.rush/temp/shrinkwrap-deps.json +22 -22
  3. package/autorest-configuration-for-sdk.md +122 -0
  4. package/autorest-configuration.md +4 -2
  5. package/dist/cmdlets/class.d.ts +1 -0
  6. package/dist/cmdlets/class.d.ts.map +1 -1
  7. package/dist/cmdlets/class.js +218 -82
  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 +3 -1
  11. package/dist/cmdlets/namespace.js.map +1 -1
  12. package/dist/cmdlets/parameter.js +1 -0
  13. package/dist/cmdlets/parameter.js.map +1 -1
  14. package/dist/enums/namespace.js +2 -1
  15. package/dist/enums/namespace.js.map +1 -1
  16. package/dist/file-formats/md-file.js +1 -0
  17. package/dist/file-formats/md-file.js.map +1 -1
  18. package/dist/file-formats/psd-file.js +1 -0
  19. package/dist/file-formats/psd-file.js.map +1 -1
  20. package/dist/file-formats/psscript-file.js +1 -0
  21. package/dist/file-formats/psscript-file.js.map +1 -1
  22. package/dist/generators/csproj.js +1 -0
  23. package/dist/generators/csproj.js.map +1 -1
  24. package/dist/generators/gitattributes.js +1 -0
  25. package/dist/generators/gitattributes.js.map +1 -1
  26. package/dist/generators/gitignore.js +1 -0
  27. package/dist/generators/gitignore.js.map +1 -1
  28. package/dist/generators/inputhandler.custom.d.ts +3 -0
  29. package/dist/generators/inputhandler.custom.d.ts.map +1 -0
  30. package/dist/generators/inputhandler.custom.js +33 -0
  31. package/dist/generators/inputhandler.custom.js.map +1 -0
  32. package/dist/generators/nuspec.js +1 -0
  33. package/dist/generators/nuspec.js.map +1 -1
  34. package/dist/generators/psm1.custom.js +1 -0
  35. package/dist/generators/psm1.custom.js.map +1 -1
  36. package/dist/generators/psm1.internal.js +1 -0
  37. package/dist/generators/psm1.internal.js.map +1 -1
  38. package/dist/generators/psm1.js +3 -2
  39. package/dist/generators/psm1.js.map +1 -1
  40. package/dist/generators/readme.js +1 -0
  41. package/dist/generators/readme.js.map +1 -1
  42. package/dist/generators/script-cmdlet.js +2 -1
  43. package/dist/generators/script-cmdlet.js.map +1 -1
  44. package/dist/internal/name-inferrer.js +1 -0
  45. package/dist/internal/name-inferrer.js.map +1 -1
  46. package/dist/internal/powershell-declarations.d.ts +3 -0
  47. package/dist/internal/powershell-declarations.d.ts.map +1 -1
  48. package/dist/internal/powershell-declarations.js +3 -0
  49. package/dist/internal/powershell-declarations.js.map +1 -1
  50. package/dist/internal/project.d.ts +12 -9
  51. package/dist/internal/project.d.ts.map +1 -1
  52. package/dist/internal/project.js +31 -12
  53. package/dist/internal/project.js.map +1 -1
  54. package/dist/internal/state.js +1 -0
  55. package/dist/internal/state.js.map +1 -1
  56. package/dist/internal/verbs.js +1 -0
  57. package/dist/internal/verbs.js.map +1 -1
  58. package/dist/llcsharp/clientruntime.d.ts +3 -0
  59. package/dist/llcsharp/clientruntime.d.ts.map +1 -1
  60. package/dist/llcsharp/clientruntime.js +4 -0
  61. package/dist/llcsharp/clientruntime.js.map +1 -1
  62. package/dist/llcsharp/code-model.d.ts +1 -0
  63. package/dist/llcsharp/code-model.d.ts.map +1 -1
  64. package/dist/llcsharp/csharp-declarations.js +1 -0
  65. package/dist/llcsharp/csharp-declarations.js.map +1 -1
  66. package/dist/llcsharp/enums/enum.js +2 -1
  67. package/dist/llcsharp/enums/enum.js.map +1 -1
  68. package/dist/llcsharp/enums/namespace.js +1 -0
  69. package/dist/llcsharp/enums/namespace.js.map +1 -1
  70. package/dist/llcsharp/exports.js +23 -13
  71. package/dist/llcsharp/exports.js.map +1 -1
  72. package/dist/llcsharp/generator.js +1 -0
  73. package/dist/llcsharp/generator.js.map +1 -1
  74. package/dist/llcsharp/messages.js +1 -0
  75. package/dist/llcsharp/messages.js.map +1 -1
  76. package/dist/llcsharp/model/idictionary.js +1 -0
  77. package/dist/llcsharp/model/idictionary.js.map +1 -1
  78. package/dist/llcsharp/model/interface.d.ts.map +1 -1
  79. package/dist/llcsharp/model/interface.js +2 -1
  80. package/dist/llcsharp/model/interface.js.map +1 -1
  81. package/dist/llcsharp/model/model-class-dictionary.js +1 -0
  82. package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
  83. package/dist/llcsharp/model/model-class-json.d.ts.map +1 -1
  84. package/dist/llcsharp/model/model-class-json.js +12 -2
  85. package/dist/llcsharp/model/model-class-json.js.map +1 -1
  86. package/dist/llcsharp/model/model-class-serializer.js +1 -0
  87. package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
  88. package/dist/llcsharp/model/model-class.js +11 -10
  89. package/dist/llcsharp/model/model-class.js.map +1 -1
  90. package/dist/llcsharp/model/namespace.js +1 -0
  91. package/dist/llcsharp/model/namespace.js.map +1 -1
  92. package/dist/llcsharp/model/property.js +1 -0
  93. package/dist/llcsharp/model/property.js.map +1 -1
  94. package/dist/llcsharp/operation/api-class.js +1 -0
  95. package/dist/llcsharp/operation/api-class.js.map +1 -1
  96. package/dist/llcsharp/operation/method.d.ts.map +1 -1
  97. package/dist/llcsharp/operation/method.js +21 -27
  98. package/dist/llcsharp/operation/method.js.map +1 -1
  99. package/dist/llcsharp/operation/namespace.js +1 -0
  100. package/dist/llcsharp/operation/namespace.js.map +1 -1
  101. package/dist/llcsharp/operation/parameter.js +1 -0
  102. package/dist/llcsharp/operation/parameter.js.map +1 -1
  103. package/dist/llcsharp/project.d.ts.map +1 -1
  104. package/dist/llcsharp/project.js +3 -1
  105. package/dist/llcsharp/project.js.map +1 -1
  106. package/dist/llcsharp/schema/Uuid.js +1 -0
  107. package/dist/llcsharp/schema/Uuid.js.map +1 -1
  108. package/dist/llcsharp/schema/array.js +1 -0
  109. package/dist/llcsharp/schema/array.js.map +1 -1
  110. package/dist/llcsharp/schema/binary.js +1 -0
  111. package/dist/llcsharp/schema/binary.js.map +1 -1
  112. package/dist/llcsharp/schema/boolean.js +1 -0
  113. package/dist/llcsharp/schema/boolean.js.map +1 -1
  114. package/dist/llcsharp/schema/byte-array.js +1 -0
  115. package/dist/llcsharp/schema/byte-array.js.map +1 -1
  116. package/dist/llcsharp/schema/char.js +1 -0
  117. package/dist/llcsharp/schema/char.js.map +1 -1
  118. package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
  119. package/dist/llcsharp/schema/date-time.js +1 -0
  120. package/dist/llcsharp/schema/date-time.js.map +1 -1
  121. package/dist/llcsharp/schema/date.js +1 -0
  122. package/dist/llcsharp/schema/date.js.map +1 -1
  123. package/dist/llcsharp/schema/duration.js +1 -0
  124. package/dist/llcsharp/schema/duration.js.map +1 -1
  125. package/dist/llcsharp/schema/enum.js +1 -0
  126. package/dist/llcsharp/schema/enum.js.map +1 -1
  127. package/dist/llcsharp/schema/integer.js +1 -0
  128. package/dist/llcsharp/schema/integer.js.map +1 -1
  129. package/dist/llcsharp/schema/object.js +1 -0
  130. package/dist/llcsharp/schema/object.js.map +1 -1
  131. package/dist/llcsharp/schema/password.js +2 -1
  132. package/dist/llcsharp/schema/password.js.map +1 -1
  133. package/dist/llcsharp/schema/primitive.js +1 -0
  134. package/dist/llcsharp/schema/primitive.js.map +1 -1
  135. package/dist/llcsharp/schema/schema-resolver.d.ts +2 -3
  136. package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
  137. package/dist/llcsharp/schema/schema-resolver.js +4 -0
  138. package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
  139. package/dist/llcsharp/schema/string.d.ts.map +1 -1
  140. package/dist/llcsharp/schema/string.js +1 -0
  141. package/dist/llcsharp/schema/string.js.map +1 -1
  142. package/dist/llcsharp/schema/uri.d.ts +10 -0
  143. package/dist/llcsharp/schema/uri.d.ts.map +1 -0
  144. package/dist/llcsharp/schema/uri.js +25 -0
  145. package/dist/llcsharp/schema/uri.js.map +1 -0
  146. package/dist/llcsharp/validations.js +1 -0
  147. package/dist/llcsharp/validations.js.map +1 -1
  148. package/dist/main.d.ts.map +1 -1
  149. package/dist/main.js +11 -0
  150. package/dist/main.js.map +1 -1
  151. package/dist/models/model-extensions.js +7 -6
  152. package/dist/models/model-extensions.js.map +1 -1
  153. package/dist/module/module-class.js +2 -1
  154. package/dist/module/module-class.js.map +1 -1
  155. package/dist/module/module-namespace.js +1 -0
  156. package/dist/module/module-namespace.js.map +1 -1
  157. package/dist/plugins/add-azure-completers-v2.js +1 -0
  158. package/dist/plugins/add-azure-completers-v2.js.map +1 -1
  159. package/dist/plugins/create-commands-v2.d.ts.map +1 -1
  160. package/dist/plugins/create-commands-v2.js +6 -4
  161. package/dist/plugins/create-commands-v2.js.map +1 -1
  162. package/dist/plugins/cs-namer-v2.js +4 -3
  163. package/dist/plugins/cs-namer-v2.js.map +1 -1
  164. package/dist/plugins/llcsharp-v2.js +1 -0
  165. package/dist/plugins/llcsharp-v2.js.map +1 -1
  166. package/dist/plugins/modifiers-v2.d.ts +4 -0
  167. package/dist/plugins/modifiers-v2.d.ts.map +1 -1
  168. package/dist/plugins/modifiers-v2.js +69 -13
  169. package/dist/plugins/modifiers-v2.js.map +1 -1
  170. package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
  171. package/dist/plugins/plugin-create-inline-properties.js +16 -1
  172. package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
  173. package/dist/plugins/plugin-tweak-m4-model.js +4 -3
  174. package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
  175. package/dist/plugins/plugin-tweak-model-azure-v2.js +4 -3
  176. package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
  177. package/dist/plugins/plugin-tweak-model.js +15 -14
  178. package/dist/plugins/plugin-tweak-model.js.map +1 -1
  179. package/dist/plugins/powershell-v2.d.ts.map +1 -1
  180. package/dist/plugins/powershell-v2.js +8 -2
  181. package/dist/plugins/powershell-v2.js.map +1 -1
  182. package/dist/plugins/ps-namer-v2.js +1 -0
  183. package/dist/plugins/ps-namer-v2.js.map +1 -1
  184. package/dist/plugins/sdk-create-inline-properties.d.ts +4 -0
  185. package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -0
  186. package/dist/plugins/sdk-create-inline-properties.js +552 -0
  187. package/dist/plugins/sdk-create-inline-properties.js.map +1 -0
  188. package/dist/plugins/sdk-cs-namer.d.ts +3 -0
  189. package/dist/plugins/sdk-cs-namer.d.ts.map +1 -0
  190. package/dist/plugins/sdk-cs-namer.js +385 -0
  191. package/dist/plugins/sdk-cs-namer.js.map +1 -0
  192. package/dist/plugins/sdk-cs-simplifier.d.ts +3 -0
  193. package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -0
  194. package/dist/plugins/sdk-cs-simplifier.js +154 -0
  195. package/dist/plugins/sdk-cs-simplifier.js.map +1 -0
  196. package/dist/plugins/sdk-generate.d.ts +3 -0
  197. package/dist/plugins/sdk-generate.d.ts.map +1 -0
  198. package/dist/plugins/sdk-generate.js +106 -0
  199. package/dist/plugins/sdk-generate.js.map +1 -0
  200. package/dist/plugins/sdk-tweak-model.d.ts +3 -0
  201. package/dist/plugins/sdk-tweak-model.d.ts.map +1 -0
  202. package/dist/plugins/sdk-tweak-model.js +357 -0
  203. package/dist/plugins/sdk-tweak-model.js.map +1 -0
  204. package/dist/sdk/project.d.ts +45 -0
  205. package/dist/sdk/project.d.ts.map +1 -0
  206. package/dist/sdk/project.js +56 -0
  207. package/dist/sdk/project.js.map +1 -0
  208. package/dist/sdk/state.d.ts +23 -0
  209. package/dist/sdk/state.d.ts.map +1 -0
  210. package/dist/sdk/state.js +28 -0
  211. package/dist/sdk/state.js.map +1 -0
  212. package/dist/sdk/utility.d.ts +32 -0
  213. package/dist/sdk/utility.d.ts.map +1 -0
  214. package/dist/sdk/utility.js +414 -0
  215. package/dist/sdk/utility.js.map +1 -0
  216. package/dist/utils/PwshModel.js +1 -0
  217. package/dist/utils/PwshModel.js.map +1 -1
  218. package/dist/utils/SdkModel.d.ts +7 -0
  219. package/dist/utils/SdkModel.d.ts.map +1 -0
  220. package/dist/utils/SdkModel.js +17 -0
  221. package/dist/utils/SdkModel.js.map +1 -0
  222. package/dist/utils/TrieNode.d.ts +10 -0
  223. package/dist/utils/TrieNode.d.ts.map +1 -0
  224. package/dist/utils/TrieNode.js +45 -0
  225. package/dist/utils/TrieNode.js.map +1 -0
  226. package/dist/utils/WrapComments.d.ts +2 -0
  227. package/dist/utils/WrapComments.d.ts.map +1 -0
  228. package/dist/utils/WrapComments.js +46 -0
  229. package/dist/utils/WrapComments.js.map +1 -0
  230. package/dist/utils/code-namer.d.ts +3 -0
  231. package/dist/utils/code-namer.d.ts.map +1 -0
  232. package/dist/utils/code-namer.js +38 -0
  233. package/dist/utils/code-namer.js.map +1 -0
  234. package/dist/utils/command-operation.d.ts +1 -0
  235. package/dist/utils/command-operation.d.ts.map +1 -1
  236. package/dist/utils/command-operation.js +2 -2
  237. package/dist/utils/command-operation.js.map +1 -1
  238. package/dist/utils/components.d.ts +2 -0
  239. package/dist/utils/components.d.ts.map +1 -1
  240. package/dist/utils/components.js +1 -0
  241. package/dist/utils/components.js.map +1 -1
  242. package/dist/utils/extensions.js +1 -0
  243. package/dist/utils/extensions.js.map +1 -1
  244. package/dist/utils/http-definitions.js +1 -0
  245. package/dist/utils/http-definitions.js.map +1 -1
  246. package/dist/utils/http-operation.js +1 -0
  247. package/dist/utils/http-operation.js.map +1 -1
  248. package/dist/utils/info.js +1 -0
  249. package/dist/utils/info.js.map +1 -1
  250. package/dist/utils/model-state.js +1 -0
  251. package/dist/utils/model-state.js.map +1 -1
  252. package/dist/utils/powershell-comment.js +11 -10
  253. package/dist/utils/powershell-comment.js.map +1 -1
  254. package/dist/utils/programatic-operation.js +2 -2
  255. package/dist/utils/programatic-operation.js.map +1 -1
  256. package/dist/utils/resolve-conflicts.js +1 -0
  257. package/dist/utils/resolve-conflicts.js.map +1 -1
  258. package/dist/utils/schema.d.ts +4 -0
  259. package/dist/utils/schema.d.ts.map +1 -1
  260. package/dist/utils/schema.js +28 -0
  261. package/dist/utils/schema.js.map +1 -1
  262. package/dist/utils/security-scheme.js +1 -0
  263. package/dist/utils/security-scheme.js.map +1 -1
  264. package/dist/utils/uid.js +1 -0
  265. package/dist/utils/uid.js.map +1 -1
  266. package/package.json +6 -5
  267. package/readme.md +5 -1
  268. package/resources/assets/build-module.ps1 +9 -1
  269. package/resources/assets/create-model-cmdlets.ps1 +8 -5
  270. package/resources/assets/custom/README.md +1 -1
  271. package/resources/assets/docs/README.md +1 -1
  272. package/resources/assets/exports/README.md +1 -1
  273. package/resources/assets/generate-portal-ux.ps1 +379 -0
  274. package/resources/assets/how-to.md +1 -1
  275. package/resources/assets/internal/README.md +1 -1
  276. package/resources/assets/tools/Resources/docs/README.md +1 -1
  277. package/resources/assets/tools/Resources/how-to.md +1 -1
  278. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.nuspec +1 -1
  279. package/resources/modules/Az.Accounts/2.7.5/Az.Accounts.psd1 +1 -1
  280. package/resources/modules/Az.Accounts/2.7.5/Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml +34 -34
  281. package/resources/modules/Az.Accounts/2.7.5/en-US/about_az.help.txt +1 -1
  282. package/resources/modules/Az.Accounts/2.7.5/package/services/metadata/core-properties/1aa0749a068a4238881858013f1a5b7f.psmdcp +1 -1
  283. package/resources/psruntime/Attributes/ExternalDocsAttribute.cs +30 -0
  284. package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +39 -4
  285. package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +8 -2
  286. package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +6 -0
  287. package/resources/psruntime/BuildTime/PsAttributes.cs +7 -0
  288. package/resources/runtime/csharp/client/Context.cs +33 -0
  289. package/resources/runtime/csharp/client/InfoAttribute.cs +1 -0
  290. package/resources/runtime/csharp/client/InputHandler.cs +22 -0
  291. package/resources/runtime/csharp/pipeline/Events.cs +2 -2
  292. package/resources/templates/azureMethod.ejs +5 -0
  293. package/resources/templates/azureMethodGroup.ejs +46 -0
  294. package/resources/templates/azureServiceClient.ejs +80 -0
  295. package/resources/templates/enum.ejs +73 -0
  296. package/resources/templates/exception.ejs +52 -0
  297. package/resources/templates/extensionMethod.ejs +68 -0
  298. package/resources/templates/extensions.ejs +19 -0
  299. package/resources/templates/longRunningOperationMethod.ejs +43 -0
  300. package/resources/templates/method.ejs +65 -0
  301. package/resources/templates/methodBodyRestCall.ejs +317 -0
  302. package/resources/templates/methodGroupInterface.ejs +77 -0
  303. package/resources/templates/model.ejs +184 -0
  304. package/resources/templates/page.ejs +40 -0
  305. package/resources/templates/serviceClientBody.ejs +303 -0
  306. package/resources/templates/serviceClientInterface.ejs +55 -0
@@ -0,0 +1,80 @@
1
+ <%- project.commentHeader %>
2
+
3
+ namespace <%- project.namespace %>
4
+ {
5
+ using System.Linq;
6
+ using Microsoft.Rest;
7
+ <% project.model.usings.forEach(function(using){ -%>
8
+ using <%- using %>;
9
+ <% }); -%>
10
+
11
+ <% if (project.model.info.description) { -%>
12
+ /// <summary>
13
+ /// <%- project.model.info.description %>
14
+ /// </summary>
15
+ <% } -%>
16
+ <% var client = project.model.info.title -%>
17
+ public partial class <%- client %> : Microsoft.Rest.ServiceClient<<%- client %>>, I<%- client %>, IAzureClient
18
+ {
19
+ <%# ToDo: add ServiceClientBodyTemplate -%>
20
+ <%- include('serviceClientBody', {project: project}) -%>
21
+ /// <summary>
22
+ /// An optional partial-method to perform custom initialization.
23
+ /// </summary>
24
+ partial void CustomInitialize();
25
+
26
+ /// <summary>
27
+ /// Initializes client properties.
28
+ /// </summary>
29
+ private void Initialize()
30
+ {
31
+ <% project.model.operationGroups.forEach(function(methodGroup){ -%>
32
+ <% var key = methodGroup.$key == 'Operations' ? '' : methodGroup.$key-%>
33
+ this.<%- project.helper.PascalCase(methodGroup.$key) %> = new <%- project.helper.PascalCase(key) %>Operations(this);
34
+ <% }); -%>
35
+ this.BaseUri = new System.Uri("https://management.azure.com");
36
+ <% (project.model.globalParameters || []).filter(p => p.language.default.name != '$host' && !!p.clientDefaultValue).forEach(function(parameter){ -%>
37
+ this.<%- parameter.language.default.name %> = <%- parameter.schema.type == 'string' || (parameter.schema.type == 'constant' && parameter.schema.valueType.type == 'string') ? `"${parameter.clientDefaultValue}"`: parameter.clientDefaultValue %>;
38
+ <%}); -%>
39
+ SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
40
+ {
41
+ Formatting = Newtonsoft.Json.Formatting.Indented,
42
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
43
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
44
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
45
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
46
+ ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
47
+ Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
48
+ {
49
+ new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
50
+ }
51
+ };
52
+ <% if(project.needsTransformationConverter()) {-%>
53
+ SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter());
54
+ <% } -%>
55
+ DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
56
+ {
57
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
58
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
59
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
60
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
61
+ ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
62
+ Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
63
+ {
64
+ new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
65
+ }
66
+ };
67
+ <%# ToDo: need support for polymorphicType -%>
68
+ <%(project.model.schemas.objects||[]).filter(m => m.discriminator).forEach(function(m){-%>
69
+ SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter<<%-m.language.default.name%>>("<%-m.discriminator.property.serializedName%>"));
70
+ DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter<<%-m.language.default.name%>>("<%-m.discriminator.property.serializedName%>"));
71
+ <%});-%>
72
+ CustomInitialize();
73
+ <% if(project.needsTransformationConverter()) {-%>
74
+ DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter());
75
+ <% } -%>
76
+ DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter());
77
+ <%# ToDo: Add method whose group is empty, and need to check in which case the group is empty.-%>
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,73 @@
1
+ <%- project.commentHeader %>
2
+
3
+ namespace <%- project.namespace %>.Models
4
+ {
5
+
6
+ /// <summary>
7
+ /// Defines values for <%-model.language.default.name%>.
8
+ /// </summary>
9
+ <%#ToDo need to figure out when !Model.OldModelAsString is applied%>
10
+ <%#ToDo GetObsoleteAttribute%>
11
+ <% if (!model.extensions['x-ms-model-as-string']) { -%>
12
+ [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
13
+ public enum <%-model.language.default.name%>
14
+ {
15
+ <% var last = model.choices[model.choices.length - 1]-%>
16
+ <% model.choices.forEach(function(item) {
17
+ if (item.language.default.description) {
18
+ -%>
19
+ /// <summary>
20
+ /// <%-item.language.default.description%>
21
+ /// </summary>
22
+ <% } -%>
23
+ [System.Runtime.Serialization.EnumMember(Value = "<%-item.value%>")]
24
+ <% if (item == last) {-%>
25
+ <%-item.language.default.name.replace(/\//g, '-')%>
26
+ <% } else {-%>
27
+ <%-item.language.default.name.replace(/\//g, '-')%>,
28
+ <% }-%>
29
+ <% });-%>
30
+ }
31
+ internal static class <%-model.language.default.name%>EnumExtension
32
+ {
33
+ internal static string ToSerializedValue(this <%-model.language.default.name%>? value)
34
+ {
35
+ return value == null ? null : ((<%-model.language.default.name%>)value).ToSerializedValue();
36
+ }
37
+ internal static string ToSerializedValue(this <%-model.language.default.name%> value)
38
+ {
39
+ switch( value )
40
+ {
41
+ <% for (var i = 0; i < model.choices.length; i++) {-%>
42
+ case <%-model.language.default.name%>.<%-model.choices[i].language.default.name.replace(/\//g, '-')%>:
43
+ return "<%-model.choices[i].value%>";
44
+ <% }-%>
45
+ }
46
+ return null;
47
+ }
48
+ internal static <%-model.language.default.name%>? Parse<%-model.language.default.name%>(this string value)
49
+ {
50
+ switch( value )
51
+ {
52
+ <% for (var i = 0; i < model.choices.length; i++) {-%>
53
+ case "<%-model.choices[i].value%>":
54
+ return <%-model.language.default.name%>.<%-model.choices[i].language.default.name.replace(/\//g, '-')%>;
55
+ <% }-%>
56
+ }
57
+ return null;
58
+ }
59
+ }
60
+ <%} else {-%>
61
+ public static class <%-model.language.default.name%>
62
+ {
63
+ <%model.choices.forEach(function(choice){-%>
64
+ <%if(choice.language.default.description){-%>
65
+ /// <summary>
66
+ /// <%-choice.language.default.description%>
67
+ /// </summary>
68
+ <%}-%>
69
+ public const string <%-choice.language.default.name%> = "<%-choice.value%>";
70
+ <%});-%>
71
+ }
72
+ <% } -%>
73
+ }
@@ -0,0 +1,52 @@
1
+ <%- project.commentHeader %>
2
+
3
+ namespace <%- project.namespace %>.Models
4
+ {
5
+
6
+ /// <summary>
7
+ /// Exception thrown for an invalid response with <%-exception.schema.language.default.name%> information.
8
+ /// </summary>
9
+ public partial class <%-exception.schema.language.default.name%>Exception : Microsoft.Rest.RestException
10
+ {
11
+ /// <summary>
12
+ /// Gets information about the associated HTTP request.
13
+ /// </summary>
14
+ public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; }
15
+
16
+ /// <summary>
17
+ /// Gets information about the associated HTTP response.
18
+ /// </summary>
19
+ public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; }
20
+
21
+ /// <summary>
22
+ /// Gets or sets the body object.
23
+ /// </summary>
24
+ public <%-exception.schema.language.default.name%> Body { get; set; }
25
+
26
+ /// <summary>
27
+ /// Initializes a new instance of the <%-exception.schema.language.default.name%>Exception class.
28
+ /// </summary>
29
+ public <%-exception.schema.language.default.name%>Exception()
30
+ {
31
+ }
32
+
33
+ /// <summary>
34
+ /// Initializes a new instance of the <%-exception.schema.language.default.name%> class.
35
+ /// </summary>
36
+ /// <param name="message">The exception message.</param>
37
+ public <%-exception.schema.language.default.name%>Exception(string message)
38
+ : this(message, null)
39
+ {
40
+ }
41
+
42
+ /// <summary>
43
+ /// Initializes a new instance of the <%-exception.schema.language.default.name%> class.
44
+ /// </summary>
45
+ /// <param name="message">The exception message.</param>
46
+ /// <param name="innerException">Inner exception.</param>
47
+ public <%-exception.schema.language.default.name%>Exception(string message, System.Exception innerException)
48
+ : base(message, innerException)
49
+ {
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,68 @@
1
+ <% var key = methodGroup.$key == 'Operations' ? '' : methodGroup.$key-%>
2
+ <%# ToDo: currently assume the SyncMethodsGenerationMode is Essential type, and need to add support for other types -%>
3
+ /// <summary>
4
+ /// <%=method.language.default.description%>
5
+ <%# ToDo: add support for externaldocsurl -%>
6
+ /// </summary>
7
+ <%# ToDo: add <remarks> if there are both description and summary -%>
8
+ /// <param name='operations'>
9
+ /// The operations group for this extension method.
10
+ /// </param>
11
+ <% if(method.parameters && !method.language.default.pageable?.nextPageOperation) { method.parameters.filter(p => p.implementation != 'Client' && !project.helper.IsConstantParameter(p)).forEach(function (parameter) {-%>
12
+ /// <param name='<%-parameter.language.default.name%>'>
13
+ /// <%=parameter.language.default.description%>
14
+ /// </param>
15
+ <% });}-%>
16
+ <% if(method.language.default.pageable?.nextPageOperation) {-%>
17
+ /// <param name='nextPageLink'>
18
+ /// The NextLink from the previous successful call to List operation.
19
+ /// </param>
20
+ <% } -%>
21
+ <%# ToDo: add support for GetObsoleteAttribute-%>
22
+ <%# ToDo: add support for AccessModifier, assume public for the time being-%>
23
+ public static <%-method.language.default.returnType%> <%-method.language.default.name%>(this I<%-project.helper.PascalCase(key)%>Operations operations<%- method.language.default.syncMethodParameterDeclaration ? ', ' + method.language.default.syncMethodParameterDeclaration: '' %>)
24
+ {
25
+ <%# ToDo: need to handle different return type, body, header and the others including no return type-%>
26
+ <% if(method.language.default.returnType != 'void') {-%>
27
+ return ((I<%-project.helper.PascalCase(key)%>Operations)operations).<%-method.language.default.name%>Async(<%-method.language.default.syncMethodInvocationArgs%>).GetAwaiter().GetResult();
28
+ <% } else { -%>
29
+ ((I<%-project.helper.PascalCase(key)%>Operations)operations).<%-method.language.default.name%>Async(<%-method.language.default.syncMethodInvocationArgs%>).GetAwaiter().GetResult();
30
+ <% } -%>
31
+ }
32
+
33
+ /// <summary>
34
+ /// <%=method.language.default.description%>
35
+ <%# ToDo: add support for externaldocsurl -%>
36
+ /// </summary>
37
+ <%# ToDo: add <remarks> if there are both description and summary -%>
38
+ /// <param name='operations'>
39
+ /// The operations group for this extension method.
40
+ /// </param>
41
+ <% if(method.parameters && !method.language.default.pageable?.nextPageOperation) { method.parameters.filter(p => p.implementation != 'Client' && !project.helper.IsConstantParameter(p)).forEach(function (parameter) {-%>
42
+ /// <param name='<%-parameter.language.default.name%>'>
43
+ /// <%=parameter.language.default.description%>
44
+ /// </param>
45
+ <% });}-%>
46
+ <% if(method.language.default.pageable?.nextPageOperation) {-%>
47
+ /// <param name='nextPageLink'>
48
+ /// The NextLink from the previous successful call to List operation.
49
+ /// </param>
50
+ <% } -%>
51
+ /// <param name='cancellationToken'>
52
+ /// The cancellation token.
53
+ /// </param>
54
+ <%# ToDo: add support for GetObsoleteAttribute-%>
55
+ <%# ToDo: add support for AccessModifier, assume public for the time being-%>
56
+ public static async System.Threading.Tasks.Task<%- method.language.default.returnType != 'void' ? '<' + method.language.default.returnType + '>' : ''%> <%-method.language.default.name%>Async(this I<%-project.helper.PascalCase(key)%>Operations operations<%- method.language.default.asyncMethodParameterDeclaration ? ', ' + method.language.default.asyncMethodParameterDeclaration: '' %>)
57
+ {
58
+ <%# ToDo: need to handle different return type, body, header and the others including no return type-%>
59
+ <% if(method.language.default.returnType != 'void') {-%>
60
+ <%# ToDo: add support for primitive return-%>
61
+ using (var _result = await operations.<%-method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodInvocationArgs%>).ConfigureAwait(false))
62
+ {
63
+ return <%- method.language.default.responseType.startsWith('Microsoft.Rest.Azure.AzureOperationResponse') ? '_result.Body' : '_result.Headers'%>;
64
+ }
65
+ <% } else { -%>
66
+ (await operations.<%-method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodInvocationArgs%>).ConfigureAwait(false)).Dispose();
67
+ <% }-%>
68
+ }
@@ -0,0 +1,19 @@
1
+ <%- project.commentHeader %>
2
+ <% var key = methodGroup.$key == 'Operations' ? '' : methodGroup.$key-%>
3
+ namespace <%- project.namespace %>
4
+ {
5
+ <% project.model.usings.forEach(function(using){ -%>
6
+ using <%- using %>;
7
+ <% }); -%>
8
+
9
+ /// <summary>
10
+ /// Extension methods for <%- project.helper.PascalCase(key) %>Operations
11
+ /// </summary>
12
+ public static partial class <%- project.helper.PascalCase(key) %>OperationsExtensions
13
+ {
14
+ <% methodGroup.operations.forEach(function(method){ -%>
15
+ <%# ToDo: add support for ExcludeFromInterface-%>
16
+ <%- include('extensionMethod', {method: method, group: methodGroup, project: project}) %>
17
+ <% }); -%>
18
+ }
19
+ }
@@ -0,0 +1,43 @@
1
+ <% if (method.language.default.description) {-%>
2
+ /// <summary>
3
+ /// <%= method.language.default.description%>
4
+ <%# ToDo: add externaldocsurl -%>
5
+ /// </summary>
6
+ <% };-%>
7
+ <%# ToDo: add remark if both description and summary is provided, question here is in m4, there is no summary provided-%>
8
+ <% if(method.parameters&&!method.language.default.pageable?.nextPageOperation) { method.parameters.filter(p => p.implementation != 'Client' && !project.helper.IsConstantParameter(p)).forEach(function (parameter) {-%>
9
+ <%# ToDo: should use camel name instead of pascal name here -%>
10
+ /// <param name='<%-parameter.language.default.name%>'>
11
+ /// <%=parameter.language.default.description%>
12
+ /// </param>
13
+ <% });}-%>
14
+ <% (method.requests[0].parameters || []).filter(p=>p.protocol.http.in == 'body' && !project.helper.IsConstantParameter(p)).forEach(function(parameter){-%>
15
+ <%if(parameter.extensions && parameter.extensions['x-ms-client-flatten'] ) {-%>
16
+ <%project.helper.GetAllPublicVirtualProperties(parameter.schema.language.default.virtualProperties).filter(p => !project.helper.IsConstantProperty(p)).forEach(function(vp) {-%>
17
+ /// <param name='<%-vp.property.language.default.name%>'>
18
+ /// <%= vp.property.language.default.description%>
19
+ /// </param>
20
+ <%});-%>
21
+ <%} else {-%>
22
+ /// <param name='<%-parameter.language.default.name%>'>
23
+ /// <%= parameter.language.default.description%>
24
+ /// </param>
25
+ <%}-%>
26
+ <% });-%>
27
+ <% if(method.language.default.pageable?.nextPageOperation) {-%>
28
+ /// <param name='nextPageLink'>
29
+ /// The NextLink from the previous successful call to List operation.
30
+ /// </param>
31
+ <% } -%>
32
+ /// <param name='customHeaders'>
33
+ /// Headers that will be added to request.
34
+ /// </param>
35
+ /// <param name='cancellationToken'>
36
+ /// The cancellation token.
37
+ /// </param>
38
+ public async System.Threading.Tasks.Task<<%-method.language.default.responseType%>> <%-method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodParameterDeclarationWithCustomHeader%>)
39
+ {
40
+ // Send Request
41
+ <%-method.language.default.responseType%> _response = await Begin<%-method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodInvocationArgsWithCustomerHeaders%>).ConfigureAwait(false);
42
+ return await this.Client.<%-(method.requests[0].protocol.http.method == 'put' || method.requests[0].protocol.http.method == 'patch')?'GetPutOrPatch':(method.requests[0].protocol.http.method == 'post' || method.requests[0].protocol.http.method == 'delete')?'GetPostOrDelete':''%>OperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
43
+ }
@@ -0,0 +1,65 @@
1
+ <% if (method.language.default.description) {-%>
2
+ /// <summary>
3
+ /// <%= method.language.default.description%>
4
+ <%# ToDo: add externaldocsurl -%>
5
+ /// </summary>
6
+ <% };-%>
7
+ <%# ToDo: add remark if both description and summary is provided, question here is in m4, there is no summary provided-%>
8
+ <% if(method.parameters&&!method.language.default.pageable?.nextPageOperation) { method.parameters.filter(p => p.implementation != 'Client' && !project.helper.IsConstantParameter(p)).forEach(function (parameter) {-%>
9
+ <%# ToDo: should use camel name instead of pascal name here -%>
10
+ /// <param name='<%-parameter.language.default.name%>'>
11
+ /// <%=parameter.language.default.description%>
12
+ /// </param>
13
+ <% });}-%>
14
+ <% (method.requests[0].parameters || []).filter(p=>p.protocol.http.in == 'body' && !project.helper.IsConstantParameter(p)).forEach(function(parameter){-%>
15
+ <%if(parameter.extensions && parameter.extensions['x-ms-client-flatten'] ) {-%>
16
+ <%project.helper.GetAllPublicVirtualProperties(parameter.schema.language.default.virtualProperties).filter(p => !project.helper.IsConstantProperty(p)).forEach(function(vp) {-%>
17
+ /// <param name='<%-vp.property.language.default.name%>'>
18
+ /// <%= vp.property.language.default.description%>
19
+ /// </param>
20
+ <%});-%>
21
+ <%} else {-%>
22
+ /// <param name='<%-parameter.language.default.name%>'>
23
+ /// <%= parameter.language.default.description%>
24
+ /// </param>
25
+ <%}-%>
26
+ <% });-%>
27
+ <% if(method.language.default.pageable?.nextPageOperation) {-%>
28
+ /// <param name='nextPageLink'>
29
+ /// The NextLink from the previous successful call to List operation.
30
+ /// </param>
31
+ <% } -%>
32
+ /// <param name='customHeaders'>
33
+ /// Headers that will be added to request.
34
+ /// </param>
35
+ /// <param name='cancellationToken'>
36
+ /// The cancellation token.
37
+ /// </param>
38
+ /// <exception cref="Microsoft.Rest.Azure.CloudException">
39
+ /// Thrown when the operation returned an invalid status code
40
+ /// </exception>
41
+ <% if ((method.responses || []).filter(p => p.schema).length > 0) {-%>
42
+ /// <exception cref="Microsoft.Rest.SerializationException">
43
+ /// Thrown when unable to deserialize the response
44
+ /// </exception>
45
+ <% };-%>
46
+ <%# ToDo: add isnullable check -%>
47
+ <% if (method.parameters.filter(p => p.schema.type != 'constant' && p.required)) {-%>
48
+ /// <exception cref="Microsoft.Rest.ValidationException">
49
+ /// Thrown when a required parameter is null
50
+ /// </exception>
51
+ /// <exception cref="System.ArgumentNullException">
52
+ /// Thrown when a required parameter is null
53
+ /// </exception>
54
+ <% };-%>
55
+ /// <return>
56
+ /// A response object containing the response body and response headers.
57
+ /// </return>
58
+ <%# ToDo: add GetObsoleteAttribute -%>
59
+ <%# ToDo: need to check in which case the method is not public(AccessModifier), currently set it to public -%>
60
+ public async System.Threading.Tasks.Task<<%-method.language.default.responseType%>> <%-method.language.default.name%>WithHttpMessagesAsync(<%-method.language.default.asyncMethodParameterDeclarationWithCustomHeader%>)
61
+ {
62
+ <%# ToDo: add support for method.Flavor, currently assume it is RestCall -%>
63
+
64
+ <%- include('methodBodyRestCall', {method: method}) -%>
65
+ }