forked from Azure/autorest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#1100 from stankovski/syncwrapper
SyncMethods parameter for C# code gen
- Loading branch information
Showing
54 changed files
with
10,580 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
287 changes: 287 additions & 0 deletions
287
...rp.Tests/Expected/AcceptanceTests/AzureBodyDurationAllSync/AutoRestDurationTestService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,287 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for | ||
// license information. | ||
// | ||
// Code generated by Microsoft (R) AutoRest Code Generator. | ||
// Changes may cause incorrect behavior and will be lost if the code is | ||
// regenerated. | ||
|
||
namespace Fixtures.AcceptanceTestsAzureBodyDurationAllSync | ||
{ | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Rest; | ||
using Microsoft.Rest.Serialization; | ||
using Newtonsoft.Json; | ||
using Microsoft.Rest.Azure; | ||
using Models; | ||
|
||
/// <summary> | ||
/// Test Infrastructure for AutoRest | ||
/// </summary> | ||
public partial class AutoRestDurationTestService : ServiceClient<AutoRestDurationTestService>, IAutoRestDurationTestService, IAzureClient | ||
{ | ||
/// <summary> | ||
/// The base URI of the service. | ||
/// </summary> | ||
public Uri BaseUri { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets json serialization settings. | ||
/// </summary> | ||
public JsonSerializerSettings SerializationSettings { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets or sets json deserialization settings. | ||
/// </summary> | ||
public JsonSerializerSettings DeserializationSettings { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets Azure subscription credentials. | ||
/// </summary> | ||
public ServiceClientCredentials Credentials { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the preferred language for the response. | ||
/// </summary> | ||
public string AcceptLanguage { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the retry timeout in seconds for Long Running Operations. | ||
/// Default value is 30. | ||
/// </summary> | ||
public int? LongRunningOperationRetryTimeout { get; set; } | ||
|
||
/// <summary> | ||
/// When set to true a unique x-ms-client-request-id value is generated and | ||
/// included in each request. Default is true. | ||
/// </summary> | ||
public bool? GenerateClientRequestId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the IDurationOperations. | ||
/// </summary> | ||
public virtual IDurationOperations Duration { get; private set; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
protected AutoRestDurationTestService(params DelegatingHandler[] handlers) : base(handlers) | ||
{ | ||
this.Initialize(); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='rootHandler'> | ||
/// Optional. The http client handler used to handle http transport. | ||
/// </param> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
protected AutoRestDurationTestService(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) | ||
{ | ||
this.Initialize(); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='baseUri'> | ||
/// Optional. The base URI of the service. | ||
/// </param> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
protected AutoRestDurationTestService(Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) | ||
{ | ||
if (baseUri == null) | ||
{ | ||
throw new ArgumentNullException("baseUri"); | ||
} | ||
this.BaseUri = baseUri; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='baseUri'> | ||
/// Optional. The base URI of the service. | ||
/// </param> | ||
/// <param name='rootHandler'> | ||
/// Optional. The http client handler used to handle http transport. | ||
/// </param> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
protected AutoRestDurationTestService(Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) | ||
{ | ||
if (baseUri == null) | ||
{ | ||
throw new ArgumentNullException("baseUri"); | ||
} | ||
this.BaseUri = baseUri; | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='credentials'> | ||
/// Required. Gets Azure subscription credentials. | ||
/// </param> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
public AutoRestDurationTestService(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) | ||
{ | ||
if (credentials == null) | ||
{ | ||
throw new ArgumentNullException("credentials"); | ||
} | ||
this.Credentials = credentials; | ||
if (this.Credentials != null) | ||
{ | ||
this.Credentials.InitializeServiceClient(this); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='credentials'> | ||
/// Required. Gets Azure subscription credentials. | ||
/// </param> | ||
/// <param name='rootHandler'> | ||
/// Optional. The http client handler used to handle http transport. | ||
/// </param> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
public AutoRestDurationTestService(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) | ||
{ | ||
if (credentials == null) | ||
{ | ||
throw new ArgumentNullException("credentials"); | ||
} | ||
this.Credentials = credentials; | ||
if (this.Credentials != null) | ||
{ | ||
this.Credentials.InitializeServiceClient(this); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='baseUri'> | ||
/// Optional. The base URI of the service. | ||
/// </param> | ||
/// <param name='credentials'> | ||
/// Required. Gets Azure subscription credentials. | ||
/// </param> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) | ||
{ | ||
if (baseUri == null) | ||
{ | ||
throw new ArgumentNullException("baseUri"); | ||
} | ||
if (credentials == null) | ||
{ | ||
throw new ArgumentNullException("credentials"); | ||
} | ||
this.BaseUri = baseUri; | ||
this.Credentials = credentials; | ||
if (this.Credentials != null) | ||
{ | ||
this.Credentials.InitializeServiceClient(this); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the AutoRestDurationTestService class. | ||
/// </summary> | ||
/// <param name='baseUri'> | ||
/// Optional. The base URI of the service. | ||
/// </param> | ||
/// <param name='credentials'> | ||
/// Required. Gets Azure subscription credentials. | ||
/// </param> | ||
/// <param name='rootHandler'> | ||
/// Optional. The http client handler used to handle http transport. | ||
/// </param> | ||
/// <param name='handlers'> | ||
/// Optional. The delegating handlers to add to the http client pipeline. | ||
/// </param> | ||
public AutoRestDurationTestService(Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) | ||
{ | ||
if (baseUri == null) | ||
{ | ||
throw new ArgumentNullException("baseUri"); | ||
} | ||
if (credentials == null) | ||
{ | ||
throw new ArgumentNullException("credentials"); | ||
} | ||
this.BaseUri = baseUri; | ||
this.Credentials = credentials; | ||
if (this.Credentials != null) | ||
{ | ||
this.Credentials.InitializeServiceClient(this); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Initializes client properties. | ||
/// </summary> | ||
private void Initialize() | ||
{ | ||
this.Duration = new DurationOperations(this); | ||
this.BaseUri = new Uri("https://localhost"); | ||
this.AcceptLanguage = "en-US"; | ||
this.LongRunningOperationRetryTimeout = 30; | ||
this.GenerateClientRequestId = true; | ||
SerializationSettings = new JsonSerializerSettings | ||
{ | ||
Formatting = Formatting.Indented, | ||
DateFormatHandling = DateFormatHandling.IsoDateFormat, | ||
DateTimeZoneHandling = DateTimeZoneHandling.Utc, | ||
NullValueHandling = NullValueHandling.Ignore, | ||
ReferenceLoopHandling = ReferenceLoopHandling.Serialize, | ||
ContractResolver = new ReadOnlyJsonContractResolver(), | ||
Converters = new List<JsonConverter> | ||
{ | ||
new Iso8601TimeSpanConverter() | ||
} | ||
}; | ||
DeserializationSettings = new JsonSerializerSettings | ||
{ | ||
DateFormatHandling = DateFormatHandling.IsoDateFormat, | ||
DateTimeZoneHandling = DateTimeZoneHandling.Utc, | ||
NullValueHandling = NullValueHandling.Ignore, | ||
ReferenceLoopHandling = ReferenceLoopHandling.Serialize, | ||
ContractResolver = new ReadOnlyJsonContractResolver(), | ||
Converters = new List<JsonConverter> | ||
{ | ||
new Iso8601TimeSpanConverter() | ||
} | ||
}; | ||
DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); | ||
} | ||
} | ||
} |
Oops, something went wrong.