@using System @using System.Linq @using AutoRest.Core.Model @using AutoRest.Core.Utilities @inherits AutoRest.Core.Template /// /// The base URI of the service. /// @if(Model.IsCustomBaseUri) { @:internal string BaseUri {get; set;} } else { @:public System.Uri BaseUri { get; set; } } @EmptyLine /// /// Gets or sets json serialization settings. /// public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } @EmptyLine /// /// Gets or sets json deserialization settings. /// public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } @EmptyLine @foreach (var property in Model.Properties) { @:/// @:@WrapComment("/// ", property.Documentation.EscapeXmlComment()) @:/// @:public @property.ModelTypeName @property.Name { get; @(property.IsReadOnly || property.IsConstant ? "private " : "")set; } @EmptyLine } @foreach (var operation in Model.AllOperations) { @:/// @:/// Gets the I@(operation.TypeName). @:/// @:public virtual I@(operation.TypeName) @(operation.NameForProperty) { get; private set; } @EmptyLine } /// /// Initializes a new instance of the @Model.Name class. /// /// /// HttpClient to be used /// /// /// True: will dispose the provided httpClient on calling @(Model.Name).Dispose(). False: will not dispose provided httpClient @(Model.ContainsCredentials ? "protected" : Model.ConstructorVisibility) @(Model.Name)(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { this.Initialize(); } @EmptyLine /// /// Initializes a new instance of the @Model.Name class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// @(Model.ContainsCredentials ? "protected" : Model.ConstructorVisibility) @(Model.Name)(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) { this.Initialize(); } @EmptyLine /// /// Initializes a new instance of the @Model.Name class. /// /// /// Optional. The http client handler used to handle http transport. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// @(Model.ContainsCredentials ? "protected" : Model.ConstructorVisibility) @(Model.Name)(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) { this.Initialize(); } @EmptyLine @if(!Model.IsCustomBaseUri) { @:/// @:/// Initializes a new instance of the @Model.Name class. @:/// @:/// @:/// Optional. The base URI of the service. @:/// @:/// @:/// Optional. The delegating handlers to add to the http client pipeline. @:/// @:/// @:/// Thrown when a required parameter is null @:/// @:@(Model.ContainsCredentials ? "protected" : Model.ConstructorVisibility) @(Model.Name)(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) @:{ @: if (baseUri == null) @: { @: throw new System.ArgumentNullException("baseUri"); @: } @: @: this.BaseUri = baseUri; @:} @:@EmptyLine @:/// @:/// Initializes a new instance of the @Model.Name class. @:/// @:/// @:/// Optional. The base URI of the service. @:/// @:/// @:/// Optional. The http client handler used to handle http transport. @:/// @:/// @:/// Optional. The delegating handlers to add to the http client pipeline. @:/// @:/// @:/// Thrown when a required parameter is null @:/// @:@(Model.ContainsCredentials ? "protected" : Model.ConstructorVisibility) @(Model.Name)(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) @:{ @: if (baseUri == null) @: { @: throw new System.ArgumentNullException("baseUri"); @: } @: @: this.BaseUri = baseUri; @:} @:@EmptyLine } @{var parameters = Model.Properties.Where(p => p.IsRequired && p.IsReadOnly);} @if (parameters.Any()) { @:/// @:/// Initializes a new instance of the @Model.Name class. @:/// foreach (var param in parameters) { @:/// @:/// Required. @(param.Documentation) @:/// } @:/// @:/// Optional. The delegating handlers to add to the http client pipeline. @:/// @:/// @:/// Thrown when a required parameter is null @:/// @:@(Model.ConstructorVisibility) @(Model.Name)(@(Model.RequiredConstructorParameters), params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) @:{ foreach (var param in parameters) { @: if (@(param.Name.ToCamelCase()) == null) @: { @: throw new System.ArgumentNullException("@(param.Name.ToCamelCase())"); @: } } foreach (var param in parameters) { @: this.@(param.Name) = @(param.Name.ToCamelCase()); @if (param.ModelType.IsPrimaryType(KnownPrimaryType.Credentials)) { @:if (this.Credentials != null) @:{ @: this.Credentials.InitializeServiceClient(this); @:} } } @:} @:@EmptyLine @:/// @:/// Initializes a new instance of the @Model.Name class. @:/// foreach (var param in parameters) { @:/// @:/// Required. @(param.Documentation) @:/// } @:/// @:/// HttpClient to be used @:/// @:/// @:/// True: will dispose the provided httpClient on calling @(Model.Name).Dispose(). False: will not dispose provided httpClient @:/// @:/// Thrown when a required parameter is null @:/// @:@(Model.ConstructorVisibility) @(Model.Name)(@(Model.RequiredConstructorParameters), System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) @:{ foreach (var param in parameters) { @: if (@(param.Name.ToCamelCase()) == null) @: { @: throw new System.ArgumentNullException("@(param.Name.ToCamelCase())"); @: } } foreach (var param in parameters) { @: this.@(param.Name) = @(param.Name.ToCamelCase()); @if (param.ModelType.IsPrimaryType(KnownPrimaryType.Credentials)) { @:if (this.Credentials != null) @:{ @: this.Credentials.InitializeServiceClient(this); @:} } } @:} @:@EmptyLine @:/// @:/// Initializes a new instance of the @Model.Name class. @:/// foreach (var param in parameters) { @:/// @:/// Required. @(param.Documentation) @:/// } @:/// @:/// Optional. The http client handler used to handle http transport. @:/// @:/// @:/// Optional. The delegating handlers to add to the http client pipeline. @:/// @:/// @:/// Thrown when a required parameter is null @:/// @:@(Model.ConstructorVisibility) @(Model.Name)(@(Model.RequiredConstructorParameters), System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) @:{ foreach (var param in parameters) { @: if (@(param.Name.ToCamelCase()) == null) @: { @: throw new System.ArgumentNullException("@(param.Name.ToCamelCase())"); @: } } foreach (var param in parameters) { @: this.@(param.Name) = @(param.Name.ToCamelCase()); @if (param.ModelType.IsPrimaryType(KnownPrimaryType.Credentials)) { @:if (this.Credentials != null) @:{ @: this.Credentials.InitializeServiceClient(this); @:} } } @:} @:@EmptyLine if(!Model.IsCustomBaseUri) { @:/// @:/// Initializes a new instance of the @Model.Name class. @:/// @:/// @:/// Optional. The base URI of the service. @:/// foreach (var param in parameters) { @:/// @:/// Required. @(param.Documentation) @:/// } @:/// @:/// Optional. The delegating handlers to add to the http client pipeline. @:/// @:/// @:/// Thrown when a required parameter is null @:/// @:@(Model.ConstructorVisibility) @(Model.Name)(System.Uri baseUri, @(Model.RequiredConstructorParameters), params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) @:{ @: if (baseUri == null) @: { @: throw new System.ArgumentNullException("baseUri"); @: } foreach (var param in parameters) { @: if (@(param.Name.ToCamelCase()) == null) @: { @: throw new System.ArgumentNullException("@(param.Name.ToCamelCase())"); @: } } @: this.BaseUri = baseUri; foreach (var param in parameters) { @: this.@(param.Name) = @(param.Name.ToCamelCase()); @if (param.ModelType.IsPrimaryType(KnownPrimaryType.Credentials)) { @:if (this.Credentials != null) @:{ @: this.Credentials.InitializeServiceClient(this); @:} } } @:} @:@EmptyLine @:/// @:/// Initializes a new instance of the @Model.Name class. @:/// @:/// @:/// Optional. The base URI of the service. @:/// foreach (var param in parameters) { @:/// @:/// Required. @(param.Documentation) @:/// } @:/// @:/// Optional. The http client handler used to handle http transport. @:/// @:/// @:/// Optional. The delegating handlers to add to the http client pipeline. @:/// @:/// @:/// Thrown when a required parameter is null @:/// @:@(Model.ConstructorVisibility) @(Model.Name)(System.Uri baseUri, @(Model.RequiredConstructorParameters), System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) @:{ @: if (baseUri == null) @: { @: throw new System.ArgumentNullException("baseUri"); @: } foreach (var param in parameters) { @: if (@(param.Name.ToCamelCase()) == null) @: { @: throw new System.ArgumentNullException("@(param.Name.ToCamelCase())"); @: } } @: this.BaseUri = baseUri; foreach (var param in parameters) { @: this.@(param.Name) = @(param.Name.ToCamelCase()); @if (param.ModelType.IsPrimaryType(KnownPrimaryType.Credentials)) { @:if (this.Credentials != null) @:{ @: this.Credentials.InitializeServiceClient(this); @:} } } @:} @:@EmptyLine } }