@autorest/powershell 3.0.504 → 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.
- package/.rush/temp/package-deps_build.json +95 -61
- package/.rush/temp/shrinkwrap-deps.json +249 -193
- package/autorest-configuration-for-sdk.md +122 -0
- package/autorest-configuration.md +2 -1
- package/dist/cmdlets/class.d.ts +1 -0
- package/dist/cmdlets/class.d.ts.map +1 -1
- package/dist/cmdlets/class.js +220 -90
- package/dist/cmdlets/class.js.map +1 -1
- package/dist/cmdlets/namespace.d.ts.map +1 -1
- package/dist/cmdlets/namespace.js +3 -1
- package/dist/cmdlets/namespace.js.map +1 -1
- package/dist/cmdlets/parameter.js +1 -0
- package/dist/cmdlets/parameter.js.map +1 -1
- package/dist/enums/namespace.js +2 -1
- package/dist/enums/namespace.js.map +1 -1
- package/dist/file-formats/md-file.js +1 -0
- package/dist/file-formats/md-file.js.map +1 -1
- package/dist/file-formats/psd-file.js +1 -0
- package/dist/file-formats/psd-file.js.map +1 -1
- package/dist/file-formats/psscript-file.js +1 -0
- package/dist/file-formats/psscript-file.js.map +1 -1
- package/dist/generators/csproj.js +1 -0
- package/dist/generators/csproj.js.map +1 -1
- package/dist/generators/gitattributes.js +1 -0
- package/dist/generators/gitattributes.js.map +1 -1
- package/dist/generators/gitignore.js +1 -0
- package/dist/generators/gitignore.js.map +1 -1
- package/dist/generators/inputhandler.custom.d.ts +3 -0
- package/dist/generators/inputhandler.custom.d.ts.map +1 -0
- package/dist/generators/inputhandler.custom.js +33 -0
- package/dist/generators/inputhandler.custom.js.map +1 -0
- package/dist/generators/nuspec.js +1 -0
- package/dist/generators/nuspec.js.map +1 -1
- package/dist/generators/psm1.custom.js +1 -0
- package/dist/generators/psm1.custom.js.map +1 -1
- package/dist/generators/psm1.internal.js +1 -0
- package/dist/generators/psm1.internal.js.map +1 -1
- package/dist/generators/psm1.js +2 -1
- package/dist/generators/psm1.js.map +1 -1
- package/dist/generators/readme.js +1 -0
- package/dist/generators/readme.js.map +1 -1
- package/dist/generators/script-cmdlet.js +3 -2
- package/dist/generators/script-cmdlet.js.map +1 -1
- package/dist/internal/name-inferrer.js +1 -0
- package/dist/internal/name-inferrer.js.map +1 -1
- package/dist/internal/powershell-declarations.d.ts +3 -0
- package/dist/internal/powershell-declarations.d.ts.map +1 -1
- package/dist/internal/powershell-declarations.js +3 -0
- package/dist/internal/powershell-declarations.js.map +1 -1
- package/dist/internal/project.d.ts +11 -9
- package/dist/internal/project.d.ts.map +1 -1
- package/dist/internal/project.js +30 -12
- package/dist/internal/project.js.map +1 -1
- package/dist/internal/state.js +1 -0
- package/dist/internal/state.js.map +1 -1
- package/dist/internal/verbs.js +1 -0
- package/dist/internal/verbs.js.map +1 -1
- package/dist/llcsharp/clientruntime.d.ts +7 -1
- package/dist/llcsharp/clientruntime.d.ts.map +1 -1
- package/dist/llcsharp/clientruntime.js +8 -1
- package/dist/llcsharp/clientruntime.js.map +1 -1
- package/dist/llcsharp/code-model.d.ts +1 -0
- package/dist/llcsharp/code-model.d.ts.map +1 -1
- package/dist/llcsharp/csharp-declarations.js +1 -0
- package/dist/llcsharp/csharp-declarations.js.map +1 -1
- package/dist/llcsharp/enums/enum.js +2 -1
- package/dist/llcsharp/enums/enum.js.map +1 -1
- package/dist/llcsharp/enums/namespace.js +1 -0
- package/dist/llcsharp/enums/namespace.js.map +1 -1
- package/dist/llcsharp/exports.js +23 -13
- package/dist/llcsharp/exports.js.map +1 -1
- package/dist/llcsharp/generator.js +1 -0
- package/dist/llcsharp/generator.js.map +1 -1
- package/dist/llcsharp/messages.js +1 -0
- package/dist/llcsharp/messages.js.map +1 -1
- package/dist/llcsharp/model/idictionary.js +1 -0
- package/dist/llcsharp/model/idictionary.js.map +1 -1
- package/dist/llcsharp/model/interface.d.ts +3 -2
- package/dist/llcsharp/model/interface.d.ts.map +1 -1
- package/dist/llcsharp/model/interface.js +14 -8
- package/dist/llcsharp/model/interface.js.map +1 -1
- package/dist/llcsharp/model/model-class-dictionary.js +1 -0
- package/dist/llcsharp/model/model-class-dictionary.js.map +1 -1
- package/dist/llcsharp/model/model-class-json.d.ts.map +1 -1
- package/dist/llcsharp/model/model-class-json.js +25 -3
- package/dist/llcsharp/model/model-class-json.js.map +1 -1
- package/dist/llcsharp/model/model-class-serializer.js +1 -0
- package/dist/llcsharp/model/model-class-serializer.js.map +1 -1
- package/dist/llcsharp/model/model-class.js +10 -9
- package/dist/llcsharp/model/model-class.js.map +1 -1
- package/dist/llcsharp/model/namespace.js +1 -0
- package/dist/llcsharp/model/namespace.js.map +1 -1
- package/dist/llcsharp/model/property.js +1 -0
- package/dist/llcsharp/model/property.js.map +1 -1
- package/dist/llcsharp/operation/api-class.js +1 -0
- package/dist/llcsharp/operation/api-class.js.map +1 -1
- package/dist/llcsharp/operation/method.d.ts +3 -1
- package/dist/llcsharp/operation/method.d.ts.map +1 -1
- package/dist/llcsharp/operation/method.js +30 -28
- package/dist/llcsharp/operation/method.js.map +1 -1
- package/dist/llcsharp/operation/namespace.js +1 -0
- package/dist/llcsharp/operation/namespace.js.map +1 -1
- package/dist/llcsharp/operation/parameter.js +1 -0
- package/dist/llcsharp/operation/parameter.js.map +1 -1
- package/dist/llcsharp/project.d.ts.map +1 -1
- package/dist/llcsharp/project.js +3 -1
- package/dist/llcsharp/project.js.map +1 -1
- package/dist/llcsharp/schema/Uuid.js +1 -0
- package/dist/llcsharp/schema/Uuid.js.map +1 -1
- package/dist/llcsharp/schema/array.js +1 -0
- package/dist/llcsharp/schema/array.js.map +1 -1
- package/dist/llcsharp/schema/binary.js +1 -0
- package/dist/llcsharp/schema/binary.js.map +1 -1
- package/dist/llcsharp/schema/boolean.js +1 -0
- package/dist/llcsharp/schema/boolean.js.map +1 -1
- package/dist/llcsharp/schema/byte-array.js +1 -0
- package/dist/llcsharp/schema/byte-array.js.map +1 -1
- package/dist/llcsharp/schema/char.js +1 -0
- package/dist/llcsharp/schema/char.js.map +1 -1
- package/dist/llcsharp/schema/date-time.d.ts.map +1 -1
- package/dist/llcsharp/schema/date-time.js +1 -0
- package/dist/llcsharp/schema/date-time.js.map +1 -1
- package/dist/llcsharp/schema/date.js +1 -0
- package/dist/llcsharp/schema/date.js.map +1 -1
- package/dist/llcsharp/schema/duration.js +1 -0
- package/dist/llcsharp/schema/duration.js.map +1 -1
- package/dist/llcsharp/schema/enum.d.ts +1 -5
- package/dist/llcsharp/schema/enum.d.ts.map +1 -1
- package/dist/llcsharp/schema/enum.js +1 -9
- package/dist/llcsharp/schema/enum.js.map +1 -1
- package/dist/llcsharp/schema/integer.js +1 -0
- package/dist/llcsharp/schema/integer.js.map +1 -1
- package/dist/llcsharp/schema/object.js +2 -1
- package/dist/llcsharp/schema/object.js.map +1 -1
- package/dist/llcsharp/schema/password.js +2 -1
- package/dist/llcsharp/schema/password.js.map +1 -1
- package/dist/llcsharp/schema/primitive.js +1 -0
- package/dist/llcsharp/schema/primitive.js.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.d.ts +2 -3
- package/dist/llcsharp/schema/schema-resolver.d.ts.map +1 -1
- package/dist/llcsharp/schema/schema-resolver.js +4 -0
- package/dist/llcsharp/schema/schema-resolver.js.map +1 -1
- package/dist/llcsharp/schema/string.d.ts.map +1 -1
- package/dist/llcsharp/schema/string.js +1 -0
- package/dist/llcsharp/schema/string.js.map +1 -1
- package/dist/llcsharp/schema/uri.d.ts +10 -0
- package/dist/llcsharp/schema/uri.d.ts.map +1 -0
- package/dist/llcsharp/schema/uri.js +25 -0
- package/dist/llcsharp/schema/uri.js.map +1 -0
- package/dist/llcsharp/validations.js +1 -0
- package/dist/llcsharp/validations.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -0
- package/dist/main.js.map +1 -1
- package/dist/models/model-extensions.js +7 -6
- package/dist/models/model-extensions.js.map +1 -1
- package/dist/module/module-class.js +2 -1
- package/dist/module/module-class.js.map +1 -1
- package/dist/module/module-namespace.js +1 -0
- package/dist/module/module-namespace.js.map +1 -1
- package/dist/plugins/add-azure-completers-v2.js +1 -0
- package/dist/plugins/add-azure-completers-v2.js.map +1 -1
- package/dist/plugins/create-commands-v2.d.ts.map +1 -1
- package/dist/plugins/create-commands-v2.js +18 -21
- package/dist/plugins/create-commands-v2.js.map +1 -1
- package/dist/plugins/cs-namer-v2.d.ts.map +1 -1
- package/dist/plugins/cs-namer-v2.js +9 -3
- package/dist/plugins/cs-namer-v2.js.map +1 -1
- package/dist/plugins/llcsharp-v2.js +1 -0
- package/dist/plugins/llcsharp-v2.js.map +1 -1
- package/dist/plugins/modifiers-v2.d.ts +4 -0
- package/dist/plugins/modifiers-v2.d.ts.map +1 -1
- package/dist/plugins/modifiers-v2.js +69 -13
- package/dist/plugins/modifiers-v2.js.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.d.ts.map +1 -1
- package/dist/plugins/plugin-create-inline-properties.js +51 -4
- package/dist/plugins/plugin-create-inline-properties.js.map +1 -1
- package/dist/plugins/plugin-tweak-m4-model.js +4 -3
- package/dist/plugins/plugin-tweak-m4-model.js.map +1 -1
- package/dist/plugins/plugin-tweak-model-azure-v2.js +4 -3
- package/dist/plugins/plugin-tweak-model-azure-v2.js.map +1 -1
- package/dist/plugins/plugin-tweak-model.js +15 -14
- package/dist/plugins/plugin-tweak-model.js.map +1 -1
- package/dist/plugins/powershell-v2.d.ts.map +1 -1
- package/dist/plugins/powershell-v2.js +7 -2
- package/dist/plugins/powershell-v2.js.map +1 -1
- package/dist/plugins/ps-namer-v2.js +1 -0
- package/dist/plugins/ps-namer-v2.js.map +1 -1
- package/dist/plugins/sdk-create-inline-properties.d.ts +4 -0
- package/dist/plugins/sdk-create-inline-properties.d.ts.map +1 -0
- package/dist/plugins/sdk-create-inline-properties.js +552 -0
- package/dist/plugins/sdk-create-inline-properties.js.map +1 -0
- package/dist/plugins/sdk-cs-namer.d.ts +3 -0
- package/dist/plugins/sdk-cs-namer.d.ts.map +1 -0
- package/dist/plugins/sdk-cs-namer.js +385 -0
- package/dist/plugins/sdk-cs-namer.js.map +1 -0
- package/dist/plugins/sdk-cs-simplifier.d.ts +3 -0
- package/dist/plugins/sdk-cs-simplifier.d.ts.map +1 -0
- package/dist/plugins/sdk-cs-simplifier.js +154 -0
- package/dist/plugins/sdk-cs-simplifier.js.map +1 -0
- package/dist/plugins/sdk-generate.d.ts +3 -0
- package/dist/plugins/sdk-generate.d.ts.map +1 -0
- package/dist/plugins/sdk-generate.js +106 -0
- package/dist/plugins/sdk-generate.js.map +1 -0
- package/dist/plugins/sdk-tweak-model.d.ts +3 -0
- package/dist/plugins/sdk-tweak-model.d.ts.map +1 -0
- package/dist/plugins/sdk-tweak-model.js +357 -0
- package/dist/plugins/sdk-tweak-model.js.map +1 -0
- package/dist/sdk/project.d.ts +45 -0
- package/dist/sdk/project.d.ts.map +1 -0
- package/dist/sdk/project.js +56 -0
- package/dist/sdk/project.js.map +1 -0
- package/dist/sdk/state.d.ts +23 -0
- package/dist/sdk/state.d.ts.map +1 -0
- package/dist/sdk/state.js +28 -0
- package/dist/sdk/state.js.map +1 -0
- package/dist/sdk/utility.d.ts +32 -0
- package/dist/sdk/utility.d.ts.map +1 -0
- package/dist/sdk/utility.js +414 -0
- package/dist/sdk/utility.js.map +1 -0
- package/dist/utils/PwshModel.js +1 -0
- package/dist/utils/PwshModel.js.map +1 -1
- package/dist/utils/SdkModel.d.ts +7 -0
- package/dist/utils/SdkModel.d.ts.map +1 -0
- package/dist/utils/SdkModel.js +17 -0
- package/dist/utils/SdkModel.js.map +1 -0
- package/dist/utils/TrieNode.d.ts +10 -0
- package/dist/utils/TrieNode.d.ts.map +1 -0
- package/dist/utils/TrieNode.js +45 -0
- package/dist/utils/TrieNode.js.map +1 -0
- package/dist/utils/WrapComments.d.ts +2 -0
- package/dist/utils/WrapComments.d.ts.map +1 -0
- package/dist/utils/WrapComments.js +46 -0
- package/dist/utils/WrapComments.js.map +1 -0
- package/dist/utils/code-namer.d.ts +3 -0
- package/dist/utils/code-namer.d.ts.map +1 -0
- package/dist/utils/code-namer.js +38 -0
- package/dist/utils/code-namer.js.map +1 -0
- package/dist/utils/command-operation.d.ts +7 -0
- package/dist/utils/command-operation.d.ts.map +1 -1
- package/dist/utils/command-operation.js +8 -2
- package/dist/utils/command-operation.js.map +1 -1
- package/dist/utils/components.d.ts +2 -0
- package/dist/utils/components.d.ts.map +1 -1
- package/dist/utils/components.js +1 -0
- package/dist/utils/components.js.map +1 -1
- package/dist/utils/extensions.js +1 -0
- package/dist/utils/extensions.js.map +1 -1
- package/dist/utils/http-definitions.js +1 -0
- package/dist/utils/http-definitions.js.map +1 -1
- package/dist/utils/http-operation.js +1 -0
- package/dist/utils/http-operation.js.map +1 -1
- package/dist/utils/info.js +1 -0
- package/dist/utils/info.js.map +1 -1
- package/dist/utils/model-state.js +1 -0
- package/dist/utils/model-state.js.map +1 -1
- package/dist/utils/powershell-comment.js +11 -10
- package/dist/utils/powershell-comment.js.map +1 -1
- package/dist/utils/programatic-operation.js +2 -2
- package/dist/utils/programatic-operation.js.map +1 -1
- package/dist/utils/resolve-conflicts.js +1 -0
- package/dist/utils/resolve-conflicts.js.map +1 -1
- package/dist/utils/schema.d.ts +13 -0
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +39 -0
- package/dist/utils/schema.js.map +1 -1
- package/dist/utils/security-scheme.js +1 -0
- package/dist/utils/security-scheme.js.map +1 -1
- package/dist/utils/uid.js +1 -0
- package/dist/utils/uid.js.map +1 -1
- package/package.json +8 -7
- package/readme.md +5 -1
- package/resources/assets/build-module.ps1 +9 -5
- package/resources/assets/create-model-cmdlets.ps1 +14 -2
- package/resources/assets/generate-portal-ux.ps1 +379 -0
- package/resources/assets/tools/Resources/custom/New-AzDeployment.ps1 +2 -2
- package/resources/psruntime/Attributes/ExternalDocsAttribute.cs +30 -0
- package/resources/psruntime/BuildTime/Cmdlets/ExportPsd1.cs +1 -1
- package/resources/psruntime/BuildTime/Models/PsMarkdownTypes.cs +39 -4
- package/resources/psruntime/BuildTime/Models/PsProxyOutputs.cs +10 -4
- package/resources/psruntime/BuildTime/Models/PsProxyTypes.cs +6 -0
- package/resources/psruntime/BuildTime/PsAttributes.cs +7 -0
- package/resources/psruntime/BuildTime/PsHelpers.cs +1 -2
- package/resources/psruntime/MessageAttributeHelper.cs +1 -5
- package/resources/runtime/csharp/client/Context.cs +33 -0
- package/resources/runtime/csharp/client/InfoAttribute.cs +4 -0
- package/resources/runtime/csharp/client/InputHandler.cs +22 -0
- package/resources/runtime/csharp/client/SerializationMode.cs +5 -3
- package/resources/runtime/csharp/pipeline/Events.cs +2 -2
- package/resources/runtime/csharp/pipeline/PipelineMocking.cs +1 -1
- package/resources/runtime/csharp/xml/IXmlSerializable.cs +2 -2
- package/resources/templates/azureMethod.ejs +5 -0
- package/resources/templates/azureMethodGroup.ejs +46 -0
- package/resources/templates/azureServiceClient.ejs +80 -0
- package/resources/templates/enum.ejs +73 -0
- package/resources/templates/exception.ejs +52 -0
- package/resources/templates/extensionMethod.ejs +68 -0
- package/resources/templates/extensions.ejs +19 -0
- package/resources/templates/longRunningOperationMethod.ejs +43 -0
- package/resources/templates/method.ejs +65 -0
- package/resources/templates/methodBodyRestCall.ejs +317 -0
- package/resources/templates/methodGroupInterface.ejs +77 -0
- package/resources/templates/model.ejs +184 -0
- package/resources/templates/page.ejs +40 -0
- package/resources/templates/serviceClientBody.ejs +303 -0
- package/resources/templates/serviceClientInterface.ejs +55 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>.Models
|
|
4
|
+
{
|
|
5
|
+
using System.Linq;
|
|
6
|
+
|
|
7
|
+
<%# ToDo: need to populate effectiveDocumentation in the model-%>
|
|
8
|
+
<% if (model.language.default.description) {-%>
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// <%=wrapComments(' ', '/// ', model.language.default.description)%>
|
|
11
|
+
/// </summary>
|
|
12
|
+
<% }-%>
|
|
13
|
+
<% if (model.summary && model.language.default.description) { -%>
|
|
14
|
+
/// <remarks>
|
|
15
|
+
/// <%=wrapComments(' ', '/// ', model.language.default.description)%>
|
|
16
|
+
/// </remarks>
|
|
17
|
+
<% } -%>
|
|
18
|
+
<%# ToDo: support NeedsPolymorphicConverter-%>
|
|
19
|
+
<% if (model.discriminatorValue || model.discriminator) {-%>
|
|
20
|
+
[Newtonsoft.Json.JsonObject("<%-model.discriminatorValue || project.helper.PascalCase(model.language.default.name)%>")]
|
|
21
|
+
<% } -%>
|
|
22
|
+
<% if(project.helper.NeedsTransformationConverter(model)) {-%>
|
|
23
|
+
[Microsoft.Rest.Serialization.JsonTransformation]
|
|
24
|
+
<% }-%>
|
|
25
|
+
<%# ToDo: support ObsoleteAttribute-%>
|
|
26
|
+
public partial class <%-model.language.default.name%><%- (model.extensions && model.extensions["x-ms-azure-resource"]) ? " : Microsoft.Rest.Azure.IResource": (model.parents && model.parents.immediate.length == 1) ? " : " + model.parents.immediate[0].language.default.name: ""%>
|
|
27
|
+
{
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Initializes a new instance of the <%= model.language.default.name%> class.
|
|
30
|
+
/// </summary>
|
|
31
|
+
public <%- model.language.default.name%>()
|
|
32
|
+
{
|
|
33
|
+
<%#support for object model that contains ContainsConstantProperties-%>
|
|
34
|
+
<% if (model.properties || model.parents) {-%>
|
|
35
|
+
<%project.helper.GetAllPublicVirtualProperties(model.language.default.virtualProperties).filter(p => p.required && p.property.schema.type === 'object' && project.helper.HasConstantProperty(p.property.schema)).forEach(function(p) {-%>
|
|
36
|
+
this.<%-p.name%> = new <%-p.property.schema.language.csharp.fullname%>();
|
|
37
|
+
<%});-%>
|
|
38
|
+
<%}-%>
|
|
39
|
+
CustomInit();
|
|
40
|
+
}
|
|
41
|
+
<%#ToDo support for constructorParameters in the model, the constructorParameter is mapped to properties for the time being%>
|
|
42
|
+
<% if ((model.properties || []).filter(p => !p.isDiscriminator).length > 0 || model.parents) {-%>
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// Initializes a new instance of the <%=model.language.default.name%> class.
|
|
45
|
+
/// </summary>
|
|
46
|
+
<%project.helper.GetAllPublicVirtualProperties(model.language.default.virtualProperties).filter(p => !project.helper.IsConstantProperty(p)).forEach(function(p) {-%>
|
|
47
|
+
<%
|
|
48
|
+
var additionInfo = '';
|
|
49
|
+
if (p.property.schema.type == 'sealed-choice' || p.property.schema.type == 'choice')
|
|
50
|
+
{
|
|
51
|
+
additionInfo = ' Possible values include: ';
|
|
52
|
+
choices = p.property.schema.choices.map(c => `'${c.value}'`);
|
|
53
|
+
additionInfo = additionInfo + choices.join(', ');
|
|
54
|
+
}
|
|
55
|
+
%>
|
|
56
|
+
/// <param name="<%-project.helper.CamelCase(p.name)%>"><%=wrapComments(' ', '/// ', p.property.language.default.description)%>
|
|
57
|
+
/// <%-wrapComments(' ', '/// ', additionInfo)%></param>
|
|
58
|
+
<%});-%>
|
|
59
|
+
public <%- model.language.default.name%>(<%-model.language.default.constructorParametersDeclaration%>)
|
|
60
|
+
<%# If there is only one direct parent, will implement it as parent%>
|
|
61
|
+
<% var publicVirtualProperties = project.helper.GetAllPublicVirtualProperties(model.language.default.virtualProperties);
|
|
62
|
+
if (model.language.default.baseConstructorCall) {
|
|
63
|
+
publicVirtualProperties = project.helper.GetAllPublicVirtualPropertiesWithoutInherited(model.language.default.virtualProperties);
|
|
64
|
+
-%>
|
|
65
|
+
: <%-model.language.default.baseConstructorCall%>
|
|
66
|
+
<%}-%>
|
|
67
|
+
{
|
|
68
|
+
<%#ToDo support for InstanceProperties in the model, non const properties, priority 0-%>
|
|
69
|
+
<%publicVirtualProperties.filter(p => !project.helper.IsConstantProperty(p)).forEach(function(p) {-%>
|
|
70
|
+
this.<%-p.name%> = <%-project.helper.CamelCase(p.name)%>;
|
|
71
|
+
<%});-%>
|
|
72
|
+
CustomInit();
|
|
73
|
+
}
|
|
74
|
+
<% };-%>
|
|
75
|
+
<%#Below is support for ClassProperties in the model, const properties-%>
|
|
76
|
+
<% const constantProperties = (publicVirtualProperties || []).filter(p => p.property.schema.type === 'constant' || project.helper.IsConstantProperty(p));
|
|
77
|
+
if (constantProperties.length > 0) {-%>
|
|
78
|
+
/// <summary>
|
|
79
|
+
/// Static constructor for <%-model.language.default.name%> class.
|
|
80
|
+
/// </summary>
|
|
81
|
+
static <%-model.language.default.name%>()
|
|
82
|
+
{
|
|
83
|
+
<% constantProperties.forEach(function(p) {
|
|
84
|
+
const quote = p.property.schema.choiceType.type !== 'string' ? '' : '"';
|
|
85
|
+
-%>
|
|
86
|
+
<%-p.name%> = <%-quote + p.property.schema.choices[0].value + quote%>;
|
|
87
|
+
<%});-%>
|
|
88
|
+
}
|
|
89
|
+
<% } -%>
|
|
90
|
+
|
|
91
|
+
/// <summary>
|
|
92
|
+
/// An initialization method that performs custom operations like setting defaults
|
|
93
|
+
/// </summary>
|
|
94
|
+
partial void CustomInit();
|
|
95
|
+
|
|
96
|
+
<%#ToDo support for InstanceProperties in the model, non const properties, priority 0, line 407-%>
|
|
97
|
+
<% (publicVirtualProperties || []).filter(p => p.property.schema.type != 'constant' && !project.helper.IsConstantProperty(p)).forEach(function(p){-%>
|
|
98
|
+
<%
|
|
99
|
+
var additionInfo = '';
|
|
100
|
+
if (p.property.schema.type == 'sealed-choice' || p.property.schema.type == 'choice')
|
|
101
|
+
{
|
|
102
|
+
additionInfo = ' Possible values include: ';
|
|
103
|
+
choices = p.property.schema.choices.map(c => `'${c.value}'`);
|
|
104
|
+
additionInfo = additionInfo + choices.join(', ');
|
|
105
|
+
}
|
|
106
|
+
%>
|
|
107
|
+
/// <summary>
|
|
108
|
+
/// <%=wrapComments(' ', '/// ', p.property.language.csharp.formattedPropertySummary)%><%=additionInfo%>
|
|
109
|
+
/// </summary>
|
|
110
|
+
<% (p.property.schema.language.csharp.jsonConverters || []).forEach(function(ct) {-%>
|
|
111
|
+
[Newtonsoft.Json.JsonConverter(typeof(<%-ct%>))]
|
|
112
|
+
<% });-%>
|
|
113
|
+
<% if (model.extensions && model.extensions['x-ms-parameter-grouping']) {-%>
|
|
114
|
+
[Newtonsoft.Json.JsonIgnore]
|
|
115
|
+
<%} else if (p.property.language.default.flavor) {-%>
|
|
116
|
+
<%
|
|
117
|
+
switch(p.property.language.default.flavor) {
|
|
118
|
+
case 'additionalProperties':-%>
|
|
119
|
+
[Newtonsoft.Json.JsonExtensionData]
|
|
120
|
+
<% break;
|
|
121
|
+
default:
|
|
122
|
+
break;
|
|
123
|
+
}-%>
|
|
124
|
+
<% } else {-%>
|
|
125
|
+
[Newtonsoft.Json.JsonProperty(PropertyName = "<%-p.serializedName%>")]
|
|
126
|
+
<% } -%>
|
|
127
|
+
<% var type = p.property.schema.language.csharp.fullname-%>
|
|
128
|
+
<%type = (!project.helper.IsValueType(p.property.schema.type) && !project.helper.IsEnum(p.property.schema) && !(p.property.schema.choiceType && project.helper.IsValueType(p.property.schema.choiceType.type))) || p.required ? type : type + '?'-%>
|
|
129
|
+
public <%-type %> <%-p.name%> {get; <%- p.readOnly ? "private " : ""-%>set; }
|
|
130
|
+
<% }); -%>
|
|
131
|
+
<%#Below is support for ClassProperties in the model, const properties -%>
|
|
132
|
+
<% (publicVirtualProperties || []).filter(p => p.property.schema.type === 'constant' || project.helper.IsConstantProperty(p)).forEach(function(p){-%>
|
|
133
|
+
/// <summary>
|
|
134
|
+
/// <%=p.property.language.csharp.formattedPropertySummary%>
|
|
135
|
+
/// </summary>
|
|
136
|
+
<% (p.property.schema.language.csharp.jsonConverters || []).forEach(function(ct) {-%>
|
|
137
|
+
[Newtonsoft.Json.JsonConverter(typeof(<%-ct%>))]
|
|
138
|
+
<% });-%>
|
|
139
|
+
<% if (model.extensions && model.extensions['x-ms-parameter-grouping']) {-%>
|
|
140
|
+
[Newtonsoft.Json.JsonIgnore]
|
|
141
|
+
<% } else {-%>
|
|
142
|
+
[Newtonsoft.Json.JsonProperty(PropertyName = "<%-p.serializedName%>")]
|
|
143
|
+
<% } -%>
|
|
144
|
+
<% var type = p.property.schema.type === 'constant' ? p.property.schema.language.csharp.fullname : project.helper.GetCsharpType(p.property.schema.choiceType)-%>
|
|
145
|
+
public static <%-type %> <%-p.name%> {get; private set; }
|
|
146
|
+
<%});-%>
|
|
147
|
+
<%#ToDo support for ShouldValidateChain-%>
|
|
148
|
+
<% if (project.helper.ShouldValidateChain(model)) {
|
|
149
|
+
var methodQualifier = model.parents && model.parents.immediate.length == 1 && project.helper.ShouldValidateChain(model.parents.immediate[0]) ? "override" : "virtual";
|
|
150
|
+
var anythingToValidate = false;-%>
|
|
151
|
+
/// <summary>
|
|
152
|
+
/// Validate the object.
|
|
153
|
+
/// </summary>
|
|
154
|
+
/// <exception cref="Microsoft.Rest.ValidationException">
|
|
155
|
+
/// Thrown if validation fails
|
|
156
|
+
/// </exception>
|
|
157
|
+
public <%-methodQualifier%> void Validate()
|
|
158
|
+
{
|
|
159
|
+
<% if (model.parents && model.parents.immediate.length == 1 && project.helper.ShouldValidateChain(model.parents.immediate[0])) {
|
|
160
|
+
anythingToValidate = true;
|
|
161
|
+
-%>
|
|
162
|
+
base.Validate();
|
|
163
|
+
<% } -%>
|
|
164
|
+
<%publicVirtualProperties.filter(p=> p.required && !p.readOnly && !project.helper.IsValueType(p.property.schema.type) && !project.helper.IsConstantProperty(p) && !project.helper.IsEnum(p.property.schema)).forEach(function(p) {
|
|
165
|
+
anythingToValidate = true;
|
|
166
|
+
-%>
|
|
167
|
+
if (this.<%-p.name%> == null)
|
|
168
|
+
{
|
|
169
|
+
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "<%-p.name%>");
|
|
170
|
+
}
|
|
171
|
+
<%});-%>
|
|
172
|
+
<%publicVirtualProperties.filter(p=> project.helper.HasConstrains(p.property.schema) || !project.helper.IsValueType(p.property.schema.type)).forEach(function(p) {
|
|
173
|
+
anythingToValidate = true;
|
|
174
|
+
-%>
|
|
175
|
+
<%-project.helper.ValidateType(p.property.schema, model, `this.${p.name}`, !project.helper.IsValueType(p.property.schema.type) || !p.required)%>
|
|
176
|
+
<% }); -%>
|
|
177
|
+
<% if(!anythingToValidate) { -%>
|
|
178
|
+
//Nothing to validate
|
|
179
|
+
<% } -%>
|
|
180
|
+
}
|
|
181
|
+
<% } -%>
|
|
182
|
+
<%#ToDo support for ShouldGenerateXmlSerialization, guess we do not need to support it-%>
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>.Models
|
|
4
|
+
{
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Defines a page in Azure responses.
|
|
8
|
+
/// </summary>
|
|
9
|
+
/// <typeparam name="T">Type of the page content items</typeparam>
|
|
10
|
+
[Newtonsoft.Json.JsonObject]
|
|
11
|
+
public class <%-page.className%><T> : Microsoft.Rest.Azure.IPage<T>
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// Gets the link to the next page.
|
|
15
|
+
/// </summary>
|
|
16
|
+
[Newtonsoft.Json.JsonProperty("<%-page.nextLinkName%>")]
|
|
17
|
+
public System.String NextPageLink { get; private set; }
|
|
18
|
+
|
|
19
|
+
[Newtonsoft.Json.JsonProperty("<%-page.itemName%>")]
|
|
20
|
+
private System.Collections.Generic.IList<T> Items{ get; set; }
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Returns an enumerator that iterates through the collection.
|
|
24
|
+
/// </summary>
|
|
25
|
+
/// <returns>A an enumerator that can be used to iterate through the collection.</returns>
|
|
26
|
+
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
|
|
27
|
+
{
|
|
28
|
+
return (Items == null) ? System.Linq.Enumerable.Empty<T>().GetEnumerator() : Items.GetEnumerator();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// Returns an enumerator that iterates through the collection.
|
|
33
|
+
/// </summary>
|
|
34
|
+
/// <returns>A an enumerator that can be used to iterate through the collection.</returns>
|
|
35
|
+
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
|
36
|
+
{
|
|
37
|
+
return GetEnumerator();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/// <summary>
|
|
2
|
+
/// The base URI of the service.
|
|
3
|
+
/// </summary>
|
|
4
|
+
<%# ToDo: Add support for customBaseUri, priority is low-%>
|
|
5
|
+
public System.Uri BaseUri { get; set; }
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Gets or sets json serialization settings.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Gets or sets json deserialization settings.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
|
|
14
|
+
<% (project.model.globalParameters || []).filter(p=>p.language.default.name != '$host').forEach(function(parameter) {-%>
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// <%=parameter.language.default.description%>
|
|
17
|
+
/// </summary>
|
|
18
|
+
<% var type = parameter.schema.type == 'constant' ? parameter.schema.valueType.language.csharp.fullname : parameter.schema.language.csharp.fullname-%>
|
|
19
|
+
<%type = type.includes('.') || type == 'string' ? type : type + '?'-%>
|
|
20
|
+
<% if (parameter.readOnly || parameter.schema.type == 'constant') {-%>
|
|
21
|
+
public <%- type %> <%- parameter.language.default.name%> { get; private set; }
|
|
22
|
+
<% } else {-%>
|
|
23
|
+
public <%- type %> <%- parameter.language.default.name%> { get; set;}
|
|
24
|
+
<% }%>
|
|
25
|
+
<%});-%>
|
|
26
|
+
<% project.model.operationGroups.forEach(function(methodGroup){ -%>
|
|
27
|
+
<% var key = methodGroup.$key == 'Operations' ? '' : methodGroup.$key-%>
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Gets the I<%- project.helper.PascalCase(key) %>Operations
|
|
30
|
+
/// </summary>
|
|
31
|
+
public virtual I<%- project.helper.PascalCase(key) %>Operations <%- project.helper.PascalCase(methodGroup.$key) %> { get; private set; }
|
|
32
|
+
<% }); -%>
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
35
|
+
/// </summary>
|
|
36
|
+
/// <param name='httpClient'>
|
|
37
|
+
/// HttpClient to be used
|
|
38
|
+
/// </param>
|
|
39
|
+
/// <param name='disposeHttpClient'>
|
|
40
|
+
/// True: will dispose the provided httpClient on calling <%-project.model.info.title%>.Dispose(). False: will not dispose provided httpClient</param>
|
|
41
|
+
<%# ToDo: Add support for case that ContainsCredentials is false, low priority-%>
|
|
42
|
+
protected <%-project.model.info.title%>(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
|
|
43
|
+
{
|
|
44
|
+
this.Initialize();
|
|
45
|
+
}
|
|
46
|
+
/// <summary>
|
|
47
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
48
|
+
/// </summary>
|
|
49
|
+
/// <param name='handlers'>
|
|
50
|
+
/// Optional. The delegating handlers to add to the http client pipeline.
|
|
51
|
+
/// </param>
|
|
52
|
+
protected <%-project.model.info.title%>(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers)
|
|
53
|
+
{
|
|
54
|
+
this.Initialize();
|
|
55
|
+
}
|
|
56
|
+
/// <summary>
|
|
57
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
58
|
+
/// </summary>
|
|
59
|
+
/// <param name='rootHandler'>
|
|
60
|
+
/// Optional. The http client handler used to handle http transport.
|
|
61
|
+
/// </param>
|
|
62
|
+
/// <param name='handlers'>
|
|
63
|
+
/// Optional. The delegating handlers to add to the http client pipeline.
|
|
64
|
+
/// </param>
|
|
65
|
+
protected <%-project.model.info.title%>(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers)
|
|
66
|
+
{
|
|
67
|
+
this.Initialize();
|
|
68
|
+
}
|
|
69
|
+
<%# ToDo: following true means !IsCustomBaseUri, may need to implement IsCustomBaseUri, low priority -%>
|
|
70
|
+
<% if(true) {-%>
|
|
71
|
+
/// <summary>
|
|
72
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
73
|
+
/// </summary>
|
|
74
|
+
/// <param name='baseUri'>
|
|
75
|
+
/// Optional. The base URI of the service.
|
|
76
|
+
/// </param>
|
|
77
|
+
/// <param name='handlers'>
|
|
78
|
+
/// Optional. The delegating handlers to add to the http client pipeline.
|
|
79
|
+
/// </param>
|
|
80
|
+
/// <exception cref="System.ArgumentNullException">
|
|
81
|
+
/// Thrown when a required parameter is null
|
|
82
|
+
/// </exception>
|
|
83
|
+
protected <%-project.model.info.title%>(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
|
|
84
|
+
{
|
|
85
|
+
if (baseUri == null)
|
|
86
|
+
{
|
|
87
|
+
throw new System.ArgumentNullException("baseUri");
|
|
88
|
+
}
|
|
89
|
+
this.BaseUri = baseUri;
|
|
90
|
+
}
|
|
91
|
+
/// <summary>
|
|
92
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
93
|
+
/// </summary>
|
|
94
|
+
/// <param name='baseUri'>
|
|
95
|
+
/// Optional. The base URI of the service.
|
|
96
|
+
/// </param>
|
|
97
|
+
/// <param name='rootHandler'>
|
|
98
|
+
/// Optional. The http client handler used to handle http transport.
|
|
99
|
+
/// </param>
|
|
100
|
+
/// <param name='handlers'>
|
|
101
|
+
/// Optional. The delegating handlers to add to the http client pipeline.
|
|
102
|
+
/// </param>
|
|
103
|
+
/// <exception cref="System.ArgumentNullException">
|
|
104
|
+
/// Thrown when a required parameter is null
|
|
105
|
+
/// </exception>
|
|
106
|
+
protected <%-project.model.info.title%>(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
|
|
107
|
+
{
|
|
108
|
+
if (baseUri == null)
|
|
109
|
+
{
|
|
110
|
+
throw new System.ArgumentNullException("baseUri");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this.BaseUri = baseUri;
|
|
114
|
+
}
|
|
115
|
+
<% } -%>
|
|
116
|
+
<% var parameters = (project.model.globalParameters || []).filter(p => p.required && p.readOnly)
|
|
117
|
+
if (parameters.length > 0) {-%>
|
|
118
|
+
/// <summary>
|
|
119
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
120
|
+
/// </summary>
|
|
121
|
+
<%parameters.filter(p => !project.helper.IsConstantParameter(p)).forEach(function(parameter){-%>
|
|
122
|
+
/// <param name='<%-project.helper.CamelCase(parameter.language.default.name)%>'>
|
|
123
|
+
/// Required. <%-parameter.language.default.description%>
|
|
124
|
+
/// </param>
|
|
125
|
+
<%});-%>
|
|
126
|
+
/// <param name='handlers'>
|
|
127
|
+
/// Optional. The delegating handlers to add to the http client pipeline.
|
|
128
|
+
/// </param>
|
|
129
|
+
/// <exception cref="System.ArgumentNullException">
|
|
130
|
+
/// Thrown when a required parameter is null
|
|
131
|
+
/// </exception>
|
|
132
|
+
<%# ToDo: assume the access is public, need to figure the logic of ConstructorVisibility-%>
|
|
133
|
+
public <%-project.model.info.title%>(<%-project.model.language.default.requiredConstructorParametersDeclaration%>, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
|
|
134
|
+
{
|
|
135
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
136
|
+
if (<%-project.helper.CamelCase(parameter.language.default.name)%> == null)
|
|
137
|
+
{
|
|
138
|
+
throw new System.ArgumentNullException("<%-project.helper.CamelCase(parameter.language.default.name)%>");
|
|
139
|
+
}
|
|
140
|
+
<%});-%>
|
|
141
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
142
|
+
this.<%-parameter.language.default.name%> = <%-project.helper.CamelCase(parameter.language.default.name)%>;
|
|
143
|
+
<%if(parameter.schema.language.csharp.fullname == 'Microsoft.Rest.ServiceClientCredentials') {-%>
|
|
144
|
+
if (this.Credentials != null)
|
|
145
|
+
{
|
|
146
|
+
this.Credentials.InitializeServiceClient(this);
|
|
147
|
+
}
|
|
148
|
+
<% }-%>
|
|
149
|
+
<%});-%>
|
|
150
|
+
}
|
|
151
|
+
/// <summary>
|
|
152
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
153
|
+
/// </summary>
|
|
154
|
+
<%parameters.filter(p => !project.helper.IsConstantParameter(p)).forEach(function(parameter) {-%>
|
|
155
|
+
/// <param name="<%-project.helper.CamelCase(parameter.language.default.name)%>">
|
|
156
|
+
/// Required. <%-parameter.language.default.description%>
|
|
157
|
+
/// </param>
|
|
158
|
+
<%});-%>
|
|
159
|
+
/// <param name='httpClient'>
|
|
160
|
+
/// HttpClient to be used
|
|
161
|
+
/// </param>
|
|
162
|
+
/// <param name='disposeHttpClient'>
|
|
163
|
+
/// True: will dispose the provided httpClient on calling <%-project.model.info.title%>.Dispose(). False: will not dispose provided httpClient</param>
|
|
164
|
+
/// <exception cref="System.ArgumentNullException">
|
|
165
|
+
/// Thrown when a required parameter is null
|
|
166
|
+
/// </exception>
|
|
167
|
+
public <%-project.model.info.title%>(<%-project.model.language.default.requiredConstructorParametersDeclaration%>, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
|
|
168
|
+
{
|
|
169
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
170
|
+
if (<%-project.helper.CamelCase(parameter.language.default.name)%> == null)
|
|
171
|
+
{
|
|
172
|
+
throw new System.ArgumentNullException("<%-project.helper.CamelCase(parameter.language.default.name)%>");
|
|
173
|
+
}
|
|
174
|
+
<%});-%>
|
|
175
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
176
|
+
this.<%-parameter.language.default.name%> = <%-project.helper.CamelCase(parameter.language.default.name)%>;
|
|
177
|
+
<%if(parameter.schema.language.csharp.fullname == 'Microsoft.Rest.ServiceClientCredentials') {-%>
|
|
178
|
+
if (this.Credentials != null)
|
|
179
|
+
{
|
|
180
|
+
this.Credentials.InitializeServiceClient(this);
|
|
181
|
+
}
|
|
182
|
+
<% }-%>
|
|
183
|
+
<%});-%>
|
|
184
|
+
}
|
|
185
|
+
/// <summary>
|
|
186
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
187
|
+
/// </summary>
|
|
188
|
+
<%parameters.filter(p => !project.helper.IsConstantParameter(p)).forEach(function(parameter) {-%>
|
|
189
|
+
/// <param name="<%-project.helper.CamelCase(parameter.language.default.name)%>">
|
|
190
|
+
/// Required. <%-parameter.language.default.description%>
|
|
191
|
+
/// </param>
|
|
192
|
+
<%});-%>
|
|
193
|
+
/// <param name='rootHandler'>
|
|
194
|
+
/// Optional. The http client handler used to handle http transport.
|
|
195
|
+
/// </param>
|
|
196
|
+
/// <param name='handlers'>
|
|
197
|
+
/// Optional. The delegating handlers to add to the http client pipeline.
|
|
198
|
+
/// </param>
|
|
199
|
+
/// <exception cref="System.ArgumentNullException">
|
|
200
|
+
/// Thrown when a required parameter is null
|
|
201
|
+
/// </exception>
|
|
202
|
+
public <%-project.model.info.title%>(<%-project.model.language.default.requiredConstructorParametersDeclaration%>, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
|
|
203
|
+
{
|
|
204
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
205
|
+
if (<%-project.helper.CamelCase(parameter.language.default.name)%> == null)
|
|
206
|
+
{
|
|
207
|
+
throw new System.ArgumentNullException("<%-project.helper.CamelCase(parameter.language.default.name)%>");
|
|
208
|
+
}
|
|
209
|
+
<%});-%>
|
|
210
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
211
|
+
this.<%-parameter.language.default.name%> = <%-project.helper.CamelCase(parameter.language.default.name)%>;
|
|
212
|
+
<%if(parameter.schema.language.csharp.fullname == 'Microsoft.Rest.ServiceClientCredentials') {-%>
|
|
213
|
+
if (this.Credentials != null)
|
|
214
|
+
{
|
|
215
|
+
this.Credentials.InitializeServiceClient(this);
|
|
216
|
+
}
|
|
217
|
+
<% }-%>
|
|
218
|
+
<%});-%>
|
|
219
|
+
}
|
|
220
|
+
<%# ToDo: following true means !IsCustomBaseUri, may need to implement IsCustomBaseUri, low priority -%>
|
|
221
|
+
<%if (true) {-%>
|
|
222
|
+
/// <summary>
|
|
223
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
224
|
+
/// </summary>
|
|
225
|
+
/// <param name='baseUri'>
|
|
226
|
+
/// Optional. The base URI of the service.
|
|
227
|
+
/// </param>
|
|
228
|
+
<%parameters.filter(p => !project.helper.IsConstantParameter(p)).forEach(function(parameter) {-%>
|
|
229
|
+
/// <param name="<%-project.helper.CamelCase(parameter.language.default.name)%>">
|
|
230
|
+
/// Required. <%-parameter.language.default.description%>
|
|
231
|
+
/// </param>
|
|
232
|
+
<%});-%>
|
|
233
|
+
/// <param name='handlers'>
|
|
234
|
+
/// Optional. The delegating handlers to add to the http client pipeline.
|
|
235
|
+
/// </param>
|
|
236
|
+
/// <exception cref="System.ArgumentNullException">
|
|
237
|
+
/// Thrown when a required parameter is null
|
|
238
|
+
/// </exception>
|
|
239
|
+
public <%-project.model.info.title%>(System.Uri baseUri, <%-project.model.language.default.requiredConstructorParametersDeclaration%>, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
|
|
240
|
+
{
|
|
241
|
+
if (baseUri == null)
|
|
242
|
+
{
|
|
243
|
+
throw new System.ArgumentNullException("baseUri");
|
|
244
|
+
}
|
|
245
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
246
|
+
if (<%-project.helper.CamelCase(parameter.language.default.name)%> == null)
|
|
247
|
+
{
|
|
248
|
+
throw new System.ArgumentNullException("<%-project.helper.CamelCase(parameter.language.default.name)%>");
|
|
249
|
+
}
|
|
250
|
+
<%});-%>
|
|
251
|
+
this.BaseUri = baseUri;
|
|
252
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
253
|
+
this.<%-parameter.language.default.name%> = <%-project.helper.CamelCase(parameter.language.default.name)%>;
|
|
254
|
+
<%if(parameter.schema.language.csharp.fullname == 'Microsoft.Rest.ServiceClientCredentials') {-%>
|
|
255
|
+
if (this.Credentials != null)
|
|
256
|
+
{
|
|
257
|
+
this.Credentials.InitializeServiceClient(this);
|
|
258
|
+
}
|
|
259
|
+
<% }-%>
|
|
260
|
+
<%});-%>
|
|
261
|
+
}
|
|
262
|
+
/// <summary>
|
|
263
|
+
/// Initializes a new instance of the <%-project.model.info.title%> class.
|
|
264
|
+
/// </summary>
|
|
265
|
+
/// <param name='baseUri'>
|
|
266
|
+
/// Optional. The base URI of the service.
|
|
267
|
+
/// </param>
|
|
268
|
+
<%parameters.filter(p => !project.helper.IsConstantParameter(p)).forEach(function(parameter) {-%>
|
|
269
|
+
/// <param name="<%-project.helper.CamelCase(parameter.language.default.name)%>">
|
|
270
|
+
/// Required. <%-parameter.language.default.description%>
|
|
271
|
+
/// </param>
|
|
272
|
+
<%});-%>
|
|
273
|
+
/// <param name='rootHandler'>
|
|
274
|
+
/// Optional. The http client handler used to handle http transport.
|
|
275
|
+
/// </param>
|
|
276
|
+
/// <exception cref="System.ArgumentNullException">
|
|
277
|
+
/// Thrown when a required parameter is null
|
|
278
|
+
/// </exception>
|
|
279
|
+
public <%-project.model.info.title%>(System.Uri baseUri, <%-project.model.language.default.requiredConstructorParametersDeclaration%>, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
|
|
280
|
+
{
|
|
281
|
+
if (baseUri == null)
|
|
282
|
+
{
|
|
283
|
+
throw new System.ArgumentNullException("baseUri");
|
|
284
|
+
}
|
|
285
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
286
|
+
if (<%-project.helper.CamelCase(parameter.language.default.name)%> == null)
|
|
287
|
+
{
|
|
288
|
+
throw new System.ArgumentNullException("<%-project.helper.CamelCase(parameter.language.default.name)%>");
|
|
289
|
+
}
|
|
290
|
+
<%});-%>
|
|
291
|
+
this.BaseUri = baseUri;
|
|
292
|
+
<%parameters.forEach(function(parameter) {-%>
|
|
293
|
+
this.<%-parameter.language.default.name%> = <%-project.helper.CamelCase(parameter.language.default.name)%>;
|
|
294
|
+
<%if(parameter.schema.language.csharp.fullname == 'Microsoft.Rest.ServiceClientCredentials') {-%>
|
|
295
|
+
if (this.Credentials != null)
|
|
296
|
+
{
|
|
297
|
+
this.Credentials.InitializeServiceClient(this);
|
|
298
|
+
}
|
|
299
|
+
<% }-%>
|
|
300
|
+
<%});-%>
|
|
301
|
+
}
|
|
302
|
+
<%}-%>
|
|
303
|
+
<% }-%>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<%- project.commentHeader %>
|
|
2
|
+
|
|
3
|
+
namespace <%- project.namespace %>
|
|
4
|
+
{
|
|
5
|
+
using Microsoft.Rest;
|
|
6
|
+
<% project.model.usings.forEach(function(using){ -%>
|
|
7
|
+
using <%- using %>;
|
|
8
|
+
<% }); -%>
|
|
9
|
+
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// <%- project.model.info.description %>
|
|
12
|
+
/// </summary>
|
|
13
|
+
<% var client = project.model.info.title -%>
|
|
14
|
+
public partial interface I<%- client %> : System.IDisposable
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// The base URI of the service.
|
|
18
|
+
/// </summary>
|
|
19
|
+
System.Uri BaseUri { get; set; }
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// Gets or sets json serialization settings.
|
|
23
|
+
/// </summary>
|
|
24
|
+
Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; }
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
/// Gets or sets json deserialization settings.
|
|
28
|
+
/// </summary>
|
|
29
|
+
Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; }
|
|
30
|
+
|
|
31
|
+
<% (project.model.globalParameters || []).filter(p => p.language.default.name != '$host').forEach(function(parameter){ -%>
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// <%- parameter.language.default.description %>
|
|
34
|
+
/// </summary>
|
|
35
|
+
<%# ToDo: need to use fullname instead of namespace + name -%>
|
|
36
|
+
<% var type = parameter.schema.type == 'constant' ? parameter.schema.valueType.language.csharp.fullname : parameter.schema.language.csharp.fullname-%>
|
|
37
|
+
<%type = type.includes('.') || type == 'string' ? type : type + '?'-%>
|
|
38
|
+
<% if (parameter.readOnly || parameter.schema.type == 'constant') {-%>
|
|
39
|
+
<%- type %> <%- parameter.language.default.name%> { get;}
|
|
40
|
+
<% } else {-%>
|
|
41
|
+
<%- type %> <%- parameter.language.default.name%> { get; set;}
|
|
42
|
+
<% }%>
|
|
43
|
+
|
|
44
|
+
<% }); -%>
|
|
45
|
+
<% project.model.operationGroups.forEach(function(methodGroup){ -%>
|
|
46
|
+
<% var key = methodGroup.$key == 'Operations' ? '' : methodGroup.$key-%>
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Gets the I<%- project.helper.PascalCase(key) %>Operations
|
|
49
|
+
/// </summary>
|
|
50
|
+
I<%- project.helper.PascalCase(key) %>Operations <%- project.helper.PascalCase(methodGroup.$key) %> { get; }
|
|
51
|
+
|
|
52
|
+
<% }); -%>
|
|
53
|
+
<%# ToDo: Add method whose group is empty, and need to check in which case the group is empty.-%>
|
|
54
|
+
}
|
|
55
|
+
}
|