diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index dd4b3e9f27cf..eecc93de1d30 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -312,6 +312,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { clientPackageDir, "ApiResponse.cs")); supportingFiles.add(new SupportingFile("ExceptionFactory.mustache", clientPackageDir, "ExceptionFactory.cs")); + if(Boolean.FALSE.equals(this.netStandard) && Boolean.FALSE.equals(this.netCoreProjectFileFlag)) { supportingFiles.add(new SupportingFile("compile.mustache", "", "build.bat")); supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "build.sh")); @@ -324,6 +325,11 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("project.json.mustache", packageFolder + File.separator, "project.json")); } + supportingFiles.add(new SupportingFile("IReadableConfiguration.mustache", + clientPackageDir, "IReadableConfiguration.cs")); + supportingFiles.add(new SupportingFile("GlobalConfiguration.mustache", + clientPackageDir, "GlobalConfiguration.cs")); + // Only write out test related files if excludeTests is unset or explicitly set to false (see start of this method) if(Boolean.FALSE.equals(excludeTests)) { // shell script to run the nunit test diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index 875fdcc09da6..6bef6f4ec66a 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache @@ -49,11 +49,11 @@ namespace {{packageName}}.Client /// /// Initializes a new instance of the class - /// with default configuration and base path ({{{basePath}}}). + /// with default configuration. /// public ApiClient() { - Configuration = Configuration.Default; + Configuration = {{packageName}}.Client.Configuration.Default; RestClient = new RestClient("{{{basePath}}}"); {{#netStandard}} RestClient.IgnoreResponseStatusCode = true; @@ -65,14 +65,11 @@ namespace {{packageName}}.Client /// with default base path ({{{basePath}}}). /// /// An instance of Configuration. - public ApiClient(Configuration config = null) + public ApiClient(Configuration config) { - if (config == null) - Configuration = Configuration.Default; - else - Configuration = config; + Configuration = config ?? {{packageName}}.Client.Configuration.Default; - RestClient = new RestClient("{{{basePath}}}"); + RestClient = new RestClient(Configuration.BasePath); {{#netStandard}} RestClient.IgnoreResponseStatusCode = true; {{/netStandard}} @@ -92,7 +89,7 @@ namespace {{packageName}}.Client {{#netStandard}} RestClient.IgnoreResponseStatusCode = true; {{/netStandard}} - Configuration = Configuration.Default; + Configuration = Client.Configuration.Default; } /// @@ -103,10 +100,15 @@ namespace {{packageName}}.Client public static ApiClient Default; /// - /// Gets or sets the Configuration. + /// Gets or sets an instance of the IReadableConfiguration. /// - /// An instance of the Configuration. - public Configuration Configuration { get; set; } + /// An instance of the IReadableConfiguration. + /// + /// helps us to avoid modifying possibly global + /// configuration values from within a given client. It does not gaurantee thread-safety + /// of the instance in any way. + /// + public IReadableConfiguration Configuration { get; set; } /// /// Gets or sets the RestClient. @@ -210,7 +212,8 @@ namespace {{packageName}}.Client pathParams, contentType); // set timeout - RestClient.Timeout = Configuration.Timeout; + {{#netStandard}}RestClient.Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout);{{/netStandard}} + {{^netStandard}}RestClient.Timeout = Configuration.Timeout;{{/netStandard}} // set user agent RestClient.UserAgent = Configuration.UserAgent; @@ -334,6 +337,7 @@ namespace {{packageName}}.Client return response.RawBytes; } + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) if (type == typeof(Stream)) { if (headers != null) diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index c4133bcc6819..e7aafa2c3279 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -1,6 +1,7 @@ {{>partial_header}} using System; using System.Reflection; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -11,10 +12,147 @@ namespace {{packageName}}.Client /// /// Represents a set of configuration settings /// - {{>visibility}} class Configuration + {{>visibility}} class Configuration : IReadableConfiguration { + #region Constants + /// - /// Initializes a new instance of the Configuration class with different settings + /// Version of the package. + /// + /// Version of the package. + public const string Version = "{{packageVersion}}"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + private static readonly object GlobalConfigSync = new { }; + private static Configuration _globalConfiguration; + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.Content), + response.Content); + } + {{^netStandard}}if (status == 0) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); + }{{/netStandard}} + return null; + }; + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static Configuration Default + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + + #endregion Static Members + + #region Private Members + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + private IDictionary _apiKey = null; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix = null; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + #endregion Private Members + + #region Constructors + + static Configuration() + { + _globalConfiguration = new GlobalConfiguration(); + } + + /// + /// Initializes a new instance of the class + /// + public Configuration() + { + UserAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}"; + BasePath = "{{{basePath}}}"; + DefaultHeader = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + public Configuration( + IDictionary defaultHeader, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "{{{basePath}}}") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeader == null) + throw new ArgumentNullException("defaultHeader"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeader) + { + DefaultHeader.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + /// + /// Initializes a new instance of the class with different settings /// /// Api client /// Dictionary of default HTTP header @@ -27,131 +165,225 @@ namespace {{packageName}}.Client /// DateTime format string /// HTTP connection timeout (in milliseconds) /// HTTP user agent - public Configuration(ApiClient apiClient = null, - Dictionary defaultHeader = null, - string username = null, - string password = null, - string accessToken = null, - Dictionary apiKey = null, - Dictionary apiKeyPrefix = null, - string tempFolderPath = null, - string dateTimeFormat = null, - int timeout = 100000, - string userAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}" - ) + [Obsolete("Use explicit object construction and setting of properties.", true)] + public Configuration( + // ReSharper disable UnusedParameter.Local + ApiClient apiClient = null, + IDictionary defaultHeader = null, + string username = null, + string password = null, + string accessToken = null, + IDictionary apiKey = null, + IDictionary apiKeyPrefix = null, + string tempFolderPath = null, + string dateTimeFormat = null, + int timeout = 100000, + string userAgent = "{{#httpUserAgent}}{{.}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{packageVersion}}/csharp{{/httpUserAgent}}" + // ReSharper restore UnusedParameter.Local + ) { - setApiClientUsingDefault(apiClient); - Username = username; - Password = password; - AccessToken = accessToken; - UserAgent = userAgent; - - if (defaultHeader != null) - DefaultHeader = defaultHeader; - if (apiKey != null) - ApiKey = apiKey; - if (apiKeyPrefix != null) - ApiKeyPrefix = apiKeyPrefix; - - TempFolderPath = tempFolderPath; - DateTimeFormat = dateTimeFormat; - Timeout = {{#netStandard}}TimeSpan.FromMilliseconds({{/netStandard}}timeout{{#netStandard}}){{/netStandard}}; } /// /// Initializes a new instance of the Configuration class. /// /// Api client. + [Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)] + // ReSharper disable once UnusedParameter.Local public Configuration(ApiClient apiClient) { - setApiClientUsingDefault(apiClient); + } - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "{{packageVersion}}"; + #endregion Constructors - /// - /// Gets or sets the default Configuration. - /// - /// Configuration. - public static Configuration Default = new Configuration(); + #region Properties + + private ApiClient _apiClient = null; /// - /// Default creation of exceptions for a given method name and response object + /// Gets an instance of an ApiClient for this configuration /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + public virtual ApiClient ApiClient { - int status = (int) response.StatusCode; - if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); - {{^netStandard}} - if (status == 0) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); - {{/netStandard}} - return null; - }; - - /// - /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. - /// - /// Timeout. - public {{^netStandard}}int{{/netStandard}}{{#netStandard}}TimeSpan?{{/netStandard}} Timeout - { - get { return ApiClient.RestClient.Timeout; } - - set + get { - if (ApiClient != null) - ApiClient.RestClient.Timeout = value; + if (_apiClient == null) _apiClient = CreateApiClient(); + return _apiClient; } } + private String _basePath = null; /// - /// Gets or sets the default API client for making HTTP calls. + /// Gets or sets the base path for API access. /// - /// The API client. - public ApiClient ApiClient; - - /// - /// Set the ApiClient using Default or ApiClient instance. - /// - /// An instance of ApiClient. - /// - public void setApiClientUsingDefault (ApiClient apiClient = null) - { - if (apiClient == null) - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = new ApiClient(); - - ApiClient = Default != null ? Default.ApiClient : new ApiClient(); - } - else - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = apiClient; - - ApiClient = apiClient; + public virtual string BasePath { + get { return _basePath; } + set { + _basePath = value; + // pass-through to ApiClient if it's set. + if(_apiClient != null) { + _apiClient.RestClient.BaseUrl = new Uri(_basePath); + } } } - private Dictionary _defaultHeaderMap = new Dictionary(); - /// /// Gets or sets the default header. /// - public Dictionary DefaultHeader + public virtual IDictionary DefaultHeader { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { - get { return _defaultHeaderMap; } + {{#netStandard}}get { return (int)ApiClient.RestClient.Timeout.GetValueOrDefault(TimeSpan.FromSeconds(0)).TotalMilliseconds; } + set { ApiClient.RestClient.Timeout = TimeSpan.FromMilliseconds(value); }{{/netStandard}}{{^netStandard}} + get { return ApiClient.RestClient.Timeout; } + set { ApiClient.RestClient.Timeout = value; }{{/netStandard}} + } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix (string apiKeyIdentifier) + { + var apiKeyValue = ""; + ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + var apiKeyPrefix = ""; + if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) + return apiKeyPrefix + " " + apiKeyValue; + else + return apiKeyValue; + } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } set { - _defaultHeaderMap = value; + if (string.IsNullOrEmpty(value)) + { + // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set. + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } } } + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + #endregion Properties + + #region Methods + /// /// Add default header. /// @@ -160,7 +392,38 @@ namespace {{packageName}}.Client /// public void AddDefaultHeader(string key, string value) { - _defaultHeaderMap[key] = value; + DefaultHeader[key] = value; + } + + /// + /// Creates a new based on this instance. + /// + /// + public ApiClient CreateApiClient() + { + return new ApiClient(BasePath) { Configuration = this }; + } + + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK ({{{packageName}}}) Debug Report:\n"; + {{^netStandard}} + {{^supportsUWP}} + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + {{/supportsUWP}} + {{/netStandard}} + {{#netStandard}} + report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; + {{/netStandard}} + report += " Version of the API: {{{version}}}\n"; + report += " SDK Package Version: {{{packageVersion}}}\n"; + + return report; } /// @@ -184,151 +447,6 @@ namespace {{packageName}}.Client ApiKeyPrefix[key] = value; } - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public String UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public String Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public String Password { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// The access token. - public String AccessToken { get; set; } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public Dictionary ApiKey = new Dictionary(); - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - public Dictionary ApiKeyPrefix = new Dictionary(); - - /// - /// Get the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix (string apiKeyIdentifier) - { - var apiKeyValue = ""; - ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); - var apiKeyPrefix = ""; - if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) - return apiKeyPrefix + " " + apiKeyValue; - else - return apiKeyValue; - } - - private string _tempFolderPath; - - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public String TempFolderPath - { - get - { - // default to Path.GetTempPath() if _tempFolderPath is not set - if (String.IsNullOrEmpty(_tempFolderPath)) - { - _tempFolderPath = Path.GetTempPath(); - } - return _tempFolderPath; - } - - set - { - if (String.IsNullOrEmpty(value)) - { - _tempFolderPath = value; - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - Directory.CreateDirectory(value); - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - _tempFolderPath = value; - else - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - - private const string ISO8601_DATETIME_FORMAT = "o"; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - - /// - /// Gets or sets the the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public String DateTimeFormat - { - get - { - return _dateTimeFormat; - } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Returns a string with essential information for debugging. - /// - public static String ToDebugReport() - { - String report = "C# SDK ({{{packageName}}}) Debug Report:\n"; - {{^netStandard}} - {{^supportsUWP}} - report += " OS: " + Environment.OSVersion + "\n"; - report += " .NET Framework Version: " + Assembly - .GetExecutingAssembly() - .GetReferencedAssemblies() - .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n"; - {{/supportsUWP}} - {{/netStandard}} - {{#netStandard}} - report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; - {{/netStandard}} - report += " Version of the API: {{{version}}}\n"; - report += " SDK Package Version: {{{packageVersion}}}\n"; - - return report; - } + #endregion Methods } } diff --git a/modules/swagger-codegen/src/main/resources/csharp/GlobalConfiguration.mustache b/modules/swagger-codegen/src/main/resources/csharp/GlobalConfiguration.mustache new file mode 100644 index 000000000000..b218d5cc3497 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/GlobalConfiguration.mustache @@ -0,0 +1,25 @@ +{{>partial_header}} + +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; + +namespace {{packageName}}.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .swagger-codegen-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/csharp/IReadableConfiguration.mustache b/modules/swagger-codegen/src/main/resources/csharp/IReadableConfiguration.mustache new file mode 100644 index 000000000000..ae2692f5d4ab --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/IReadableConfiguration.mustache @@ -0,0 +1,26 @@ +{{>partial_header}} + +using System.Collections.Generic; + +namespace {{packageName}}.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + string AccessToken { get; } + IDictionary ApiKey { get; } + IDictionary ApiKeyPrefix { get; } + string BasePath { get; } + string DateTimeFormat { get; } + IDictionary DefaultHeader { get; } + string Password { get; } + string TempFolderPath { get; } + int Timeout { get; } + string UserAgent { get; } + string Username { get; } + + string GetApiKeyWithPrefix(string apiKeyIdentifier); + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache index aef9b78ed4f8..4ea57bca477d 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache @@ -88,15 +88,9 @@ namespace {{packageName}}.{{apiPackage}} /// public {{classname}}(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -113,12 +107,6 @@ namespace {{packageName}}.{{apiPackage}} this.Configuration = configuration; ExceptionFactory = {{packageName}}.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -167,9 +155,9 @@ namespace {{packageName}}.{{apiPackage}} /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache index ff3cf4fc60ac..60bde9985e64 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache @@ -41,9 +41,9 @@ namespace Example {{/isBasic}} {{#isApiKey}} // Configure API key authorization: {{{name}}} - Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY"); + Configuration.Default.AddApiKey("{{{keyParamName}}}", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer"); + // Configuration.Default.AddApiKeyPrefix("{{{keyParamName}}}", "Bearer"); {{/isApiKey}} {{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs index 7f537b165588..283eec5a1450 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/FakeApiTests.cs @@ -1,3 +1,25 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using System; using System.IO; using System.Collections.Generic; @@ -9,6 +31,7 @@ using NUnit.Framework; using IO.Swagger.Client; using IO.Swagger.Api; +using IO.Swagger.Model; namespace IO.Swagger.Test { @@ -30,7 +53,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new FakeApi(); + instance = new FakeApi(); } /// @@ -48,32 +71,57 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi"); + // TODO uncomment below to test 'IsInstanceOfType' FakeApi + //Assert.IsInstanceOfType(typeof(FakeApi), instance, "instance is a FakeApi"); } + /// + /// Test TestClientModel + /// + [Test] + public void TestClientModelTest() + { + // TODO uncomment below to test the method and replace null with proper value + //ModelClient body = null; + //var response = instance.TestClientModel(body); + //Assert.IsInstanceOf (response, "response is ModelClient"); + } + /// /// Test TestEndpointParameters /// [Test] public void TestEndpointParametersTest() { - /* comment out the following as the endpiont is fake - // TODO: add unit test for the method 'TestEndpointParameters' - double? number = 12.3; // TODO: replace null with proper value - double? _double = 34.5; // TODO: replace null with proper value - string _string = "charp test"; // TODO: replace null with proper value - byte[] _byte = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };; // TODO: replace null with proper value - int? integer = 3; // TODO: replace null with proper value - int? int32 = 2; // TODO: replace null with proper value - long? int64 = 1; // TODO: replace null with proper value - float? _float = 7.8F; // TODO: replace null with proper value - byte[] binary = null; // TODO: replace null with proper value - DateTime? date = null; // TODO: replace null with proper value - DateTime? dateTime = null; // TODO: replace null with proper value - string password = null; // TODO: replace null with proper value - instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); - */ + // TODO uncomment below to test the method and replace null with proper value + //decimal? number = null; + //double? _double = null; + //string _string = null; + //byte[] _byte = null; + //int? integer = null; + //int? int32 = null; + //long? int64 = null; + //float? _float = null; + //byte[] binary = null; + //DateTime? date = null; + //DateTime? dateTime = null; + //string password = null; + //instance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password); + + } + + /// + /// Test TestEnumQueryParameters + /// + [Test] + public void TestEnumQueryParametersTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string enumQueryString = null; + //decimal? enumQueryInteger = null; + //double? enumQueryDouble = null; + //instance.TestEnumQueryParameters(enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs index 0d517af68b5a..a512676b08c5 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/PetApiTests.cs @@ -1,3 +1,25 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using System; using System.IO; using System.Collections.Generic; @@ -25,45 +47,6 @@ namespace IO.Swagger.Test { private PetApi instance; - private long petId = 11088; - - /// - /// Create a Pet object - /// - private Pet createPet() - { - // create pet - Pet p = new Pet(Name: "Csharp test", PhotoUrls: new List { "http://petstore.com/csharp_test" }); - p.Id = petId; - //p.Name = "Csharp test"; - p.Status = Pet.StatusEnum.Available; - // create Category object - Category category = new Category(); - category.Id = 56; - category.Name = "sample category name2"; - List photoUrls = new List(new String[] {"sample photoUrls"}); - // create Tag object - Tag tag = new Tag(); - tag.Id = petId; - tag.Name = "csharp sample tag name1"; - List tags = new List(new Tag[] {tag}); - p.Tags = tags; - p.Category = category; - p.PhotoUrls = photoUrls; - - return p; - } - - /// - /// Convert string to byte array - /// - private byte[] GetBytes(string str) - { - byte[] bytes = new byte[str.Length * sizeof(char)]; - System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length); - return bytes; - } - /// /// Setup before each unit test /// @@ -71,13 +54,6 @@ namespace IO.Swagger.Test public void Init() { instance = new PetApi(); - - // create pet - Pet p = createPet(); - - // add pet before testing - PetApi petApi = new PetApi("http://petstore.swagger.io/v2/"); - petApi.AddPet (p); } /// @@ -86,9 +62,7 @@ namespace IO.Swagger.Test [TearDown] public void Cleanup() { - // remove the pet after testing - PetApi petApi = new PetApi (); - petApi.DeletePet(petId, "test key"); + } /// @@ -97,7 +71,8 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi"); + // TODO uncomment below to test 'IsInstanceOfType' PetApi + //Assert.IsInstanceOfType(typeof(PetApi), instance, "instance is a PetApi"); } @@ -107,10 +82,10 @@ namespace IO.Swagger.Test [Test] public void AddPetTest() { - // create pet - Pet p = createPet(); - - instance.AddPet(p); + // TODO uncomment below to test the method and replace null with proper value + //Pet body = null; + //instance.AddPet(body); + } /// @@ -119,7 +94,11 @@ namespace IO.Swagger.Test [Test] public void DeletePetTest() { - // no need to test as it'c covered by Cleanup() already + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //string apiKey = null; + //instance.DeletePet(petId, apiKey); + } /// @@ -128,15 +107,10 @@ namespace IO.Swagger.Test [Test] public void FindPetsByStatusTest() { - PetApi petApi = new PetApi (); - List tagsList = new List(new String[] {"available"}); - - List listPet = petApi.FindPetsByTags (tagsList); - foreach (Pet pet in listPet) // Loop through List with foreach. - { - Assert.IsInstanceOfType(typeof(Pet), pet, "Response is a Pet"); - Assert.AreEqual ("csharp sample tag name1", pet.Tags[0]); - } + // TODO uncomment below to test the method and replace null with proper value + //List status = null; + //var response = instance.FindPetsByStatus(status); + //Assert.IsInstanceOf> (response, "response is List"); } /// @@ -145,9 +119,10 @@ namespace IO.Swagger.Test [Test] public void FindPetsByTagsTest() { - List tags = new List(new String[] {"pet"}); - var response = instance.FindPetsByTags(tags); - Assert.IsInstanceOfType(typeof(List), response, "response is List"); + // TODO uncomment below to test the method and replace null with proper value + //List tags = null; + //var response = instance.FindPetsByTags(tags); + //Assert.IsInstanceOf> (response, "response is List"); } /// @@ -156,96 +131,22 @@ namespace IO.Swagger.Test [Test] public void GetPetByIdTest() { - // set timeout to 10 seconds - Configuration c1 = new Configuration (timeout: 10000, userAgent: "TEST_USER_AGENT"); - - PetApi petApi = new PetApi (c1); - Pet response = petApi.GetPetById (petId); - Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); - - Assert.AreEqual ("Csharp test", response.Name); - Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - - Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - - Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array"); - Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - - Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); - Assert.AreEqual (56, response.Category.Id); - Assert.AreEqual ("sample category name2", response.Category.Name); + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //var response = instance.GetPetById(petId); + //Assert.IsInstanceOf (response, "response is Pet"); } - - /// - /// Test GetPetByIdAsync - /// - [Test ()] - public void TestGetPetByIdAsync () - { - PetApi petApi = new PetApi (); - var task = petApi.GetPetByIdAsync (petId); - Pet response = task.Result; - Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); - - Assert.AreEqual ("Csharp test", response.Name); - Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - - Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - - Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array"); - Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - - Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); - Assert.AreEqual (56, response.Category.Id); - Assert.AreEqual ("sample category name2", response.Category.Name); - - } - /// - /// Test GetPetByIdAsyncWithHttpInfo - /// - [Test ()] - public void TestGetPetByIdAsyncWithHttpInfo () - { - PetApi petApi = new PetApi (); - var task = petApi.GetPetByIdAsyncWithHttpInfo (petId); - - Assert.AreEqual (200, task.Result.StatusCode); - Assert.IsTrue (task.Result.Headers.ContainsKey("Content-Type")); - Assert.AreEqual (task.Result.Headers["Content-Type"], "application/json"); - - Pet response = task.Result.Data; - Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); - - Assert.AreEqual ("Csharp test", response.Name); - Assert.AreEqual (Pet.StatusEnum.Available, response.Status); - - Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual ("csharp sample tag name1", response.Tags [0].Name); - - Assert.IsInstanceOfType(typeof(List), response.PhotoUrls, "Response.PhotoUrls is a Array"); - Assert.AreEqual ("sample photoUrls", response.PhotoUrls [0]); - - Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); - Assert.AreEqual (56, response.Category.Id); - Assert.AreEqual ("sample category name2", response.Category.Name); - - } - /// /// Test UpdatePet /// [Test] public void UpdatePetTest() { - // create pet - Pet p = createPet(); - instance.UpdatePet(p); + // TODO uncomment below to test the method and replace null with proper value + //Pet body = null; + //instance.UpdatePet(body); + } /// @@ -254,24 +155,12 @@ namespace IO.Swagger.Test [Test] public void UpdatePetWithFormTest() { - PetApi petApi = new PetApi (); - petApi.UpdatePetWithForm (petId, "new form name", "pending"); - - Pet response = petApi.GetPetById (petId); - Assert.IsInstanceOfType(typeof(Pet), response, "Response is a Pet"); - Assert.IsInstanceOfType(typeof(Category), response.Category, "Response.Category is a Category"); - Assert.IsInstanceOfType(typeof(List), response.Tags, "Response.Tags is a Array"); - - Assert.AreEqual ("new form name", response.Name); - Assert.AreEqual (Pet.StatusEnum.Pending, response.Status); - - Assert.AreEqual (petId, response.Tags [0].Id); - Assert.AreEqual (56, response.Category.Id); - - // test optional parameter - petApi.UpdatePetWithForm (petId, "new form name2"); - Pet response2 = petApi.GetPetById (petId); - Assert.AreEqual ("new form name2", response2.Name); + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //string name = null; + //string status = null; + //instance.UpdatePetWithForm(petId, name, status); + } /// @@ -280,45 +169,13 @@ namespace IO.Swagger.Test [Test] public void UploadFileTest() { - Assembly _assembly = Assembly.GetExecutingAssembly(); - Stream _imageStream = _assembly.GetManifestResourceStream("IO.Swagger.Test.swagger-logo.png"); - PetApi petApi = new PetApi (); - // test file upload with form parameters - petApi.UploadFile(petId, "new form name", _imageStream); - - // test file upload without any form parameters - // using optional parameter syntax introduced at .net 4.0 - petApi.UploadFile(petId: petId, file: _imageStream); - + // TODO uncomment below to test the method and replace null with proper value + //long? petId = null; + //string additionalMetadata = null; + //System.IO.Stream file = null; + //var response = instance.UploadFile(petId, additionalMetadata, file); + //Assert.IsInstanceOf (response, "response is ApiResponse"); } - - /// - /// Test status code - /// - [Test ()] - public void TestStatusCodeAndHeader () - { - PetApi petApi = new PetApi (); - var response = petApi.GetPetByIdWithHttpInfo (petId); - Assert.AreEqual (response.StatusCode, 200); - Assert.IsTrue (response.Headers.ContainsKey("Content-Type")); - Assert.AreEqual (response.Headers["Content-Type"], "application/json"); - } - - /// - /// Test default header (should be deprecated - /// - [Test ()] - public void TestDefaultHeader () - { - PetApi petApi = new PetApi (); - // commented out the warning test below as it's confirmed the warning is working as expected - // there should be a warning for using AddDefaultHeader (deprecated) below - //petApi.AddDefaultHeader ("header_key", "header_value"); - // the following should be used instead as suggested in the doc - petApi.Configuration.AddDefaultHeader ("header_key2", "header_value2"); - - } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs index 2ca3b35f30df..b7de1d862dcf 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/StoreApiTests.cs @@ -1,3 +1,25 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using System; using System.IO; using System.Collections.Generic; @@ -6,7 +28,6 @@ using System.Linq; using System.Reflection; using RestSharp; using NUnit.Framework; -using Newtonsoft.Json; using IO.Swagger.Client; using IO.Swagger.Api; @@ -32,7 +53,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new StoreApi(); + instance = new StoreApi(); } /// @@ -50,7 +71,8 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi"); + // TODO uncomment below to test 'IsInstanceOfType' StoreApi + //Assert.IsInstanceOfType(typeof(StoreApi), instance, "instance is a StoreApi"); } @@ -60,8 +82,8 @@ namespace IO.Swagger.Test [Test] public void DeleteOrderTest() { - // TODO: add unit test for the method 'DeleteOrder' - //string orderId = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //string orderId = null; //instance.DeleteOrder(orderId); } @@ -72,20 +94,9 @@ namespace IO.Swagger.Test [Test] public void GetInventoryTest() { - // TODO: add unit test for the method 'GetInventory' + // TODO uncomment below to test the method and replace null with proper value //var response = instance.GetInventory(); //Assert.IsInstanceOf> (response, "response is Dictionary"); - - // set timeout to 10 seconds - Configuration c1 = new Configuration (timeout: 10000); - - StoreApi storeApi = new StoreApi (c1); - Dictionary response = storeApi.GetInventory (); - - foreach(KeyValuePair entry in response) - { - Assert.IsInstanceOfType(typeof(int?), entry.Value); - } } /// @@ -94,8 +105,8 @@ namespace IO.Swagger.Test [Test] public void GetOrderByIdTest() { - // TODO: add unit test for the method 'GetOrderById' - //long? orderId = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //long? orderId = null; //var response = instance.GetOrderById(orderId); //Assert.IsInstanceOf (response, "response is Order"); } @@ -106,42 +117,12 @@ namespace IO.Swagger.Test [Test] public void PlaceOrderTest() { - // TODO: add unit test for the method 'PlaceOrder' - //Order body = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //Order body = null; //var response = instance.PlaceOrder(body); //Assert.IsInstanceOf (response, "response is Order"); } - /// - /// Test Enum - /// - [Test ()] - public void TestEnum () - { - Assert.AreEqual (Order.StatusEnum.Approved.ToString(), "Approved"); - } - - /// - /// Test deserialization of JSON to Order and its readonly property - /// - [Test ()] - public void TesOrderDeserialization() - { - string json = @"{ -'id': 1982, -'petId': 1020, -'quantity': 1, -'status': 'placed', -'complete': true, -}"; - var o = JsonConvert.DeserializeObject(json); - Assert.AreEqual (1982, o.Id); - Assert.AreEqual (1020, o.PetId); - Assert.AreEqual (1, o.Quantity); - Assert.AreEqual (Order.StatusEnum.Placed, o.Status); - Assert.AreEqual (true, o.Complete); - - } } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs index 31edf4929234..ff5fdf17ad82 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/UserApiTests.cs @@ -1,3 +1,25 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + using System; using System.IO; using System.Collections.Generic; @@ -31,7 +53,7 @@ namespace IO.Swagger.Test [SetUp] public void Init() { - instance = new UserApi(); + instance = new UserApi(); } /// @@ -49,7 +71,8 @@ namespace IO.Swagger.Test [Test] public void InstanceTest() { - Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi"); + // TODO uncomment below to test 'IsInstanceOfType' UserApi + //Assert.IsInstanceOfType(typeof(UserApi), instance, "instance is a UserApi"); } @@ -59,8 +82,8 @@ namespace IO.Swagger.Test [Test] public void CreateUserTest() { - // TODO: add unit test for the method 'CreateUser' - //User body = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //User body = null; //instance.CreateUser(body); } @@ -71,8 +94,8 @@ namespace IO.Swagger.Test [Test] public void CreateUsersWithArrayInputTest() { - // TODO: add unit test for the method 'CreateUsersWithArrayInput' - //List body = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //List body = null; //instance.CreateUsersWithArrayInput(body); } @@ -83,8 +106,8 @@ namespace IO.Swagger.Test [Test] public void CreateUsersWithListInputTest() { - // TODO: add unit test for the method 'CreateUsersWithListInput' - //List body = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //List body = null; //instance.CreateUsersWithListInput(body); } @@ -95,8 +118,8 @@ namespace IO.Swagger.Test [Test] public void DeleteUserTest() { - // TODO: add unit test for the method 'DeleteUser' - //string username = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //string username = null; //instance.DeleteUser(username); } @@ -107,8 +130,8 @@ namespace IO.Swagger.Test [Test] public void GetUserByNameTest() { - // TODO: add unit test for the method 'GetUserByName' - //string username = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //string username = null; //var response = instance.GetUserByName(username); //Assert.IsInstanceOf (response, "response is User"); } @@ -119,9 +142,9 @@ namespace IO.Swagger.Test [Test] public void LoginUserTest() { - // TODO: add unit test for the method 'LoginUser' - //string username = null; // TODO: replace null with proper value - //string password = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //string password = null; //var response = instance.LoginUser(username, password); //Assert.IsInstanceOf (response, "response is string"); } @@ -132,7 +155,7 @@ namespace IO.Swagger.Test [Test] public void LogoutUserTest() { - // TODO: add unit test for the method 'LogoutUser' + // TODO uncomment below to test the method and replace null with proper value //instance.LogoutUser(); } @@ -143,9 +166,9 @@ namespace IO.Swagger.Test [Test] public void UpdateUserTest() { - // TODO: add unit test for the method 'UpdateUser' - //string username = null; // TODO: replace null with proper value - //User body = null; // TODO: replace null with proper value + // TODO uncomment below to test the method and replace null with proper value + //string username = null; + //User body = null; //instance.UpdateUser(username, body); } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs index 4f31bc0b3028..8b10afdeb0e6 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ApiClientTests.cs @@ -13,6 +13,13 @@ namespace IO.Swagger.Test { } + [SetUp()] + public void BeforeEach() + { + var config = new GlobalConfiguration(); + Configuration.Default = config; + } + [TearDown()] public void TearDown() { @@ -117,33 +124,5 @@ namespace IO.Swagger.Test Assert.AreEqual("sun.gif", ApiClient.SanitizeFilename(".\\sun.gif")); } - - [Test ()] - public void TestApiClientInstance () - { - PetApi p1 = new PetApi (); - PetApi p2 = new PetApi (); - - Configuration c1 = new Configuration (); // using default ApiClient - PetApi p3 = new PetApi (c1); - - ApiClient a1 = new ApiClient(); - Configuration c2 = new Configuration (a1); // using "a1" as the ApiClient - PetApi p4 = new PetApi (c2); - - - // ensure both using the same default ApiClient - Assert.AreSame(p1.Configuration.ApiClient, p2.Configuration.ApiClient); - Assert.AreSame(p1.Configuration.ApiClient, Configuration.Default.ApiClient); - - // ensure both using the same default ApiClient - Assert.AreSame(p3.Configuration.ApiClient, c1.ApiClient); - Assert.AreSame(p3.Configuration.ApiClient, Configuration.Default.ApiClient); - - // ensure it's not using the default ApiClient - Assert.AreSame(p4.Configuration.ApiClient, c2.ApiClient); - Assert.AreNotSame(p4.Configuration.ApiClient, Configuration.Default.ApiClient); - - } } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs index 936751317abc..f2af87bb2426 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Client/ConfigurationTests.cs @@ -13,9 +13,12 @@ namespace IO.Swagger.Test { } - [TearDown ()] - public void TearDown () + [SetUp()] + public void BeforeEach() { + var config = new GlobalConfiguration(); + Configuration.Default = config; + // Reset to default, just in case Configuration.Default.DateTimeFormat = "o"; } @@ -35,7 +38,7 @@ namespace IO.Swagger.Test [Test ()] public void TestBasePath () - { + { PetApi p = new PetApi ("http://new-basepath.com"); Assert.AreEqual (p.Configuration.ApiClient.RestClient.BaseUrl, "http://new-basepath.com"); // Given that PetApi is initailized with a base path, a new configuration (with a new ApiClient) @@ -59,10 +62,20 @@ namespace IO.Swagger.Test Assert.AreEqual("u", Configuration.Default.DateTimeFormat); } - [Test ()] - public void TestConstructor() + [Test()] + public void TestDateTimeFormat_UType_NonGlobal() { - Configuration c = new Configuration (username: "test username", password: "test password"); + Configuration configuration = new Configuration(); + configuration.DateTimeFormat = "u"; + + Assert.AreEqual("u", configuration.DateTimeFormat); + Assert.AreNotEqual("u", Configuration.Default.DateTimeFormat); + } + + [Test ()] + public void TestConstruction() + { + Configuration c = new Configuration { Username = "test username", Password = "test password" }; Assert.AreEqual (c.Username, "test username"); Assert.AreEqual (c.Password, "test password"); @@ -70,7 +83,7 @@ namespace IO.Swagger.Test [Test ()] public void TestDefautlConfiguration () - { + { PetApi p1 = new PetApi (); PetApi p2 = new PetApi (); Assert.AreSame (p1.Configuration, p2.Configuration); @@ -92,7 +105,7 @@ namespace IO.Swagger.Test public void TestUsage () { // basic use case using default base URL - PetApi p1 = new PetApi (); + PetApi p1 = new PetApi (); Assert.AreSame (p1.Configuration, Configuration.Default, "PetApi should use default configuration"); // using a different base URL @@ -104,11 +117,11 @@ namespace IO.Swagger.Test PetApi p3 = new PetApi (c1); Assert.AreSame (p3.Configuration, c1); - // using a different base URL via a new ApiClient - ApiClient a1 = new ApiClient ("http://new-api-client.com"); - Configuration c2 = new Configuration (a1); + // using a different base URL via a new Configuration + String newApiClientUrl = "http://new-api-client.com"; + Configuration c2 = new Configuration { BasePath = newApiClientUrl }; PetApi p4 = new PetApi (c2); - Assert.AreSame (p4.Configuration.ApiClient, a1); + Assert.AreEqual(p4.Configuration.ApiClient.RestClient.BaseUrl, new Uri(newApiClientUrl)); } [Test ()] @@ -120,10 +133,39 @@ namespace IO.Swagger.Test c1.Timeout = 50000; Assert.AreEqual (50000, c1.Timeout); - Configuration c2 = new Configuration (timeout: 20000); + Configuration c2 = new Configuration { Timeout = 20000 }; Assert.AreEqual (20000, c2.Timeout); } + [Test()] + public void TestAddingInstanceHeadersDoesNotModifyGlobal() + { + // Arrange + Configuration.Default.DefaultHeader.Add("Content-Type", "application/json"); + Configuration.Default.ApiKey.Add("api_key_identifier", "1233456778889900"); + Configuration.Default.ApiKeyPrefix.Add("api_key_identifier", "PREFIX"); + + Configuration c = new Configuration( + Configuration.Default.DefaultHeader, + Configuration.Default.ApiKey, + Configuration.Default.ApiKeyPrefix + ); + + // sanity + CollectionAssert.AreEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader); + CollectionAssert.AreEquivalent(c.ApiKey, Configuration.Default.ApiKey); + CollectionAssert.AreEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix); + + // Act + Configuration.Default.DefaultHeader["Content-Type"] = "application/xml"; + Configuration.Default.ApiKey["api_key_identifier"] = "00000000000001234"; + Configuration.Default.ApiKeyPrefix["api_key_identifier"] = "MODIFIED"; + + // Assert + CollectionAssert.AreNotEquivalent(c.DefaultHeader, Configuration.Default.DefaultHeader); + CollectionAssert.AreNotEquivalent(c.ApiKey, Configuration.Default.ApiKey); + CollectionAssert.AreNotEquivalent(c.ApiKeyPrefix, Configuration.Default.ApiKeyPrefix); + } } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 3122ce1f81ca..ca11ccbf6153 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -7,6 +7,18 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io Generated by: https://github.com/swagger-api/swagger-codegen.git + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> @@ -75,7 +87,7 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git - {1230F4B8-71F8-4A8C-966F-2E10106EA239} + {391DEE9D-C48B-4846-838D-E96F4BC01E1D} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index 9cedd3045da6..a44a589dc88d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -416,15 +416,9 @@ namespace IO.Swagger.Api /// public FakeApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -441,12 +435,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -495,9 +483,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs index a2ac952b00a7..72d9b04836b3 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs @@ -84,15 +84,9 @@ namespace IO.Swagger.Api /// public Fake_classname_tags123Api(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -109,12 +103,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -163,9 +151,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs index 3d1f1ea9c608..6ebddb476f46 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/PetApi.cs @@ -398,15 +398,9 @@ namespace IO.Swagger.Api /// public PetApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -423,12 +417,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -477,9 +465,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs index 04cd66ef1172..1317209a857c 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/StoreApi.cs @@ -206,15 +206,9 @@ namespace IO.Swagger.Api /// public StoreApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -231,12 +225,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -285,9 +273,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs index 81e0a6fb4c7f..8fe02dff0ec1 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/UserApi.cs @@ -382,15 +382,9 @@ namespace IO.Swagger.Api /// public UserApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -407,12 +401,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -461,9 +449,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs index 6531cc1a0261..32545398ce45 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/ApiClient.cs @@ -48,11 +48,11 @@ namespace IO.Swagger.Client /// /// Initializes a new instance of the class - /// with default configuration and base path (http://petstore.swagger.io:80/v2). + /// with default configuration. /// public ApiClient() { - Configuration = Configuration.Default; + Configuration = IO.Swagger.Client.Configuration.Default; RestClient = new RestClient("http://petstore.swagger.io:80/v2"); } @@ -61,14 +61,11 @@ namespace IO.Swagger.Client /// with default base path (http://petstore.swagger.io:80/v2). /// /// An instance of Configuration. - public ApiClient(Configuration config = null) + public ApiClient(Configuration config) { - if (config == null) - Configuration = Configuration.Default; - else - Configuration = config; + Configuration = config ?? IO.Swagger.Client.Configuration.Default; - RestClient = new RestClient("http://petstore.swagger.io:80/v2"); + RestClient = new RestClient(Configuration.BasePath); } /// @@ -82,7 +79,7 @@ namespace IO.Swagger.Client throw new ArgumentException("basePath cannot be empty"); RestClient = new RestClient(basePath); - Configuration = Configuration.Default; + Configuration = Client.Configuration.Default; } /// @@ -93,10 +90,15 @@ namespace IO.Swagger.Client public static ApiClient Default; /// - /// Gets or sets the Configuration. + /// Gets or sets an instance of the IReadableConfiguration. /// - /// An instance of the Configuration. - public Configuration Configuration { get; set; } + /// An instance of the IReadableConfiguration. + /// + /// helps us to avoid modifying possibly global + /// configuration values from within a given client. It does not gaurantee thread-safety + /// of the instance in any way. + /// + public IReadableConfiguration Configuration { get; set; } /// /// Gets or sets the RestClient. @@ -174,6 +176,7 @@ namespace IO.Swagger.Client pathParams, contentType); // set timeout + RestClient.Timeout = Configuration.Timeout; // set user agent RestClient.UserAgent = Configuration.UserAgent; @@ -286,6 +289,7 @@ namespace IO.Swagger.Client return response.RawBytes; } + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) if (type == typeof(Stream)) { if (headers != null) diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs index fce50ae0b743..1e1e12c35229 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/Configuration.cs @@ -10,6 +10,7 @@ using System; using System.Reflection; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -20,10 +21,147 @@ namespace IO.Swagger.Client /// /// Represents a set of configuration settings /// - public class Configuration + public class Configuration : IReadableConfiguration { + #region Constants + /// - /// Initializes a new instance of the Configuration class with different settings + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + private static readonly object GlobalConfigSync = new { }; + private static Configuration _globalConfiguration; + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.Content), + response.Content); + } + if (status == 0) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); + } + return null; + }; + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static Configuration Default + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + + #endregion Static Members + + #region Private Members + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + private IDictionary _apiKey = null; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix = null; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + #endregion Private Members + + #region Constructors + + static Configuration() + { + _globalConfiguration = new GlobalConfiguration(); + } + + /// + /// Initializes a new instance of the class + /// + public Configuration() + { + UserAgent = "Swagger-Codegen/1.0.0/csharp"; + BasePath = "http://petstore.swagger.io:80/v2"; + DefaultHeader = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + public Configuration( + IDictionary defaultHeader, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "http://petstore.swagger.io:80/v2") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeader == null) + throw new ArgumentNullException("defaultHeader"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeader) + { + DefaultHeader.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + /// + /// Initializes a new instance of the class with different settings /// /// Api client /// Dictionary of default HTTP header @@ -36,129 +174,224 @@ namespace IO.Swagger.Client /// DateTime format string /// HTTP connection timeout (in milliseconds) /// HTTP user agent - public Configuration(ApiClient apiClient = null, - Dictionary defaultHeader = null, - string username = null, - string password = null, - string accessToken = null, - Dictionary apiKey = null, - Dictionary apiKeyPrefix = null, - string tempFolderPath = null, - string dateTimeFormat = null, - int timeout = 100000, - string userAgent = "Swagger-Codegen/1.0.0/csharp" - ) + [Obsolete("Use explicit object construction and setting of properties.", true)] + public Configuration( + // ReSharper disable UnusedParameter.Local + ApiClient apiClient = null, + IDictionary defaultHeader = null, + string username = null, + string password = null, + string accessToken = null, + IDictionary apiKey = null, + IDictionary apiKeyPrefix = null, + string tempFolderPath = null, + string dateTimeFormat = null, + int timeout = 100000, + string userAgent = "Swagger-Codegen/1.0.0/csharp" + // ReSharper restore UnusedParameter.Local + ) { - setApiClientUsingDefault(apiClient); - Username = username; - Password = password; - AccessToken = accessToken; - UserAgent = userAgent; - - if (defaultHeader != null) - DefaultHeader = defaultHeader; - if (apiKey != null) - ApiKey = apiKey; - if (apiKeyPrefix != null) - ApiKeyPrefix = apiKeyPrefix; - - TempFolderPath = tempFolderPath; - DateTimeFormat = dateTimeFormat; - Timeout = timeout; } /// /// Initializes a new instance of the Configuration class. /// /// Api client. + [Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)] + // ReSharper disable once UnusedParameter.Local public Configuration(ApiClient apiClient) { - setApiClientUsingDefault(apiClient); + } - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "1.0.0"; + #endregion Constructors - /// - /// Gets or sets the default Configuration. - /// - /// Configuration. - public static Configuration Default = new Configuration(); + #region Properties + + private ApiClient _apiClient = null; /// - /// Default creation of exceptions for a given method name and response object + /// Gets an instance of an ApiClient for this configuration /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + public virtual ApiClient ApiClient { - int status = (int) response.StatusCode; - if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); - if (status == 0) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); - return null; - }; - - /// - /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. - /// - /// Timeout. - public int Timeout - { - get { return ApiClient.RestClient.Timeout; } - - set + get { - if (ApiClient != null) - ApiClient.RestClient.Timeout = value; + if (_apiClient == null) _apiClient = CreateApiClient(); + return _apiClient; } } + private String _basePath = null; /// - /// Gets or sets the default API client for making HTTP calls. + /// Gets or sets the base path for API access. /// - /// The API client. - public ApiClient ApiClient; - - /// - /// Set the ApiClient using Default or ApiClient instance. - /// - /// An instance of ApiClient. - /// - public void setApiClientUsingDefault (ApiClient apiClient = null) - { - if (apiClient == null) - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = new ApiClient(); - - ApiClient = Default != null ? Default.ApiClient : new ApiClient(); - } - else - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = apiClient; - - ApiClient = apiClient; + public virtual string BasePath { + get { return _basePath; } + set { + _basePath = value; + // pass-through to ApiClient if it's set. + if(_apiClient != null) { + _apiClient.RestClient.BaseUrl = new Uri(_basePath); + } } } - private Dictionary _defaultHeaderMap = new Dictionary(); - /// /// Gets or sets the default header. /// - public Dictionary DefaultHeader + public virtual IDictionary DefaultHeader { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { - get { return _defaultHeaderMap; } + + get { return ApiClient.RestClient.Timeout; } + set { ApiClient.RestClient.Timeout = value; } + } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix (string apiKeyIdentifier) + { + var apiKeyValue = ""; + ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + var apiKeyPrefix = ""; + if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) + return apiKeyPrefix + " " + apiKeyValue; + else + return apiKeyValue; + } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } set { - _defaultHeaderMap = value; + if (string.IsNullOrEmpty(value)) + { + // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set. + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } } } + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + #endregion Properties + + #region Methods + /// /// Add default header. /// @@ -167,7 +400,31 @@ namespace IO.Swagger.Client /// public void AddDefaultHeader(string key, string value) { - _defaultHeaderMap[key] = value; + DefaultHeader[key] = value; + } + + /// + /// Creates a new based on this instance. + /// + /// + public ApiClient CreateApiClient() + { + return new ApiClient(BasePath) { Configuration = this }; + } + + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (IO.Swagger) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; } /// @@ -191,144 +448,6 @@ namespace IO.Swagger.Client ApiKeyPrefix[key] = value; } - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public String UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public String Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public String Password { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// The access token. - public String AccessToken { get; set; } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public Dictionary ApiKey = new Dictionary(); - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - public Dictionary ApiKeyPrefix = new Dictionary(); - - /// - /// Get the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix (string apiKeyIdentifier) - { - var apiKeyValue = ""; - ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); - var apiKeyPrefix = ""; - if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) - return apiKeyPrefix + " " + apiKeyValue; - else - return apiKeyValue; - } - - private string _tempFolderPath; - - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public String TempFolderPath - { - get - { - // default to Path.GetTempPath() if _tempFolderPath is not set - if (String.IsNullOrEmpty(_tempFolderPath)) - { - _tempFolderPath = Path.GetTempPath(); - } - return _tempFolderPath; - } - - set - { - if (String.IsNullOrEmpty(value)) - { - _tempFolderPath = value; - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - Directory.CreateDirectory(value); - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - _tempFolderPath = value; - else - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - - private const string ISO8601_DATETIME_FORMAT = "o"; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - - /// - /// Gets or sets the the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public String DateTimeFormat - { - get - { - return _dateTimeFormat; - } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Returns a string with essential information for debugging. - /// - public static String ToDebugReport() - { - String report = "C# SDK (IO.Swagger) Debug Report:\n"; - report += " OS: " + Environment.OSVersion + "\n"; - report += " .NET Framework Version: " + Assembly - .GetExecutingAssembly() - .GetReferencedAssemblies() - .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n"; - report += " Version of the API: 1.0.0\n"; - report += " SDK Package Version: 1.0.0\n"; - - return report; - } + #endregion Methods } } diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/GlobalConfiguration.cs new file mode 100644 index 000000000000..d8b196fc3e8b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/GlobalConfiguration.cs @@ -0,0 +1,34 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; + +namespace IO.Swagger.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .swagger-codegen-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IReadableConfiguration.cs new file mode 100644 index 000000000000..ed1b6eddeacf --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Client/IReadableConfiguration.cs @@ -0,0 +1,35 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System.Collections.Generic; + +namespace IO.Swagger.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + string AccessToken { get; } + IDictionary ApiKey { get; } + IDictionary ApiKeyPrefix { get; } + string BasePath { get; } + string DateTimeFormat { get; } + IDictionary DefaultHeader { get; } + string Password { get; } + string TempFolderPath { get; } + int Timeout { get; } + string UserAgent { get; } + string Username { get; } + + string GetApiKeyWithPrefix(string apiKeyIdentifier); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.swagger-codegen/VERSION b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.swagger-codegen/VERSION new file mode 100644 index 000000000000..f9f7450d1359 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md index 2ffa0ef9f643..669dc91ea83d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md @@ -47,7 +47,7 @@ namespace Example { public void main() { - + var apiInstance = new FakeApi(); var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) @@ -60,6 +60,7 @@ namespace Example { Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); } + } } } @@ -79,6 +80,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -112,10 +114,8 @@ Class | Method | HTTP request | Description - [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [Model.ArrayTest](docs/ArrayTest.md) - [Model.Capitalization](docs/Capitalization.md) - - [Model.Cat](docs/Cat.md) - [Model.Category](docs/Category.md) - [Model.ClassModel](docs/ClassModel.md) - - [Model.Dog](docs/Dog.md) - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) @@ -140,6 +140,8 @@ Class | Method | HTTP request | Description - [Model.SpecialModelName](docs/SpecialModelName.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) + - [Model.Cat](docs/Cat.md) + - [Model.Dog](docs/Dog.md) diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md index 1277461eb1d2..41bddd87b494 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md @@ -35,7 +35,6 @@ namespace Example { public void main() { - var apiInstance = new FakeApi(); var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) @@ -96,7 +95,6 @@ namespace Example { public void main() { - var apiInstance = new FakeApi(); var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional) @@ -157,7 +155,6 @@ namespace Example { public void main() { - var apiInstance = new FakeApi(); var body = new OuterNumber(); // OuterNumber | Input number as post body (optional) @@ -218,7 +215,6 @@ namespace Example { public void main() { - var apiInstance = new FakeApi(); var body = new OuterString(); // OuterString | Input string as post body (optional) @@ -279,7 +275,6 @@ namespace Example { public void main() { - var apiInstance = new FakeApi(); var body = new ModelClient(); // ModelClient | client model @@ -341,7 +336,6 @@ namespace Example { public void main() { - // Configure HTTP basic authorization: http_basic_test Configuration.Default.Username = "YOUR_USERNAME"; Configuration.Default.Password = "YOUR_PASSWORD"; @@ -432,7 +426,6 @@ namespace Example { public void main() { - var apiInstance = new FakeApi(); var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md similarity index 99% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Fake_classname_tags123Api.md rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md index eba49c5a842f..9db41af1c5d5 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Fake_classname_tags123Api.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/Fake_classname_tags123Api.md @@ -27,7 +27,6 @@ namespace Example { public void main() { - var apiInstance = new Fake_classname_tags123Api(); var body = new ModelClient(); // ModelClient | client model diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AnimalFarm.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterBoolean.md similarity index 89% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AnimalFarm.md rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterBoolean.md index 4d1cccb0cefe..84845b35e545 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AnimalFarm.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterBoolean.md @@ -1,4 +1,4 @@ -# IO.Swagger.Model.AnimalFarm +# IO.Swagger.Model.OuterBoolean ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterComposite.md similarity index 53% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AdditionalPropertiesClass.md rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterComposite.md index ac4f9d10798e..41fae66f1363 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterComposite.md @@ -1,10 +1,11 @@ -# IO.Swagger.Model.AdditionalPropertiesClass +# IO.Swagger.Model.OuterComposite ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**MapProperty** | **Dictionary<string, string>** | | [optional] -**MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional] +**MyString** | [**OuterString**](OuterString.md) | | [optional] +**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumClass.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterNumber.md similarity index 89% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumClass.md rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterNumber.md index d936aad6f0b2..7c88274d6ee8 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumClass.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterNumber.md @@ -1,4 +1,4 @@ -# IO.Swagger.Model.EnumClass +# IO.Swagger.Model.OuterNumber ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/OuterEnum.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterString.md similarity index 89% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/docs/OuterEnum.md rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterString.md index 55eb118a3496..524423a5dab2 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/OuterEnum.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/OuterString.md @@ -1,4 +1,4 @@ -# IO.Swagger.Model.OuterEnum +# IO.Swagger.Model.OuterString ## Properties Name | Type | Description | Notes diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md index f3f49f5ed5b8..148d49b8b88c 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/PetApi.md @@ -36,7 +36,6 @@ namespace Example { public void main() { - // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; @@ -100,7 +99,6 @@ namespace Example { public void main() { - // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; @@ -166,7 +164,6 @@ namespace Example { public void main() { - // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; @@ -231,7 +228,6 @@ namespace Example { public void main() { - // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; @@ -296,7 +292,6 @@ namespace Example { public void main() { - // Configure API key authorization: api_key Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed @@ -363,7 +358,6 @@ namespace Example { public void main() { - // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; @@ -427,7 +421,6 @@ namespace Example { public void main() { - // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; @@ -495,7 +488,6 @@ namespace Example { public void main() { - // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md index bf2fdb1ed6d5..1509a03158fa 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/StoreApi.md @@ -32,7 +32,6 @@ namespace Example { public void main() { - var apiInstance = new StoreApi(); var orderId = orderId_example; // string | ID of the order that needs to be deleted @@ -93,7 +92,6 @@ namespace Example { public void main() { - // Configure API key authorization: api_key Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed @@ -156,7 +154,6 @@ namespace Example { public void main() { - var apiInstance = new StoreApi(); var orderId = 789; // long? | ID of pet that needs to be fetched @@ -218,7 +215,6 @@ namespace Example { public void main() { - var apiInstance = new StoreApi(); var body = new Order(); // Order | order placed for purchasing the pet diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md index 78553f5b3854..0ddde3f669c8 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/UserApi.md @@ -36,7 +36,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); var body = new User(); // User | Created user object @@ -97,7 +96,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); var body = new List(); // List | List of user object @@ -158,7 +156,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); var body = new List(); // List | List of user object @@ -219,7 +216,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); var username = username_example; // string | The name that needs to be deleted @@ -280,7 +276,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. @@ -342,7 +337,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); var username = username_example; // string | The user name for login var password = password_example; // string | The password for login in clear text @@ -406,7 +400,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); try @@ -463,7 +456,6 @@ namespace Example { public void main() { - var apiInstance = new UserApi(); var username = username_example; // string | name that need to be deleted var body = new User(); // User | Updated user object diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs index dff670d8a6c9..2a053d7821a0 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs @@ -416,15 +416,9 @@ namespace IO.Swagger.Api /// public FakeApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -441,12 +435,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -495,9 +483,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// @@ -535,7 +523,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/boolean"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -579,7 +567,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); - } /// @@ -606,7 +593,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/boolean"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -650,7 +637,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); - } /// @@ -676,7 +662,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/composite"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -720,7 +706,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); - } /// @@ -747,7 +732,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/composite"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -791,7 +776,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); - } /// @@ -817,7 +801,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/number"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -861,7 +845,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); - } /// @@ -888,7 +871,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/number"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -932,7 +915,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); - } /// @@ -958,7 +940,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/string"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1002,7 +984,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); - } /// @@ -1029,7 +1010,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake/outer/string"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1073,7 +1054,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); - } /// @@ -1102,7 +1082,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1177,7 +1157,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1285,7 +1265,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1409,7 +1389,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1507,7 +1487,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1527,9 +1507,9 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (enumQueryStringArray != null) localVarQueryParams.Add("enum_query_string_array", Configuration.ApiClient.ParameterToString(enumQueryStringArray)); // query parameter - if (enumQueryString != null) localVarQueryParams.Add("enum_query_string", Configuration.ApiClient.ParameterToString(enumQueryString)); // query parameter - if (enumQueryInteger != null) localVarQueryParams.Add("enum_query_integer", Configuration.ApiClient.ParameterToString(enumQueryInteger)); // query parameter + if (enumQueryStringArray != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "enum_query_string_array", enumQueryStringArray)); // query parameter + if (enumQueryString != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_string", enumQueryString)); // query parameter + if (enumQueryInteger != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_integer", enumQueryInteger)); // query parameter if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter @@ -1592,7 +1572,7 @@ namespace IO.Swagger.Api var localVarPath = "./fake"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1612,9 +1592,9 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (enumQueryStringArray != null) localVarQueryParams.Add("enum_query_string_array", Configuration.ApiClient.ParameterToString(enumQueryStringArray)); // query parameter - if (enumQueryString != null) localVarQueryParams.Add("enum_query_string", Configuration.ApiClient.ParameterToString(enumQueryString)); // query parameter - if (enumQueryInteger != null) localVarQueryParams.Add("enum_query_integer", Configuration.ApiClient.ParameterToString(enumQueryInteger)); // query parameter + if (enumQueryStringArray != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "enum_query_string_array", enumQueryStringArray)); // query parameter + if (enumQueryString != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_string", enumQueryString)); // query parameter + if (enumQueryInteger != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_integer", enumQueryInteger)); // query parameter if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/Fake_classname_tags123Api.cs similarity index 95% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/Fake_classname_tags123Api.cs index d3c765115894..8c9f9c83fe1c 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/Fake_classname_tags123Api.cs @@ -84,15 +84,9 @@ namespace IO.Swagger.Api /// public Fake_classname_tags123Api(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -109,12 +103,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -163,9 +151,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// @@ -252,7 +240,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - } /// @@ -328,7 +315,6 @@ namespace IO.Swagger.Api return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs index aee02b4ceb35..0a95c0e99ba1 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/PetApi.cs @@ -398,15 +398,9 @@ namespace IO.Swagger.Api /// public PetApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -423,12 +417,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -477,9 +465,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// @@ -519,7 +507,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -601,7 +589,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -684,7 +672,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -760,7 +748,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -834,7 +822,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/findByStatus"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -854,7 +842,7 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (status != null) localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter + if (status != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "status", status)); // query parameter // authentication (petstore_auth) required // oauth required @@ -908,7 +896,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/findByStatus"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -928,7 +916,7 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (status != null) localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter + if (status != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "status", status)); // query parameter // authentication (petstore_auth) required // oauth required @@ -981,7 +969,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/findByTags"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1001,7 +989,7 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (tags != null) localVarQueryParams.Add("tags", Configuration.ApiClient.ParameterToString(tags)); // query parameter + if (tags != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "tags", tags)); // query parameter // authentication (petstore_auth) required // oauth required @@ -1055,7 +1043,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/findByTags"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1075,7 +1063,7 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (tags != null) localVarQueryParams.Add("tags", Configuration.ApiClient.ParameterToString(tags)); // query parameter + if (tags != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "tags", tags)); // query parameter // authentication (petstore_auth) required // oauth required @@ -1128,7 +1116,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1202,7 +1190,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1273,7 +1261,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1355,7 +1343,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1440,7 +1428,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1520,7 +1508,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1600,7 +1588,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}/uploadImage"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1680,7 +1668,7 @@ namespace IO.Swagger.Api var localVarPath = "./pet/{petId}/uploadImage"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs index a7d3bd9de522..c48bee756327 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/StoreApi.cs @@ -206,15 +206,9 @@ namespace IO.Swagger.Api /// public StoreApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -231,12 +225,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -285,9 +273,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// @@ -327,7 +315,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/order/{order_id}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -394,7 +382,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/order/{order_id}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -456,7 +444,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/inventory"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -523,7 +511,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/inventory"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -593,7 +581,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/order/{order_id}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -661,7 +649,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/order/{order_id}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -728,7 +716,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/order"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -803,7 +791,7 @@ namespace IO.Swagger.Api var localVarPath = "./store/order"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/UserApi.cs index 1e3a6d70239b..112baa5c8f62 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/UserApi.cs @@ -382,15 +382,9 @@ namespace IO.Swagger.Api /// public UserApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -407,12 +401,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -461,9 +449,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// @@ -503,7 +491,7 @@ namespace IO.Swagger.Api var localVarPath = "./user"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -577,7 +565,7 @@ namespace IO.Swagger.Api var localVarPath = "./user"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -650,7 +638,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/createWithArray"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -724,7 +712,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/createWithArray"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -797,7 +785,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/createWithList"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -871,7 +859,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/createWithList"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -944,7 +932,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/{username}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1011,7 +999,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/{username}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1078,7 +1066,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/{username}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1146,7 +1134,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/{username}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1218,7 +1206,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/login"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1238,8 +1226,8 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (username != null) localVarQueryParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // query parameter - if (password != null) localVarQueryParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // query parameter + if (username != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "username", username)); // query parameter + if (password != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "password", password)); // query parameter // make the HTTP request @@ -1292,7 +1280,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/login"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1312,8 +1300,8 @@ namespace IO.Swagger.Api if (localVarHttpHeaderAccept != null) localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - if (username != null) localVarQueryParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // query parameter - if (password != null) localVarQueryParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // query parameter + if (username != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "username", username)); // query parameter + if (password != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "password", password)); // query parameter // make the HTTP request @@ -1354,7 +1342,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/logout"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1415,7 +1403,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/logout"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1485,7 +1473,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/{username}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); @@ -1565,7 +1553,7 @@ namespace IO.Swagger.Api var localVarPath = "./user/{username}"; var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); + var localVarQueryParams = new List>(); var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); var localVarFormParams = new Dictionary(); var localVarFileParams = new Dictionary(); diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs index ef2952a6f701..7ed77bfba21e 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/ApiClient.cs @@ -48,11 +48,11 @@ namespace IO.Swagger.Client /// /// Initializes a new instance of the class - /// with default configuration and base path (http://petstore.swagger.io:80/v2). + /// with default configuration. /// public ApiClient() { - Configuration = Configuration.Default; + Configuration = IO.Swagger.Client.Configuration.Default; RestClient = new RestClient("http://petstore.swagger.io:80/v2"); RestClient.IgnoreResponseStatusCode = true; } @@ -62,14 +62,11 @@ namespace IO.Swagger.Client /// with default base path (http://petstore.swagger.io:80/v2). /// /// An instance of Configuration. - public ApiClient(Configuration config = null) + public ApiClient(Configuration config) { - if (config == null) - Configuration = Configuration.Default; - else - Configuration = config; + Configuration = config ?? IO.Swagger.Client.Configuration.Default; - RestClient = new RestClient("http://petstore.swagger.io:80/v2"); + RestClient = new RestClient(Configuration.BasePath); RestClient.IgnoreResponseStatusCode = true; } @@ -85,7 +82,7 @@ namespace IO.Swagger.Client RestClient = new RestClient(basePath); RestClient.IgnoreResponseStatusCode = true; - Configuration = Configuration.Default; + Configuration = Client.Configuration.Default; } /// @@ -96,10 +93,15 @@ namespace IO.Swagger.Client public static ApiClient Default; /// - /// Gets or sets the Configuration. + /// Gets or sets an instance of the IReadableConfiguration. /// - /// An instance of the Configuration. - public Configuration Configuration { get; set; } + /// An instance of the IReadableConfiguration. + /// + /// helps us to avoid modifying possibly global + /// configuration values from within a given client. It does not gaurantee thread-safety + /// of the instance in any way. + /// + public IReadableConfiguration Configuration { get; set; } /// /// Gets or sets the RestClient. @@ -109,7 +111,7 @@ namespace IO.Swagger.Client // Creates and sets up a RestRequest prior to a call. private RestRequest PrepareRequest( - String path, Method method, Dictionary queryParams, Object postBody, + String path, Method method, List> queryParams, Object postBody, Dictionary headerParams, Dictionary formParams, Dictionary fileParams, Dictionary pathParams, String contentType) @@ -169,7 +171,7 @@ namespace IO.Swagger.Client /// Content Type of the request /// Object public Object CallApi( - String path, Method method, Dictionary queryParams, Object postBody, + String path, Method method, List> queryParams, Object postBody, Dictionary headerParams, Dictionary formParams, Dictionary fileParams, Dictionary pathParams, String contentType) @@ -179,7 +181,8 @@ namespace IO.Swagger.Client pathParams, contentType); // set timeout - RestClient.Timeout = Configuration.Timeout; + RestClient.Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout); + // set user agent RestClient.UserAgent = Configuration.UserAgent; @@ -203,7 +206,7 @@ namespace IO.Swagger.Client /// Content type. /// The Task instance. public async System.Threading.Tasks.Task CallApiAsync( - String path, Method method, Dictionary queryParams, Object postBody, + String path, Method method, List> queryParams, Object postBody, Dictionary headerParams, Dictionary formParams, Dictionary fileParams, Dictionary pathParams, String contentType) @@ -291,6 +294,7 @@ namespace IO.Swagger.Client return response.RawBytes; } + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) if (type == typeof(Stream)) { if (headers != null) @@ -483,5 +487,39 @@ namespace IO.Swagger.Client return filename; } } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// Key name. + /// Value object. + /// A list of KeyValuePairs + public IEnumerable> ParameterToKeyValuePairs(string collectionFormat, string name, object value) + { + var parameters = new List>(); + + if (IsCollection(value) && collectionFormat == "multi") + { + var valueCollection = value as IEnumerable; + parameters.AddRange(from object item in valueCollection select new KeyValuePair(name, ParameterToString(item))); + } + else + { + parameters.Add(new KeyValuePair(name, ParameterToString(value))); + } + + return parameters; + } + + /// + /// Check if generic object is a collection. + /// + /// + /// True if object is a collection type + private static bool IsCollection(object value) + { + return value is IList || value is ICollection; + } } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs index eee4f3bad89b..bfea3c89bbaf 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/Configuration.cs @@ -10,6 +10,7 @@ using System; using System.Reflection; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -20,10 +21,143 @@ namespace IO.Swagger.Client /// /// Represents a set of configuration settings /// - public class Configuration + public class Configuration : IReadableConfiguration { + #region Constants + /// - /// Initializes a new instance of the Configuration class with different settings + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + private static readonly object GlobalConfigSync = new { }; + private static Configuration _globalConfiguration; + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.Content), + response.Content); + } + + return null; + }; + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static Configuration Default + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + + #endregion Static Members + + #region Private Members + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + private IDictionary _apiKey = null; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix = null; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + #endregion Private Members + + #region Constructors + + static Configuration() + { + _globalConfiguration = new GlobalConfiguration(); + } + + /// + /// Initializes a new instance of the class + /// + public Configuration() + { + UserAgent = "Swagger-Codegen/1.0.0/csharp"; + BasePath = "http://petstore.swagger.io:80/v2"; + DefaultHeader = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + public Configuration( + IDictionary defaultHeader, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "http://petstore.swagger.io:80/v2") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeader == null) + throw new ArgumentNullException("defaultHeader"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeader) + { + DefaultHeader.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + /// + /// Initializes a new instance of the class with different settings /// /// Api client /// Dictionary of default HTTP header @@ -36,128 +170,223 @@ namespace IO.Swagger.Client /// DateTime format string /// HTTP connection timeout (in milliseconds) /// HTTP user agent - public Configuration(ApiClient apiClient = null, - Dictionary defaultHeader = null, - string username = null, - string password = null, - string accessToken = null, - Dictionary apiKey = null, - Dictionary apiKeyPrefix = null, - string tempFolderPath = null, - string dateTimeFormat = null, - int timeout = 100000, - string userAgent = "Swagger-Codegen/1.0.0/csharp" - ) + [Obsolete("Use explicit object construction and setting of properties.", true)] + public Configuration( + // ReSharper disable UnusedParameter.Local + ApiClient apiClient = null, + IDictionary defaultHeader = null, + string username = null, + string password = null, + string accessToken = null, + IDictionary apiKey = null, + IDictionary apiKeyPrefix = null, + string tempFolderPath = null, + string dateTimeFormat = null, + int timeout = 100000, + string userAgent = "Swagger-Codegen/1.0.0/csharp" + // ReSharper restore UnusedParameter.Local + ) { - setApiClientUsingDefault(apiClient); - Username = username; - Password = password; - AccessToken = accessToken; - UserAgent = userAgent; - - if (defaultHeader != null) - DefaultHeader = defaultHeader; - if (apiKey != null) - ApiKey = apiKey; - if (apiKeyPrefix != null) - ApiKeyPrefix = apiKeyPrefix; - - TempFolderPath = tempFolderPath; - DateTimeFormat = dateTimeFormat; - Timeout = TimeSpan.FromMilliseconds(timeout); } /// /// Initializes a new instance of the Configuration class. /// /// Api client. + [Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)] + // ReSharper disable once UnusedParameter.Local public Configuration(ApiClient apiClient) { - setApiClientUsingDefault(apiClient); + } - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "1.0.0"; + #endregion Constructors - /// - /// Gets or sets the default Configuration. - /// - /// Configuration. - public static Configuration Default = new Configuration(); + #region Properties + + private ApiClient _apiClient = null; /// - /// Default creation of exceptions for a given method name and response object + /// Gets an instance of an ApiClient for this configuration /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + public virtual ApiClient ApiClient { - int status = (int) response.StatusCode; - if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); - return null; - }; - - /// - /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. - /// - /// Timeout. - public TimeSpan? Timeout - { - get { return ApiClient.RestClient.Timeout; } - - set + get { - if (ApiClient != null) - ApiClient.RestClient.Timeout = value; + if (_apiClient == null) _apiClient = CreateApiClient(); + return _apiClient; } } + private String _basePath = null; /// - /// Gets or sets the default API client for making HTTP calls. + /// Gets or sets the base path for API access. /// - /// The API client. - public ApiClient ApiClient; - - /// - /// Set the ApiClient using Default or ApiClient instance. - /// - /// An instance of ApiClient. - /// - public void setApiClientUsingDefault (ApiClient apiClient = null) - { - if (apiClient == null) - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = new ApiClient(); - - ApiClient = Default != null ? Default.ApiClient : new ApiClient(); - } - else - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = apiClient; - - ApiClient = apiClient; + public virtual string BasePath { + get { return _basePath; } + set { + _basePath = value; + // pass-through to ApiClient if it's set. + if(_apiClient != null) { + _apiClient.RestClient.BaseUrl = new Uri(_basePath); + } } } - private Dictionary _defaultHeaderMap = new Dictionary(); - /// /// Gets or sets the default header. /// - public Dictionary DefaultHeader + public virtual IDictionary DefaultHeader { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { - get { return _defaultHeaderMap; } + get { return (int)ApiClient.RestClient.Timeout.GetValueOrDefault(TimeSpan.FromSeconds(0)).TotalMilliseconds; } + set { ApiClient.RestClient.Timeout = TimeSpan.FromMilliseconds(value); } + } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix (string apiKeyIdentifier) + { + var apiKeyValue = ""; + ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + var apiKeyPrefix = ""; + if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) + return apiKeyPrefix + " " + apiKeyValue; + else + return apiKeyValue; + } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } set { - _defaultHeaderMap = value; + if (string.IsNullOrEmpty(value)) + { + // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set. + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } } } + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + #endregion Properties + + #region Methods + /// /// Add default header. /// @@ -166,7 +395,30 @@ namespace IO.Swagger.Client /// public void AddDefaultHeader(string key, string value) { - _defaultHeaderMap[key] = value; + DefaultHeader[key] = value; + } + + /// + /// Creates a new based on this instance. + /// + /// + public ApiClient CreateApiClient() + { + return new ApiClient(BasePath) { Configuration = this }; + } + + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (IO.Swagger) Debug Report:\n"; + report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; } /// @@ -190,140 +442,6 @@ namespace IO.Swagger.Client ApiKeyPrefix[key] = value; } - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public String UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public String Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public String Password { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// The access token. - public String AccessToken { get; set; } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public Dictionary ApiKey = new Dictionary(); - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - public Dictionary ApiKeyPrefix = new Dictionary(); - - /// - /// Get the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix (string apiKeyIdentifier) - { - var apiKeyValue = ""; - ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); - var apiKeyPrefix = ""; - if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) - return apiKeyPrefix + " " + apiKeyValue; - else - return apiKeyValue; - } - - private string _tempFolderPath; - - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public String TempFolderPath - { - get - { - // default to Path.GetTempPath() if _tempFolderPath is not set - if (String.IsNullOrEmpty(_tempFolderPath)) - { - _tempFolderPath = Path.GetTempPath(); - } - return _tempFolderPath; - } - - set - { - if (String.IsNullOrEmpty(value)) - { - _tempFolderPath = value; - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - Directory.CreateDirectory(value); - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - _tempFolderPath = value; - else - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - - private const string ISO8601_DATETIME_FORMAT = "o"; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - - /// - /// Gets or sets the the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public String DateTimeFormat - { - get - { - return _dateTimeFormat; - } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Returns a string with essential information for debugging. - /// - public static String ToDebugReport() - { - String report = "C# SDK (IO.Swagger) Debug Report:\n"; - report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; - report += " Version of the API: 1.0.0\n"; - report += " SDK Package Version: 1.0.0\n"; - - return report; - } + #endregion Methods } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/GlobalConfiguration.cs new file mode 100644 index 000000000000..d8b196fc3e8b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/GlobalConfiguration.cs @@ -0,0 +1,34 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; + +namespace IO.Swagger.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .swagger-codegen-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/IReadableConfiguration.cs new file mode 100644 index 000000000000..ed1b6eddeacf --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Client/IReadableConfiguration.cs @@ -0,0 +1,35 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System.Collections.Generic; + +namespace IO.Swagger.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + string AccessToken { get; } + IDictionary ApiKey { get; } + IDictionary ApiKeyPrefix { get; } + string BasePath { get; } + string DateTimeFormat { get; } + IDictionary DefaultHeader { get; } + string Password { get; } + string TempFolderPath { get; } + int Timeout { get; } + string UserAgent { get; } + string Username { get; } + + string GetApiKeyWithPrefix(string apiKeyIdentifier); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/List.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterBoolean.cs similarity index 68% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/List.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterBoolean.cs index bd84d3461c23..54f81745c240 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/List.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterBoolean.cs @@ -22,25 +22,19 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// List + /// OuterBoolean /// [DataContract] - public partial class List : IEquatable + public partial class OuterBoolean : IEquatable { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// _123List. - public List(string _123List = default(string)) + [JsonConstructorAttribute] + public OuterBoolean() { - this._123List = _123List; } - /// - /// Gets or Sets _123List - /// - [DataMember(Name="123-list", EmitDefaultValue=false)] - public string _123List { get; set; } /// /// Returns the string presentation of the object /// @@ -48,8 +42,7 @@ namespace IO.Swagger.Model public override string ToString() { var sb = new StringBuilder(); - sb.Append("class List {\n"); - sb.Append(" _123List: ").Append(_123List).Append("\n"); + sb.Append("class OuterBoolean {\n"); sb.Append("}\n"); return sb.ToString(); } @@ -71,26 +64,21 @@ namespace IO.Swagger.Model public override bool Equals(object obj) { // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as List); + return this.Equals(obj as OuterBoolean); } /// - /// Returns true if List instances are equal + /// Returns true if OuterBoolean instances are equal /// - /// Instance of List to be compared + /// Instance of OuterBoolean to be compared /// Boolean - public bool Equals(List other) + public bool Equals(OuterBoolean other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) return false; - return - ( - this._123List == other._123List || - this._123List != null && - this._123List.Equals(other._123List) - ); + return false; } /// @@ -104,8 +92,6 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this._123List != null) - hash = hash * 59 + this._123List.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterComposite.cs similarity index 52% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ApiResponse.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterComposite.cs index fa69627c29d7..308c26d4f5c0 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterComposite.cs @@ -22,39 +22,39 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// ApiResponse + /// OuterComposite /// [DataContract] - public partial class ApiResponse : IEquatable + public partial class OuterComposite : IEquatable { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// Code. - /// Type. - /// Message. - public ApiResponse(int? Code = default(int?), string Type = default(string), string Message = default(string)) + /// MyNumber. + /// MyString. + /// MyBoolean. + public OuterComposite(OuterNumber MyNumber = default(OuterNumber), OuterString MyString = default(OuterString), OuterBoolean MyBoolean = default(OuterBoolean)) { - this.Code = Code; - this.Type = Type; - this.Message = Message; + this.MyNumber = MyNumber; + this.MyString = MyString; + this.MyBoolean = MyBoolean; } /// - /// Gets or Sets Code + /// Gets or Sets MyNumber /// - [DataMember(Name="code", EmitDefaultValue=false)] - public int? Code { get; set; } + [DataMember(Name="my_number", EmitDefaultValue=false)] + public OuterNumber MyNumber { get; set; } /// - /// Gets or Sets Type + /// Gets or Sets MyString /// - [DataMember(Name="type", EmitDefaultValue=false)] - public string Type { get; set; } + [DataMember(Name="my_string", EmitDefaultValue=false)] + public OuterString MyString { get; set; } /// - /// Gets or Sets Message + /// Gets or Sets MyBoolean /// - [DataMember(Name="message", EmitDefaultValue=false)] - public string Message { get; set; } + [DataMember(Name="my_boolean", EmitDefaultValue=false)] + public OuterBoolean MyBoolean { get; set; } /// /// Returns the string presentation of the object /// @@ -62,10 +62,10 @@ namespace IO.Swagger.Model public override string ToString() { var sb = new StringBuilder(); - sb.Append("class ApiResponse {\n"); - sb.Append(" Code: ").Append(Code).Append("\n"); - sb.Append(" Type: ").Append(Type).Append("\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -87,15 +87,15 @@ namespace IO.Swagger.Model public override bool Equals(object obj) { // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ApiResponse); + return this.Equals(obj as OuterComposite); } /// - /// Returns true if ApiResponse instances are equal + /// Returns true if OuterComposite instances are equal /// - /// Instance of ApiResponse to be compared + /// Instance of OuterComposite to be compared /// Boolean - public bool Equals(ApiResponse other) + public bool Equals(OuterComposite other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) @@ -103,19 +103,19 @@ namespace IO.Swagger.Model return ( - this.Code == other.Code || - this.Code != null && - this.Code.Equals(other.Code) + this.MyNumber == other.MyNumber || + this.MyNumber != null && + this.MyNumber.Equals(other.MyNumber) ) && ( - this.Type == other.Type || - this.Type != null && - this.Type.Equals(other.Type) + this.MyString == other.MyString || + this.MyString != null && + this.MyString.Equals(other.MyString) ) && ( - this.Message == other.Message || - this.Message != null && - this.Message.Equals(other.Message) + this.MyBoolean == other.MyBoolean || + this.MyBoolean != null && + this.MyBoolean.Equals(other.MyBoolean) ); } @@ -130,12 +130,12 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this.Code != null) - hash = hash * 59 + this.Code.GetHashCode(); - if (this.Type != null) - hash = hash * 59 + this.Type.GetHashCode(); - if (this.Message != null) - hash = hash * 59 + this.Message.GetHashCode(); + if (this.MyNumber != null) + hash = hash * 59 + this.MyNumber.GetHashCode(); + if (this.MyString != null) + hash = hash * 59 + this.MyString.GetHashCode(); + if (this.MyBoolean != null) + hash = hash * 59 + this.MyBoolean.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/AnimalFarm.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterNumber.cs similarity index 82% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/AnimalFarm.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterNumber.cs index 46726bb5c73f..103fd4f69dd3 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/AnimalFarm.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterNumber.cs @@ -22,16 +22,16 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// AnimalFarm + /// OuterNumber /// [DataContract] - public partial class AnimalFarm : List, IEquatable + public partial class OuterNumber : IEquatable { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// [JsonConstructorAttribute] - public AnimalFarm() + public OuterNumber() { } @@ -42,7 +42,7 @@ namespace IO.Swagger.Model public override string ToString() { var sb = new StringBuilder(); - sb.Append("class AnimalFarm {\n"); + sb.Append("class OuterNumber {\n"); sb.Append("}\n"); return sb.ToString(); } @@ -51,7 +51,7 @@ namespace IO.Swagger.Model /// Returns the JSON string presentation of the object /// /// JSON string presentation of the object - public new string ToJson() + public string ToJson() { return JsonConvert.SerializeObject(this, Formatting.Indented); } @@ -64,15 +64,15 @@ namespace IO.Swagger.Model public override bool Equals(object obj) { // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as AnimalFarm); + return this.Equals(obj as OuterNumber); } /// - /// Returns true if AnimalFarm instances are equal + /// Returns true if OuterNumber instances are equal /// - /// Instance of AnimalFarm to be compared + /// Instance of OuterNumber to be compared /// Boolean - public bool Equals(AnimalFarm other) + public bool Equals(OuterNumber other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ModelClient.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterString.cs similarity index 67% rename from samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ModelClient.cs rename to samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterString.cs index 7a16ba2ab74f..327fe620b59b 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Model/OuterString.cs @@ -22,25 +22,19 @@ using Newtonsoft.Json.Converters; namespace IO.Swagger.Model { /// - /// ModelClient + /// OuterString /// [DataContract] - public partial class ModelClient : IEquatable + public partial class OuterString : IEquatable { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// _Client. - public ModelClient(string _Client = default(string)) + [JsonConstructorAttribute] + public OuterString() { - this._Client = _Client; } - /// - /// Gets or Sets _Client - /// - [DataMember(Name="client", EmitDefaultValue=false)] - public string _Client { get; set; } /// /// Returns the string presentation of the object /// @@ -48,8 +42,7 @@ namespace IO.Swagger.Model public override string ToString() { var sb = new StringBuilder(); - sb.Append("class ModelClient {\n"); - sb.Append(" _Client: ").Append(_Client).Append("\n"); + sb.Append("class OuterString {\n"); sb.Append("}\n"); return sb.ToString(); } @@ -71,26 +64,21 @@ namespace IO.Swagger.Model public override bool Equals(object obj) { // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ModelClient); + return this.Equals(obj as OuterString); } /// - /// Returns true if ModelClient instances are equal + /// Returns true if OuterString instances are equal /// - /// Instance of ModelClient to be compared + /// Instance of OuterString to be compared /// Boolean - public bool Equals(ModelClient other) + public bool Equals(OuterString other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) return false; - return - ( - this._Client == other._Client || - this._Client != null && - this._Client.Equals(other._Client) - ); + return false; } /// @@ -104,8 +92,6 @@ namespace IO.Swagger.Model { int hash = 41; // Suitable nullity checks etc, of course :) - if (this._Client != null) - hash = hash * 59 + this._Client.GetHashCode(); return hash; } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/.gitignore b/samples/client/petstore/csharp/SwaggerClientNetStanard/.gitignore deleted file mode 100644 index d3f4f7b6f551..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/.gitignore +++ /dev/null @@ -1,185 +0,0 @@ -# Ref: https://gist.github.com/kmorcinek/2710267 -# Download this file using PowerShell v3 under Windows with the following comand -# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore - -# User-specific files -*.suo -*.user -*.sln.docstates - -# Build results - -[Dd]ebug/ -[Rr]elease/ -x64/ -build/ -[Bb]in/ -[Oo]bj/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -*_i.c -*_p.c -*.ilk -*.meta -*.obj -*.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.log -*.scc - -# OS generated files # -.DS_Store* -ehthumbs.db -Icon? -Thumbs.db - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opensdf -*.sdf -*.cachefile - -# Visual Studio profiler -*.psess -*.vsp -*.vspx - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -*.ncrunch* -.*crunch*.local.xml - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.Publish.xml - -# Windows Azure Build Output -csx -*.build.csdef - -# Windows Store app package directory -AppPackages/ - -# Others -sql/ -*.Cache -ClientBin/ -[Ss]tyle[Cc]op.* -~$* -*~ -*.dbmdl -*.[Pp]ublish.xml -*.pfx -*.publishsettings -modulesbin/ -tempbin/ - -# EPiServer Site file (VPP) -AppData/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# vim -*.txt~ -*.swp -*.swo - -# svn -.svn - -# SQL Server files -**/App_Data/*.mdf -**/App_Data/*.ldf -**/App_Data/*.sdf - - -#LightSwitch generated files -GeneratedArtifacts/ -_Pvt_Extensions/ -ModelManifest.xml - -# ========================= -# Windows detritus -# ========================= - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac desktop service store files -.DS_Store - -# SASS Compiler cache -.sass-cache - -# Visual Studio 2014 CTP -**/*.sln.ide diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/.swagger-codegen-ignore b/samples/client/petstore/csharp/SwaggerClientNetStanard/.swagger-codegen-ignore deleted file mode 100644 index c5fa491b4c55..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/.swagger-codegen-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# Swagger Codegen Ignore -# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClientNetStanard/IO.Swagger.sln deleted file mode 100644 index 32ab6d53fd32..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/IO.Swagger.sln +++ /dev/null @@ -1,25 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" -EndProject -Global -GlobalSection(SolutionConfigurationPlatforms) = preSolution -Debug|Any CPU = Debug|Any CPU -Release|Any CPU = Release|Any CPU -EndGlobalSection -GlobalSection(ProjectConfigurationPlatforms) = postSolution -{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU -{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU -{321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU -{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU -{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU -{19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU -EndGlobalSection -GlobalSection(SolutionProperties) = preSolution -HideSolutionNode = FALSE -EndGlobalSection -EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/README.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/README.md deleted file mode 100644 index ac5254844bc4..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/README.md +++ /dev/null @@ -1,163 +0,0 @@ -# IO.Swagger - the C# library for the Swagger Petstore - -This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - -This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - -- API version: 1.0.0 -- SDK version: 1.0.0 -- Build package: io.swagger.codegen.languages.CSharpClientCodegen - - -## Frameworks supported -- .NET Core >=1.0 -- .NET Framework >=4.6 -- Mono/Xamarin >=vNext -- UWP >=10.0 - - -## Dependencies -- FubarCoder.RestSharp.Portable.Core >=4.0.7 -- FubarCoder.RestSharp.Portable.HttpClient >=4.0.7 -- Newtonsoft.Json >=9.0.1 - - -## Installation -Generate the DLL using your preferred tool - -Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: -```csharp -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; -``` - -## Getting Started - -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class Example - { - public void main() - { - - var apiInstance = new FakeApi(); - var body = new ModelClient(); // ModelClient | client model - - try - { - // To test \"client\" model - ModelClient result = apiInstance.TestClientModel(body); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); - } - } - } -} -``` - - -## Documentation for API Endpoints - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model -*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters -*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case -*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image -*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID -*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet -*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user -*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - - -## Documentation for Models - - - [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) - - [Model.Animal](docs/Animal.md) - - [Model.AnimalFarm](docs/AnimalFarm.md) - - [Model.ApiResponse](docs/ApiResponse.md) - - [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - - [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - - [Model.ArrayTest](docs/ArrayTest.md) - - [Model.Capitalization](docs/Capitalization.md) - - [Model.Cat](docs/Cat.md) - - [Model.Category](docs/Category.md) - - [Model.ClassModel](docs/ClassModel.md) - - [Model.Dog](docs/Dog.md) - - [Model.EnumArrays](docs/EnumArrays.md) - - [Model.EnumClass](docs/EnumClass.md) - - [Model.EnumTest](docs/EnumTest.md) - - [Model.FormatTest](docs/FormatTest.md) - - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - - [Model.List](docs/List.md) - - [Model.MapTest](docs/MapTest.md) - - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - - [Model.Model200Response](docs/Model200Response.md) - - [Model.ModelClient](docs/ModelClient.md) - - [Model.ModelReturn](docs/ModelReturn.md) - - [Model.Name](docs/Name.md) - - [Model.NumberOnly](docs/NumberOnly.md) - - [Model.Order](docs/Order.md) - - [Model.OuterEnum](docs/OuterEnum.md) - - [Model.Pet](docs/Pet.md) - - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.SpecialModelName](docs/SpecialModelName.md) - - [Model.Tag](docs/Tag.md) - - [Model.User](docs/User.md) - - - -## Documentation for Authorization - - -### api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - - -### http_basic_test - -- **Type**: HTTP basic authentication - - -### petstore_auth - -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - write:pets: modify pets in your account - - read:pets: read your pets - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Animal.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Animal.md deleted file mode 100644 index f461176159c7..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Animal.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.Animal -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ApiResponse.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ApiResponse.md deleted file mode 100644 index 3e4b4c5e9cbb..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ApiResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# IO.Swagger.Model.ApiResponse -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Code** | **int?** | | [optional] -**Type** | **string** | | [optional] -**Message** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayOfArrayOfNumberOnly.md deleted file mode 100644 index 3431d89edd03..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayOfArrayOfNumberOnly.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.ArrayOfArrayOfNumberOnly -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ArrayArrayNumber** | **List<List<decimal?>>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayOfNumberOnly.md deleted file mode 100644 index 9dc573663d6d..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayOfNumberOnly.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.ArrayOfNumberOnly -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ArrayNumber** | **List<decimal?>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayTest.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayTest.md deleted file mode 100644 index 37fb2788b77f..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ArrayTest.md +++ /dev/null @@ -1,11 +0,0 @@ -# IO.Swagger.Model.ArrayTest -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ArrayOfString** | **List<string>** | | [optional] -**ArrayArrayOfInteger** | **List<List<long?>>** | | [optional] -**ArrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Capitalization.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Capitalization.md deleted file mode 100644 index 87d14f03e0d0..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Capitalization.md +++ /dev/null @@ -1,14 +0,0 @@ -# IO.Swagger.Model.Capitalization -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**SmallCamel** | **string** | | [optional] -**CapitalCamel** | **string** | | [optional] -**SmallSnake** | **string** | | [optional] -**CapitalSnake** | **string** | | [optional] -**SCAETHFlowPoints** | **string** | | [optional] -**ATT_NAME** | **string** | Name of the pet | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Cat.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Cat.md deleted file mode 100644 index a88425f4307c..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Cat.md +++ /dev/null @@ -1,11 +0,0 @@ -# IO.Swagger.Model.Cat -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] -**Declawed** | **bool?** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Category.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Category.md deleted file mode 100644 index 20b56b1728c1..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Category.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.Category -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] -**Name** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ClassModel.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ClassModel.md deleted file mode 100644 index 760130f053cf..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ClassModel.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.ClassModel -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**_Class** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Dog.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Dog.md deleted file mode 100644 index c3ee6d927b42..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Dog.md +++ /dev/null @@ -1,11 +0,0 @@ -# IO.Swagger.Model.Dog -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ClassName** | **string** | | -**Color** | **string** | | [optional] [default to "red"] -**Breed** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumArrays.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumArrays.md deleted file mode 100644 index 86fd208f8f89..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumArrays.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.EnumArrays -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**JustSymbol** | **string** | | [optional] -**ArrayEnum** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumTest.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumTest.md deleted file mode 100644 index a4371a966956..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/EnumTest.md +++ /dev/null @@ -1,12 +0,0 @@ -# IO.Swagger.Model.EnumTest -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**EnumString** | **string** | | [optional] -**EnumInteger** | **int?** | | [optional] -**EnumNumber** | **double?** | | [optional] -**OuterEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/FakeApi.md deleted file mode 100644 index 82a3463dacbb..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/FakeApi.md +++ /dev/null @@ -1,239 +0,0 @@ -# IO.Swagger.Api.FakeApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model -[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters - - - -# **TestClientModel** -> ModelClient TestClientModel (ModelClient body) - -To test \"client\" model - -To test \"client\" model - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class TestClientModelExample - { - public void main() - { - - var apiInstance = new FakeApi(); - var body = new ModelClient(); // ModelClient | client model - - try - { - // To test \"client\" model - ModelClient result = apiInstance.TestClientModel(body); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**ModelClient**](ModelClient.md)| client model | - -### Return type - -[**ModelClient**](ModelClient.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **TestEndpointParameters** -> void TestEndpointParameters (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class TestEndpointParametersExample - { - public void main() - { - - // Configure HTTP basic authorization: http_basic_test - Configuration.Default.Username = "YOUR_USERNAME"; - Configuration.Default.Password = "YOUR_PASSWORD"; - - var apiInstance = new FakeApi(); - var number = 3.4; // decimal? | None - var _double = 1.2; // double? | None - var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None - var _byte = B; // byte[] | None - var integer = 56; // int? | None (optional) - var int32 = 56; // int? | None (optional) - var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) - var _string = _string_example; // string | None (optional) - var binary = B; // byte[] | None (optional) - var date = 2013-10-20; // DateTime? | None (optional) - var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional) - var password = password_example; // string | None (optional) - var callback = callback_example; // string | None (optional) - - try - { - // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - apiInstance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); - } - catch (Exception e) - { - Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **number** | **decimal?**| None | - **_double** | **double?**| None | - **patternWithoutDelimiter** | **string**| None | - **_byte** | **byte[]**| None | - **integer** | **int?**| None | [optional] - **int32** | **int?**| None | [optional] - **int64** | **long?**| None | [optional] - **_float** | **float?**| None | [optional] - **_string** | **string**| None | [optional] - **binary** | **byte[]**| None | [optional] - **date** | **DateTime?**| None | [optional] - **dateTime** | **DateTime?**| None | [optional] - **password** | **string**| None | [optional] - **callback** | **string**| None | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[http_basic_test](../README.md#http_basic_test) - -### HTTP request headers - - - **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8 - - **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8 - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **TestEnumParameters** -> void TestEnumParameters (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null) - -To test enum parameters - -To test enum parameters - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class TestEnumParametersExample - { - public void main() - { - - var apiInstance = new FakeApi(); - var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) - var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) - var enumHeaderStringArray = new List(); // List | Header parameter enum test (string array) (optional) - var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) - var enumQueryStringArray = new List(); // List | Query parameter enum test (string array) (optional) - var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) - var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - - try - { - // To test enum parameters - apiInstance.TestEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); - } - catch (Exception e) - { - Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] - **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] - **enumHeaderStringArray** | [**List<string>**](string.md)| Header parameter enum test (string array) | [optional] - **enumHeaderString** | **string**| Header parameter enum test (string) | [optional] [default to -efg] - **enumQueryStringArray** | [**List<string>**](string.md)| Query parameter enum test (string array) | [optional] - **enumQueryString** | **string**| Query parameter enum test (string) | [optional] [default to -efg] - **enumQueryInteger** | **int?**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **double?**| Query parameter enum test (double) | [optional] - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: */* - - **Accept**: */* - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/FormatTest.md deleted file mode 100644 index 1d366bd7cab4..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/FormatTest.md +++ /dev/null @@ -1,21 +0,0 @@ -# IO.Swagger.Model.FormatTest -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Integer** | **int?** | | [optional] -**Int32** | **int?** | | [optional] -**Int64** | **long?** | | [optional] -**Number** | **decimal?** | | -**_Float** | **float?** | | [optional] -**_Double** | **double?** | | [optional] -**_String** | **string** | | [optional] -**_Byte** | **byte[]** | | -**Binary** | **byte[]** | | [optional] -**Date** | **DateTime?** | | -**DateTime** | **DateTime?** | | [optional] -**Uuid** | **Guid?** | | [optional] -**Password** | **string** | | - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/HasOnlyReadOnly.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/HasOnlyReadOnly.md deleted file mode 100644 index cf0190498b96..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/HasOnlyReadOnly.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.HasOnlyReadOnly -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Bar** | **string** | | [optional] -**Foo** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/List.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/List.md deleted file mode 100644 index d7555b7e7ac3..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/List.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.List -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**_123List** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/MapTest.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/MapTest.md deleted file mode 100644 index 5c202aa336a1..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/MapTest.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.MapTest -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] -**MapOfEnumString** | **Dictionary<string, string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/MixedPropertiesAndAdditionalPropertiesClass.md deleted file mode 100644 index e2c978f9ab12..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ /dev/null @@ -1,11 +0,0 @@ -# IO.Swagger.Model.MixedPropertiesAndAdditionalPropertiesClass -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Uuid** | **Guid?** | | [optional] -**DateTime** | **DateTime?** | | [optional] -**Map** | [**Dictionary<string, Animal>**](Animal.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Model200Response.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Model200Response.md deleted file mode 100644 index cfaddb67027e..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Model200Response.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.Model200Response -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Name** | **int?** | | [optional] -**_Class** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ModelClient.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ModelClient.md deleted file mode 100644 index 9ecdc0e11410..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ModelClient.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.ModelClient -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**_Client** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ModelReturn.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ModelReturn.md deleted file mode 100644 index 9895ccde2b0c..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ModelReturn.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.ModelReturn -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**_Return** | **int?** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Name.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Name.md deleted file mode 100644 index 678132c8e4e8..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Name.md +++ /dev/null @@ -1,12 +0,0 @@ -# IO.Swagger.Model.Name -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**_Name** | **int?** | | -**SnakeCase** | **int?** | | [optional] -**Property** | **string** | | [optional] -**_123Number** | **int?** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/NumberOnly.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/NumberOnly.md deleted file mode 100644 index a156dc4e2fcd..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/NumberOnly.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.NumberOnly -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**JustNumber** | **decimal?** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Order.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Order.md deleted file mode 100644 index 32aeab388e52..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Order.md +++ /dev/null @@ -1,14 +0,0 @@ -# IO.Swagger.Model.Order -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] -**PetId** | **long?** | | [optional] -**Quantity** | **int?** | | [optional] -**ShipDate** | **DateTime?** | | [optional] -**Status** | **string** | Order Status | [optional] -**Complete** | **bool?** | | [optional] [default to false] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Pet.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Pet.md deleted file mode 100644 index e83933d1c60a..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Pet.md +++ /dev/null @@ -1,14 +0,0 @@ -# IO.Swagger.Model.Pet -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] -**Category** | [**Category**](Category.md) | | [optional] -**Name** | **string** | | -**PhotoUrls** | **List<string>** | | -**Tags** | [**List<Tag>**](Tag.md) | | [optional] -**Status** | **string** | pet status in the store | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/PetApi.md deleted file mode 100644 index f3f49f5ed5b8..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/PetApi.md +++ /dev/null @@ -1,544 +0,0 @@ -# IO.Swagger.Api.PetApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet -[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status -[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags -[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet -[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image - - - -# **AddPet** -> void AddPet (Pet body) - -Add a new pet to the store - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class AddPetExample - { - public void main() - { - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - - var apiInstance = new PetApi(); - var body = new Pet(); // Pet | Pet object that needs to be added to the store - - try - { - // Add a new pet to the store - apiInstance.AddPet(body); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **DeletePet** -> void DeletePet (long? petId, string apiKey = null) - -Deletes a pet - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class DeletePetExample - { - public void main() - { - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - - var apiInstance = new PetApi(); - var petId = 789; // long? | Pet id to delete - var apiKey = apiKey_example; // string | (optional) - - try - { - // Deletes a pet - apiInstance.DeletePet(petId, apiKey); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **long?**| Pet id to delete | - **apiKey** | **string**| | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **FindPetsByStatus** -> List FindPetsByStatus (List status) - -Finds Pets by status - -Multiple status values can be provided with comma separated strings - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class FindPetsByStatusExample - { - public void main() - { - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - - var apiInstance = new PetApi(); - var status = new List(); // List | Status values that need to be considered for filter - - try - { - // Finds Pets by status - List<Pet> result = apiInstance.FindPetsByStatus(status); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | [**List<string>**](string.md)| Status values that need to be considered for filter | - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **FindPetsByTags** -> List FindPetsByTags (List tags) - -Finds Pets by tags - -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class FindPetsByTagsExample - { - public void main() - { - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - - var apiInstance = new PetApi(); - var tags = new List(); // List | Tags to filter by - - try - { - // Finds Pets by tags - List<Pet> result = apiInstance.FindPetsByTags(tags); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **tags** | [**List<string>**](string.md)| Tags to filter by | - -### Return type - -[**List**](Pet.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **GetPetById** -> Pet GetPetById (long? petId) - -Find pet by ID - -Returns a single pet - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class GetPetByIdExample - { - public void main() - { - - // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); - // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); - - var apiInstance = new PetApi(); - var petId = 789; // long? | ID of pet to return - - try - { - // Find pet by ID - Pet result = apiInstance.GetPetById(petId); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **long?**| ID of pet to return | - -### Return type - -[**Pet**](Pet.md) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **UpdatePet** -> void UpdatePet (Pet body) - -Update an existing pet - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class UpdatePetExample - { - public void main() - { - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - - var apiInstance = new PetApi(); - var body = new Pet(); // Pet | Pet object that needs to be added to the store - - try - { - // Update an existing pet - apiInstance.UpdatePet(body); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **UpdatePetWithForm** -> void UpdatePetWithForm (long? petId, string name = null, string status = null) - -Updates a pet in the store with form data - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class UpdatePetWithFormExample - { - public void main() - { - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - - var apiInstance = new PetApi(); - var petId = 789; // long? | ID of pet that needs to be updated - var name = name_example; // string | Updated name of the pet (optional) - var status = status_example; // string | Updated status of the pet (optional) - - try - { - // Updates a pet in the store with form data - apiInstance.UpdatePetWithForm(petId, name, status); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **long?**| ID of pet that needs to be updated | - **name** | **string**| Updated name of the pet | [optional] - **status** | **string**| Updated status of the pet | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **UploadFile** -> ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null) - -uploads an image - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class UploadFileExample - { - public void main() - { - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - - var apiInstance = new PetApi(); - var petId = 789; // long? | ID of pet to update - var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) - var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional) - - try - { - // uploads an image - ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **long?**| ID of pet to update | - **additionalMetadata** | **string**| Additional data to pass to server | [optional] - **file** | **System.IO.Stream**| file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: multipart/form-data - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ReadOnlyFirst.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ReadOnlyFirst.md deleted file mode 100644 index b5f8d4848699..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/ReadOnlyFirst.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.ReadOnlyFirst -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Bar** | **string** | | [optional] -**Baz** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/SpecialModelName.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/SpecialModelName.md deleted file mode 100644 index ee1bc3168353..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/SpecialModelName.md +++ /dev/null @@ -1,9 +0,0 @@ -# IO.Swagger.Model.SpecialModelName -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**SpecialPropertyName** | **long?** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/StoreApi.md deleted file mode 100644 index bf2fdb1ed6d5..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/StoreApi.md +++ /dev/null @@ -1,260 +0,0 @@ -# IO.Swagger.Api.StoreApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID -[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet - - - -# **DeleteOrder** -> void DeleteOrder (string orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class DeleteOrderExample - { - public void main() - { - - var apiInstance = new StoreApi(); - var orderId = orderId_example; // string | ID of the order that needs to be deleted - - try - { - // Delete purchase order by ID - apiInstance.DeleteOrder(orderId); - } - catch (Exception e) - { - Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **string**| ID of the order that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **GetInventory** -> Dictionary GetInventory () - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class GetInventoryExample - { - public void main() - { - - // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); - // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); - - var apiInstance = new StoreApi(); - - try - { - // Returns pet inventories by status - Dictionary<string, int?> result = apiInstance.GetInventory(); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); - } - } - } -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Dictionary** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **GetOrderById** -> Order GetOrderById (long? orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class GetOrderByIdExample - { - public void main() - { - - var apiInstance = new StoreApi(); - var orderId = 789; // long? | ID of pet that needs to be fetched - - try - { - // Find purchase order by ID - Order result = apiInstance.GetOrderById(orderId); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **orderId** | **long?**| ID of pet that needs to be fetched | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **PlaceOrder** -> Order PlaceOrder (Order body) - -Place an order for a pet - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class PlaceOrderExample - { - public void main() - { - - var apiInstance = new StoreApi(); - var body = new Order(); // Order | order placed for purchasing the pet - - try - { - // Place an order for a pet - Order result = apiInstance.PlaceOrder(body); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Tag.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Tag.md deleted file mode 100644 index 64c5e6bdc720..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/Tag.md +++ /dev/null @@ -1,10 +0,0 @@ -# IO.Swagger.Model.Tag -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] -**Name** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/User.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/User.md deleted file mode 100644 index fbea33c48b92..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/User.md +++ /dev/null @@ -1,16 +0,0 @@ -# IO.Swagger.Model.User -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] -**Username** | **string** | | [optional] -**FirstName** | **string** | | [optional] -**LastName** | **string** | | [optional] -**Email** | **string** | | [optional] -**Password** | **string** | | [optional] -**Phone** | **string** | | [optional] -**UserStatus** | **int?** | User Status | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/UserApi.md deleted file mode 100644 index 78553f5b3854..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/docs/UserApi.md +++ /dev/null @@ -1,506 +0,0 @@ -# IO.Swagger.Api.UserApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user -[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array -[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array -[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user -[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name -[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system -[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session -[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user - - - -# **CreateUser** -> void CreateUser (User body) - -Create user - -This can only be done by the logged in user. - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class CreateUserExample - { - public void main() - { - - var apiInstance = new UserApi(); - var body = new User(); // User | Created user object - - try - { - // Create user - apiInstance.CreateUser(body); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **CreateUsersWithArrayInput** -> void CreateUsersWithArrayInput (List body) - -Creates list of users with given input array - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class CreateUsersWithArrayInputExample - { - public void main() - { - - var apiInstance = new UserApi(); - var body = new List(); // List | List of user object - - try - { - // Creates list of users with given input array - apiInstance.CreateUsersWithArrayInput(body); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **CreateUsersWithListInput** -> void CreateUsersWithListInput (List body) - -Creates list of users with given input array - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class CreateUsersWithListInputExample - { - public void main() - { - - var apiInstance = new UserApi(); - var body = new List(); // List | List of user object - - try - { - // Creates list of users with given input array - apiInstance.CreateUsersWithListInput(body); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **DeleteUser** -> void DeleteUser (string username) - -Delete user - -This can only be done by the logged in user. - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class DeleteUserExample - { - public void main() - { - - var apiInstance = new UserApi(); - var username = username_example; // string | The name that needs to be deleted - - try - { - // Delete user - apiInstance.DeleteUser(username); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **string**| The name that needs to be deleted | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **GetUserByName** -> User GetUserByName (string username) - -Get user by user name - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class GetUserByNameExample - { - public void main() - { - - var apiInstance = new UserApi(); - var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. - - try - { - // Get user by user name - User result = apiInstance.GetUserByName(username); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **string**| The name that needs to be fetched. Use user1 for testing. | - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **LoginUser** -> string LoginUser (string username, string password) - -Logs user into the system - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class LoginUserExample - { - public void main() - { - - var apiInstance = new UserApi(); - var username = username_example; // string | The user name for login - var password = password_example; // string | The password for login in clear text - - try - { - // Logs user into the system - string result = apiInstance.LoginUser(username, password); - Debug.WriteLine(result); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **string**| The user name for login | - **password** | **string**| The password for login in clear text | - -### Return type - -**string** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **LogoutUser** -> void LogoutUser () - -Logs out current logged in user session - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class LogoutUserExample - { - public void main() - { - - var apiInstance = new UserApi(); - - try - { - // Logs out current logged in user session - apiInstance.LogoutUser(); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); - } - } - } -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - - -# **UpdateUser** -> void UpdateUser (string username, User body) - -Updated user - -This can only be done by the logged in user. - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace Example -{ - public class UpdateUserExample - { - public void main() - { - - var apiInstance = new UserApi(); - var username = username_example; // string | name that need to be deleted - var body = new User(); // User | Updated user object - - try - { - // Updated user - apiInstance.UpdateUser(username, body); - } - catch (Exception e) - { - Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **username** | **string**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/git_push.sh b/samples/client/petstore/csharp/SwaggerClientNetStanard/git_push.sh deleted file mode 100644 index 792320114fbe..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/git_push.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/FakeApi.cs deleted file mode 100644 index 6ec2d6dcbd9d..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/FakeApi.cs +++ /dev/null @@ -1,918 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp.Portable; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace IO.Swagger.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApi : IApiAccessor - { - #region Synchronous Operations - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// ModelClient - ModelClient TestClientModel (ModelClient body); - - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// ApiResponse of ModelClient - ApiResponse TestClientModelWithHttpInfo (ModelClient body); - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// - void TestEndpointParameters (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// ApiResponse of Object(void) - ApiResponse TestEndpointParametersWithHttpInfo (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// - void TestEnumParameters (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null); - - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// ApiResponse of Object(void) - ApiResponse TestEnumParametersWithHttpInfo (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null); - #endregion Synchronous Operations - #region Asynchronous Operations - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Task of ModelClient - System.Threading.Tasks.Task TestClientModelAsync (ModelClient body); - - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClientModelAsyncWithHttpInfo (ModelClient body); - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// Task of void - System.Threading.Tasks.Task TestEndpointParametersAsync (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// Task of ApiResponse - System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null); - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Task of void - System.Threading.Tasks.Task TestEnumParametersAsync (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null); - - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Task of ApiResponse - System.Threading.Tasks.Task> TestEnumParametersAsyncWithHttpInfo (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class FakeApi : IFakeApi - { - private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeApi(String basePath) - { - this.Configuration = new Configuration(new ApiClient(basePath)); - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public FakeApi(Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Sets the base path of the API client. - /// - /// The base path - [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] - public void SetBasePath(String basePath) - { - // do nothing - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Configuration Configuration {get; set;} - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public IO.Swagger.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Gets the default header. - /// - /// Dictionary of HTTP header - [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() - { - return this.Configuration.DefaultHeader; - } - - /// - /// Add default header. - /// - /// Header field name. - /// Header field value. - /// - [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] - public void AddDefaultHeader(string key, string value) - { - this.Configuration.AddDefaultHeader(key, value); - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// ModelClient - public ModelClient TestClientModel (ModelClient body) - { - ApiResponse localVarResponse = TestClientModelWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestClientModelWithHttpInfo (ModelClient body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestClientModel"); - - var localVarPath = "./fake"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestClientModel", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Task of ModelClient - public async System.Threading.Tasks.Task TestClientModelAsync (ModelClient body) - { - ApiResponse localVarResponse = await TestClientModelAsyncWithHttpInfo(body); - return localVarResponse.Data; - - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClientModelAsyncWithHttpInfo (ModelClient body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling FakeApi->TestClientModel"); - - var localVarPath = "./fake"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestClientModel", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); - - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// - public void TestEndpointParameters (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) - { - TestEndpointParametersWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// ApiResponse of Object(void) - public ApiResponse TestEndpointParametersWithHttpInfo (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) - { - // verify the required parameter 'number' is set - if (number == null) - throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); - // verify the required parameter '_double' is set - if (_double == null) - throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) - throw new ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); - // verify the required parameter '_byte' is set - if (_byte == null) - throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); - - var localVarPath = "./fake"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/xml; charset=utf-8", - "application/json; charset=utf-8" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml; charset=utf-8", - "application/json; charset=utf-8" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter - if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter - if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter - if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter - if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter - if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter - if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter - if (patternWithoutDelimiter != null) localVarFormParams.Add("pattern_without_delimiter", Configuration.ApiClient.ParameterToString(patternWithoutDelimiter)); // form parameter - if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter - if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter - if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter - if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter - if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter - if (callback != null) localVarFormParams.Add("callback", Configuration.ApiClient.ParameterToString(callback)); // form parameter - - // authentication (http_basic_test) required - // http basic authentication required - if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) - { - localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password); - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestEndpointParameters", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// Task of void - public async System.Threading.Tasks.Task TestEndpointParametersAsync (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) - { - await TestEndpointParametersAsyncWithHttpInfo(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); - - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEndpointParametersAsyncWithHttpInfo (decimal? number, double? _double, string patternWithoutDelimiter, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, string _string = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null, string callback = null) - { - // verify the required parameter 'number' is set - if (number == null) - throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters"); - // verify the required parameter '_double' is set - if (_double == null) - throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters"); - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) - throw new ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); - // verify the required parameter '_byte' is set - if (_byte == null) - throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters"); - - var localVarPath = "./fake"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/xml; charset=utf-8", - "application/json; charset=utf-8" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml; charset=utf-8", - "application/json; charset=utf-8" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter - if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter - if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter - if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter - if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter - if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter - if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter - if (patternWithoutDelimiter != null) localVarFormParams.Add("pattern_without_delimiter", Configuration.ApiClient.ParameterToString(patternWithoutDelimiter)); // form parameter - if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter - if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter - if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter - if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter - if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter - if (callback != null) localVarFormParams.Add("callback", Configuration.ApiClient.ParameterToString(callback)); // form parameter - - // authentication (http_basic_test) required - // http basic authentication required - if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) - { - localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestEndpointParameters", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// - public void TestEnumParameters (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null) - { - TestEnumParametersWithHttpInfo(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// ApiResponse of Object(void) - public ApiResponse TestEnumParametersWithHttpInfo (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null) - { - - var localVarPath = "./fake"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "*/*" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "*/*" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (enumQueryStringArray != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "enum_query_string_array", enumQueryStringArray)); // query parameter - if (enumQueryString != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_string", enumQueryString)); // query parameter - if (enumQueryInteger != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_integer", enumQueryInteger)); // query parameter - if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter - if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter - if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter - if (enumFormString != null) localVarFormParams.Add("enum_form_string", Configuration.ApiClient.ParameterToString(enumFormString)); // form parameter - if (enumQueryDouble != null) localVarFormParams.Add("enum_query_double", Configuration.ApiClient.ParameterToString(enumQueryDouble)); // form parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestEnumParameters", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Task of void - public async System.Threading.Tasks.Task TestEnumParametersAsync (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null) - { - await TestEnumParametersAsyncWithHttpInfo(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); - - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Form parameter enum test (string array) (optional) - /// Form parameter enum test (string) (optional, default to -efg) - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEnumParametersAsyncWithHttpInfo (List enumFormStringArray = null, string enumFormString = null, List enumHeaderStringArray = null, string enumHeaderString = null, List enumQueryStringArray = null, string enumQueryString = null, int? enumQueryInteger = null, double? enumQueryDouble = null) - { - - var localVarPath = "./fake"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "*/*" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "*/*" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (enumQueryStringArray != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "enum_query_string_array", enumQueryStringArray)); // query parameter - if (enumQueryString != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_string", enumQueryString)); // query parameter - if (enumQueryInteger != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "enum_query_integer", enumQueryInteger)); // query parameter - if (enumHeaderStringArray != null) localVarHeaderParams.Add("enum_header_string_array", Configuration.ApiClient.ParameterToString(enumHeaderStringArray)); // header parameter - if (enumHeaderString != null) localVarHeaderParams.Add("enum_header_string", Configuration.ApiClient.ParameterToString(enumHeaderString)); // header parameter - if (enumFormStringArray != null) localVarFormParams.Add("enum_form_string_array", Configuration.ApiClient.ParameterToString(enumFormStringArray)); // form parameter - if (enumFormString != null) localVarFormParams.Add("enum_form_string", Configuration.ApiClient.ParameterToString(enumFormString)); // form parameter - if (enumQueryDouble != null) localVarFormParams.Add("enum_query_double", Configuration.ApiClient.ParameterToString(enumQueryDouble)); // form parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("TestEnumParameters", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/PetApi.cs deleted file mode 100644 index d0f50d098c02..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/PetApi.cs +++ /dev/null @@ -1,1749 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp.Portable; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace IO.Swagger.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IPetApi : IApiAccessor - { - #region Synchronous Operations - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// - void AddPet (Pet body); - - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// ApiResponse of Object(void) - ApiResponse AddPetWithHttpInfo (Pet body); - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// - void DeletePet (long? petId, string apiKey = null); - - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// ApiResponse of Object(void) - ApiResponse DeletePetWithHttpInfo (long? petId, string apiKey = null); - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// List<Pet> - List FindPetsByStatus (List status); - - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// ApiResponse of List<Pet> - ApiResponse> FindPetsByStatusWithHttpInfo (List status); - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// List<Pet> - List FindPetsByTags (List tags); - - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// ApiResponse of List<Pet> - ApiResponse> FindPetsByTagsWithHttpInfo (List tags); - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Pet - Pet GetPetById (long? petId); - - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// ApiResponse of Pet - ApiResponse GetPetByIdWithHttpInfo (long? petId); - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// - void UpdatePet (Pet body); - - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// ApiResponse of Object(void) - ApiResponse UpdatePetWithHttpInfo (Pet body); - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// - void UpdatePetWithForm (long? petId, string name = null, string status = null); - - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// ApiResponse of Object(void) - ApiResponse UpdatePetWithFormWithHttpInfo (long? petId, string name = null, string status = null); - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// ApiResponse - ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null); - - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// ApiResponse of ApiResponse - ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); - #endregion Synchronous Operations - #region Asynchronous Operations - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of void - System.Threading.Tasks.Task AddPetAsync (Pet body); - - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of ApiResponse - System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body); - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Task of void - System.Threading.Tasks.Task DeletePetAsync (long? petId, string apiKey = null); - - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Task of ApiResponse - System.Threading.Tasks.Task> DeletePetAsyncWithHttpInfo (long? petId, string apiKey = null); - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// Task of List<Pet> - System.Threading.Tasks.Task> FindPetsByStatusAsync (List status); - - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// Task of ApiResponse (List<Pet>) - System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status); - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Task of List<Pet> - System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags); - - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Task of ApiResponse (List<Pet>) - System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags); - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Task of Pet - System.Threading.Tasks.Task GetPetByIdAsync (long? petId); - - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Task of ApiResponse (Pet) - System.Threading.Tasks.Task> GetPetByIdAsyncWithHttpInfo (long? petId); - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of void - System.Threading.Tasks.Task UpdatePetAsync (Pet body); - - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body); - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Task of void - System.Threading.Tasks.Task UpdatePetWithFormAsync (long? petId, string name = null, string status = null); - - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (long? petId, string name = null, string status = null); - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Task of ApiResponse - System.Threading.Tasks.Task UploadFileAsync (long? petId, string additionalMetadata = null, System.IO.Stream file = null); - - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Task of ApiResponse (ApiResponse) - System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class PetApi : IPetApi - { - private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public PetApi(String basePath) - { - this.Configuration = new Configuration(new ApiClient(basePath)); - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public PetApi(Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Sets the base path of the API client. - /// - /// The base path - [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] - public void SetBasePath(String basePath) - { - // do nothing - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Configuration Configuration {get; set;} - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public IO.Swagger.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Gets the default header. - /// - /// Dictionary of HTTP header - [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() - { - return this.Configuration.DefaultHeader; - } - - /// - /// Add default header. - /// - /// Header field name. - /// Header field value. - /// - [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] - public void AddDefaultHeader(string key, string value) - { - this.Configuration.AddDefaultHeader(key, value); - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// - public void AddPet (Pet body) - { - AddPetWithHttpInfo(body); - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// ApiResponse of Object(void) - public ApiResponse AddPetWithHttpInfo (Pet body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->AddPet"); - - var localVarPath = "./pet"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("AddPet", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of void - public async System.Threading.Tasks.Task AddPetAsync (Pet body) - { - await AddPetAsyncWithHttpInfo(body); - - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of ApiResponse - public async System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->AddPet"); - - var localVarPath = "./pet"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("AddPet", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// - public void DeletePet (long? petId, string apiKey = null) - { - DeletePetWithHttpInfo(petId, apiKey); - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// ApiResponse of Object(void) - public ApiResponse DeletePetWithHttpInfo (long? petId, string apiKey = null) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->DeletePet"); - - var localVarPath = "./pet/{petId}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - if (apiKey != null) localVarHeaderParams.Add("api_key", Configuration.ApiClient.ParameterToString(apiKey)); // header parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("DeletePet", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Task of void - public async System.Threading.Tasks.Task DeletePetAsync (long? petId, string apiKey = null) - { - await DeletePetAsyncWithHttpInfo(petId, apiKey); - - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeletePetAsyncWithHttpInfo (long? petId, string apiKey = null) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->DeletePet"); - - var localVarPath = "./pet/{petId}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - if (apiKey != null) localVarHeaderParams.Add("api_key", Configuration.ApiClient.ParameterToString(apiKey)); // header parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("DeletePet", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// List<Pet> - public List FindPetsByStatus (List status) - { - ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); - return localVarResponse.Data; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// ApiResponse of List<Pet> - public ApiResponse< List > FindPetsByStatusWithHttpInfo (List status) - { - // verify the required parameter 'status' is set - if (status == null) - throw new ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); - - var localVarPath = "./pet/findByStatus"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (status != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "status", status)); // query parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("FindPetsByStatus", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (List) Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); - - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// Task of List<Pet> - public async System.Threading.Tasks.Task> FindPetsByStatusAsync (List status) - { - ApiResponse> localVarResponse = await FindPetsByStatusAsyncWithHttpInfo(status); - return localVarResponse.Data; - - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter - /// Task of ApiResponse (List<Pet>) - public async System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status) - { - // verify the required parameter 'status' is set - if (status == null) - throw new ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); - - var localVarPath = "./pet/findByStatus"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (status != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "status", status)); // query parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("FindPetsByStatus", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (List) Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); - - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// List<Pet> - public List FindPetsByTags (List tags) - { - ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); - return localVarResponse.Data; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// ApiResponse of List<Pet> - public ApiResponse< List > FindPetsByTagsWithHttpInfo (List tags) - { - // verify the required parameter 'tags' is set - if (tags == null) - throw new ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); - - var localVarPath = "./pet/findByTags"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (tags != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "tags", tags)); // query parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("FindPetsByTags", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (List) Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); - - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Task of List<Pet> - public async System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags) - { - ApiResponse> localVarResponse = await FindPetsByTagsAsyncWithHttpInfo(tags); - return localVarResponse.Data; - - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Task of ApiResponse (List<Pet>) - public async System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags) - { - // verify the required parameter 'tags' is set - if (tags == null) - throw new ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); - - var localVarPath = "./pet/findByTags"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (tags != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("csv", "tags", tags)); // query parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("FindPetsByTags", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (List) Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); - - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Pet - public Pet GetPetById (long? petId) - { - ApiResponse localVarResponse = GetPetByIdWithHttpInfo(petId); - return localVarResponse.Data; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// ApiResponse of Pet - public ApiResponse< Pet > GetPetByIdWithHttpInfo (long? petId) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetById"); - - var localVarPath = "./pet/{petId}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetPetById", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Pet) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Pet))); - - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Task of Pet - public async System.Threading.Tasks.Task GetPetByIdAsync (long? petId) - { - ApiResponse localVarResponse = await GetPetByIdAsyncWithHttpInfo(petId); - return localVarResponse.Data; - - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Task of ApiResponse (Pet) - public async System.Threading.Tasks.Task> GetPetByIdAsyncWithHttpInfo (long? petId) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetById"); - - var localVarPath = "./pet/{petId}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetPetById", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Pet) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Pet))); - - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// - public void UpdatePet (Pet body) - { - UpdatePetWithHttpInfo(body); - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// ApiResponse of Object(void) - public ApiResponse UpdatePetWithHttpInfo (Pet body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->UpdatePet"); - - var localVarPath = "./pet"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UpdatePet", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of void - public async System.Threading.Tasks.Task UpdatePetAsync (Pet body) - { - await UpdatePetAsyncWithHttpInfo(body); - - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->UpdatePet"); - - var localVarPath = "./pet"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UpdatePet", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// - public void UpdatePetWithForm (long? petId, string name = null, string status = null) - { - UpdatePetWithFormWithHttpInfo(petId, name, status); - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// ApiResponse of Object(void) - public ApiResponse UpdatePetWithFormWithHttpInfo (long? petId, string name = null, string status = null) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm"); - - var localVarPath = "./pet/{petId}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/x-www-form-urlencoded" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - if (name != null) localVarFormParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // form parameter - if (status != null) localVarFormParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // form parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UpdatePetWithForm", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Task of void - public async System.Threading.Tasks.Task UpdatePetWithFormAsync (long? petId, string name = null, string status = null) - { - await UpdatePetWithFormAsyncWithHttpInfo(petId, name, status); - - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (long? petId, string name = null, string status = null) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm"); - - var localVarPath = "./pet/{petId}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/x-www-form-urlencoded" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - if (name != null) localVarFormParams.Add("name", Configuration.ApiClient.ParameterToString(name)); // form parameter - if (status != null) localVarFormParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // form parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UpdatePetWithForm", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// ApiResponse - public ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null) - { - ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); - return localVarResponse.Data; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// ApiResponse of ApiResponse - public ApiResponse< ApiResponse > UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFile"); - - var localVarPath = "./pet/{petId}/uploadImage"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "multipart/form-data" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter - if (file != null) localVarFileParams.Add("file", Configuration.ApiClient.ParameterToFile("file", file)); - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UploadFile", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (ApiResponse) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); - - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Task of ApiResponse - public async System.Threading.Tasks.Task UploadFileAsync (long? petId, string additionalMetadata = null, System.IO.Stream file = null) - { - ApiResponse localVarResponse = await UploadFileAsyncWithHttpInfo(petId, additionalMetadata, file); - return localVarResponse.Data; - - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Task of ApiResponse (ApiResponse) - public async System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFile"); - - var localVarPath = "./pet/{petId}/uploadImage"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "multipart/form-data" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter - if (file != null) localVarFileParams.Add("file", Configuration.ApiClient.ParameterToFile("file", file)); - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UploadFile", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (ApiResponse) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); - - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/StoreApi.cs deleted file mode 100644 index 6ce410043145..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/StoreApi.cs +++ /dev/null @@ -1,863 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp.Portable; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace IO.Swagger.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IStoreApi : IApiAccessor - { - #region Synchronous Operations - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// - void DeleteOrder (string orderId); - - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// ApiResponse of Object(void) - ApiResponse DeleteOrderWithHttpInfo (string orderId); - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Dictionary<string, int?> - Dictionary GetInventory (); - - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// ApiResponse of Dictionary<string, int?> - ApiResponse> GetInventoryWithHttpInfo (); - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Order - Order GetOrderById (long? orderId); - - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// ApiResponse of Order - ApiResponse GetOrderByIdWithHttpInfo (long? orderId); - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Order - Order PlaceOrder (Order body); - - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// ApiResponse of Order - ApiResponse PlaceOrderWithHttpInfo (Order body); - #endregion Synchronous Operations - #region Asynchronous Operations - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Task of void - System.Threading.Tasks.Task DeleteOrderAsync (string orderId); - - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Task of ApiResponse - System.Threading.Tasks.Task> DeleteOrderAsyncWithHttpInfo (string orderId); - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of Dictionary<string, int?> - System.Threading.Tasks.Task> GetInventoryAsync (); - - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of ApiResponse (Dictionary<string, int?>) - System.Threading.Tasks.Task>> GetInventoryAsyncWithHttpInfo (); - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of Order - System.Threading.Tasks.Task GetOrderByIdAsync (long? orderId); - - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (long? orderId); - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Task of Order - System.Threading.Tasks.Task PlaceOrderAsync (Order body); - - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class StoreApi : IStoreApi - { - private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public StoreApi(String basePath) - { - this.Configuration = new Configuration(new ApiClient(basePath)); - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public StoreApi(Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Sets the base path of the API client. - /// - /// The base path - [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] - public void SetBasePath(String basePath) - { - // do nothing - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Configuration Configuration {get; set;} - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public IO.Swagger.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Gets the default header. - /// - /// Dictionary of HTTP header - [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() - { - return this.Configuration.DefaultHeader; - } - - /// - /// Add default header. - /// - /// Header field name. - /// Header field value. - /// - [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] - public void AddDefaultHeader(string key, string value) - { - this.Configuration.AddDefaultHeader(key, value); - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// - public void DeleteOrder (string orderId) - { - DeleteOrderWithHttpInfo(orderId); - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// ApiResponse of Object(void) - public ApiResponse DeleteOrderWithHttpInfo (string orderId) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); - - var localVarPath = "./store/order/{order_id}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("DeleteOrder", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Task of void - public async System.Threading.Tasks.Task DeleteOrderAsync (string orderId) - { - await DeleteOrderAsyncWithHttpInfo(orderId); - - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeleteOrderAsyncWithHttpInfo (string orderId) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); - - var localVarPath = "./store/order/{order_id}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("DeleteOrder", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Dictionary<string, int?> - public Dictionary GetInventory () - { - ApiResponse> localVarResponse = GetInventoryWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// ApiResponse of Dictionary<string, int?> - public ApiResponse< Dictionary > GetInventoryWithHttpInfo () - { - - var localVarPath = "./store/inventory"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetInventory", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Dictionary) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary))); - - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of Dictionary<string, int?> - public async System.Threading.Tasks.Task> GetInventoryAsync () - { - ApiResponse> localVarResponse = await GetInventoryAsyncWithHttpInfo(); - return localVarResponse.Data; - - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of ApiResponse (Dictionary<string, int?>) - public async System.Threading.Tasks.Task>> GetInventoryAsyncWithHttpInfo () - { - - var localVarPath = "./store/inventory"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetInventory", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Dictionary) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary))); - - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Order - public Order GetOrderById (long? orderId) - { - ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); - return localVarResponse.Data; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// ApiResponse of Order - public ApiResponse< Order > GetOrderByIdWithHttpInfo (long? orderId) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById"); - - var localVarPath = "./store/order/{order_id}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetOrderById", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Order) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order))); - - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of Order - public async System.Threading.Tasks.Task GetOrderByIdAsync (long? orderId) - { - ApiResponse localVarResponse = await GetOrderByIdAsyncWithHttpInfo(orderId); - return localVarResponse.Data; - - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (long? orderId) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById"); - - var localVarPath = "./store/order/{order_id}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (orderId != null) localVarPathParams.Add("order_id", Configuration.ApiClient.ParameterToString(orderId)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetOrderById", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Order) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order))); - - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Order - public Order PlaceOrder (Order body) - { - ApiResponse localVarResponse = PlaceOrderWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// ApiResponse of Order - public ApiResponse< Order > PlaceOrderWithHttpInfo (Order body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling StoreApi->PlaceOrder"); - - var localVarPath = "./store/order"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("PlaceOrder", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Order) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order))); - - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Task of Order - public async System.Threading.Tasks.Task PlaceOrderAsync (Order body) - { - ApiResponse localVarResponse = await PlaceOrderAsyncWithHttpInfo(body); - return localVarResponse.Data; - - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling StoreApi->PlaceOrder"); - - var localVarPath = "./store/order"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("PlaceOrder", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (Order) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order))); - - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/UserApi.cs deleted file mode 100644 index d2b97911aac4..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Api/UserApi.cs +++ /dev/null @@ -1,1634 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp.Portable; -using IO.Swagger.Client; -using IO.Swagger.Model; - -namespace IO.Swagger.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IUserApi : IApiAccessor - { - #region Synchronous Operations - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// - void CreateUser (User body); - - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// ApiResponse of Object(void) - ApiResponse CreateUserWithHttpInfo (User body); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// - void CreateUsersWithArrayInput (List body); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// ApiResponse of Object(void) - ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// - void CreateUsersWithListInput (List body); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// ApiResponse of Object(void) - ApiResponse CreateUsersWithListInputWithHttpInfo (List body); - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// - void DeleteUser (string username); - - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// ApiResponse of Object(void) - ApiResponse DeleteUserWithHttpInfo (string username); - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// User - User GetUserByName (string username); - - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// ApiResponse of User - ApiResponse GetUserByNameWithHttpInfo (string username); - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// string - string LoginUser (string username, string password); - - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// ApiResponse of string - ApiResponse LoginUserWithHttpInfo (string username, string password); - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - void LogoutUser (); - - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ApiResponse of Object(void) - ApiResponse LogoutUserWithHttpInfo (); - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// - void UpdateUser (string username, User body); - - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// ApiResponse of Object(void) - ApiResponse UpdateUserWithHttpInfo (string username, User body); - #endregion Synchronous Operations - #region Asynchronous Operations - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Task of void - System.Threading.Tasks.Task CreateUserAsync (User body); - - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of void - System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of void - System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body); - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Task of void - System.Threading.Tasks.Task DeleteUserAsync (string username); - - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Task of ApiResponse - System.Threading.Tasks.Task> DeleteUserAsyncWithHttpInfo (string username); - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Task of User - System.Threading.Tasks.Task GetUserByNameAsync (string username); - - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Task of ApiResponse (User) - System.Threading.Tasks.Task> GetUserByNameAsyncWithHttpInfo (string username); - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Task of string - System.Threading.Tasks.Task LoginUserAsync (string username, string password); - - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Task of ApiResponse (string) - System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username, string password); - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Task of void - System.Threading.Tasks.Task LogoutUserAsync (); - - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Task of ApiResponse - System.Threading.Tasks.Task> LogoutUserAsyncWithHttpInfo (); - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Task of void - System.Threading.Tasks.Task UpdateUserAsync (string username, User body); - - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class UserApi : IUserApi - { - private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public UserApi(String basePath) - { - this.Configuration = new Configuration(new ApiClient(basePath)); - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public UserApi(Configuration configuration = null) - { - if (configuration == null) // use the default one in Configuration - this.Configuration = Configuration.Default; - else - this.Configuration = configuration; - - ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } - } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public String GetBasePath() - { - return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); - } - - /// - /// Sets the base path of the API client. - /// - /// The base path - [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] - public void SetBasePath(String basePath) - { - // do nothing - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Configuration Configuration {get; set;} - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public IO.Swagger.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Gets the default header. - /// - /// Dictionary of HTTP header - [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() - { - return this.Configuration.DefaultHeader; - } - - /// - /// Add default header. - /// - /// Header field name. - /// Header field value. - /// - [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] - public void AddDefaultHeader(string key, string value) - { - this.Configuration.AddDefaultHeader(key, value); - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// - public void CreateUser (User body) - { - CreateUserWithHttpInfo(body); - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// ApiResponse of Object(void) - public ApiResponse CreateUserWithHttpInfo (User body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUser"); - - var localVarPath = "./user"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("CreateUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Task of void - public async System.Threading.Tasks.Task CreateUserAsync (User body) - { - await CreateUserAsyncWithHttpInfo(body); - - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUser"); - - var localVarPath = "./user"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("CreateUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// - public void CreateUsersWithArrayInput (List body) - { - CreateUsersWithArrayInputWithHttpInfo(body); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// ApiResponse of Object(void) - public ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput"); - - var localVarPath = "./user/createWithArray"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body) - { - await CreateUsersWithArrayInputAsyncWithHttpInfo(body); - - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput"); - - var localVarPath = "./user/createWithArray"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// - public void CreateUsersWithListInput (List body) - { - CreateUsersWithListInputWithHttpInfo(body); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// ApiResponse of Object(void) - public ApiResponse CreateUsersWithListInputWithHttpInfo (List body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput"); - - var localVarPath = "./user/createWithList"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("CreateUsersWithListInput", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body) - { - await CreateUsersWithListInputAsyncWithHttpInfo(body); - - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body) - { - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput"); - - var localVarPath = "./user/createWithList"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("CreateUsersWithListInput", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// - public void DeleteUser (string username) - { - DeleteUserWithHttpInfo(username); - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// ApiResponse of Object(void) - public ApiResponse DeleteUserWithHttpInfo (string username) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); - - var localVarPath = "./user/{username}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("DeleteUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Task of void - public async System.Threading.Tasks.Task DeleteUserAsync (string username) - { - await DeleteUserAsyncWithHttpInfo(username); - - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeleteUserAsyncWithHttpInfo (string username) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); - - var localVarPath = "./user/{username}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("DeleteUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// User - public User GetUserByName (string username) - { - ApiResponse localVarResponse = GetUserByNameWithHttpInfo(username); - return localVarResponse.Data; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// ApiResponse of User - public ApiResponse< User > GetUserByNameWithHttpInfo (string username) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); - - var localVarPath = "./user/{username}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetUserByName", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (User) Configuration.ApiClient.Deserialize(localVarResponse, typeof(User))); - - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Task of User - public async System.Threading.Tasks.Task GetUserByNameAsync (string username) - { - ApiResponse localVarResponse = await GetUserByNameAsyncWithHttpInfo(username); - return localVarResponse.Data; - - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Task of ApiResponse (User) - public async System.Threading.Tasks.Task> GetUserByNameAsyncWithHttpInfo (string username) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); - - var localVarPath = "./user/{username}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("GetUserByName", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (User) Configuration.ApiClient.Deserialize(localVarResponse, typeof(User))); - - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// string - public string LoginUser (string username, string password) - { - ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); - return localVarResponse.Data; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// ApiResponse of string - public ApiResponse< string > LoginUserWithHttpInfo (string username, string password) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); - // verify the required parameter 'password' is set - if (password == null) - throw new ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); - - var localVarPath = "./user/login"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "username", username)); // query parameter - if (password != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "password", password)); // query parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("LoginUser", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (string) Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Task of string - public async System.Threading.Tasks.Task LoginUserAsync (string username, string password) - { - ApiResponse localVarResponse = await LoginUserAsyncWithHttpInfo(username, password); - return localVarResponse.Data; - - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Task of ApiResponse (string) - public async System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username, string password) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); - // verify the required parameter 'password' is set - if (password == null) - throw new ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); - - var localVarPath = "./user/login"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "username", username)); // query parameter - if (password != null) localVarQueryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "password", password)); // query parameter - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("LoginUser", localVarResponse); - if (exception != null) throw exception; - } - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - (string) Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); - - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// - public void LogoutUser () - { - LogoutUserWithHttpInfo(); - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// ApiResponse of Object(void) - public ApiResponse LogoutUserWithHttpInfo () - { - - var localVarPath = "./user/logout"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("LogoutUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Task of void - public async System.Threading.Tasks.Task LogoutUserAsync () - { - await LogoutUserAsyncWithHttpInfo(); - - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Task of ApiResponse - public async System.Threading.Tasks.Task> LogoutUserAsyncWithHttpInfo () - { - - var localVarPath = "./user/logout"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("LogoutUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// - public void UpdateUser (string username, User body) - { - UpdateUserWithHttpInfo(username, body); - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// ApiResponse of Object(void) - public ApiResponse UpdateUserWithHttpInfo (string username, User body) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->UpdateUser"); - - var localVarPath = "./user/{username}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UpdateUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Task of void - public async System.Threading.Tasks.Task UpdateUserAsync (string username, User body) - { - await UpdateUserAsyncWithHttpInfo(username, body); - - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body) - { - // verify the required parameter 'username' is set - if (username == null) - throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); - // verify the required parameter 'body' is set - if (body == null) - throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->UpdateUser"); - - var localVarPath = "./user/{username}"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new List>(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/xml", - "application/json" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - if (body != null && body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (ExceptionFactory != null) - { - Exception exception = ExceptionFactory("UpdateUser", localVarResponse); - if (exception != null) throw exception; - } - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), - null); - } - - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiClient.cs deleted file mode 100644 index 857eb859bb7c..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiClient.cs +++ /dev/null @@ -1,519 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Text.RegularExpressions; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using Newtonsoft.Json; -using RestSharp.Portable; -using RestSharp.Portable.HttpClient; - -namespace IO.Swagger.Client -{ - /// - /// API client is mainly responsible for making the HTTP call to the API backend. - /// - public partial class ApiClient - { - private JsonSerializerSettings serializerSettings = new JsonSerializerSettings - { - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(IRestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(IRestRequest request, IRestResponse response); - - /// - /// Initializes a new instance of the class - /// with default configuration and base path (http://petstore.swagger.io:80/v2). - /// - public ApiClient() - { - Configuration = Configuration.Default; - RestClient = new RestClient("http://petstore.swagger.io:80/v2"); - RestClient.IgnoreResponseStatusCode = true; - } - - /// - /// Initializes a new instance of the class - /// with default base path (http://petstore.swagger.io:80/v2). - /// - /// An instance of Configuration. - public ApiClient(Configuration config = null) - { - if (config == null) - Configuration = Configuration.Default; - else - Configuration = config; - - RestClient = new RestClient("http://petstore.swagger.io:80/v2"); - RestClient.IgnoreResponseStatusCode = true; - } - - /// - /// Initializes a new instance of the class - /// with default configuration. - /// - /// The base path. - public ApiClient(String basePath = "http://petstore.swagger.io:80/v2") - { - if (String.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - RestClient = new RestClient(basePath); - RestClient.IgnoreResponseStatusCode = true; - Configuration = Configuration.Default; - } - - /// - /// Gets or sets the default API client for making HTTP calls. - /// - /// The default API client. - [Obsolete("ApiClient.Default is deprecated, please use 'Configuration.Default.ApiClient' instead.")] - public static ApiClient Default; - - /// - /// Gets or sets the Configuration. - /// - /// An instance of the Configuration. - public Configuration Configuration { get; set; } - - /// - /// Gets or sets the RestClient. - /// - /// An instance of the RestClient - public RestClient RestClient { get; set; } - - // Creates and sets up a RestRequest prior to a call. - private RestRequest PrepareRequest( - String path, Method method, List> queryParams, Object postBody, - Dictionary headerParams, Dictionary formParams, - Dictionary fileParams, Dictionary pathParams, - String contentType) - { - var request = new RestRequest(path, method); - - // add path parameter, if any - foreach(var param in pathParams) - request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment); - - // add header parameter, if any - foreach(var param in headerParams) - request.AddHeader(param.Key, param.Value); - - // add query parameter, if any - foreach(var param in queryParams) - request.AddQueryParameter(param.Key, param.Value); - - // add form parameter, if any - foreach(var param in formParams) - request.AddParameter(param.Key, param.Value); - - // add file parameter, if any - foreach(var param in fileParams) - { - request.AddFile(param.Value); - } - - if (postBody != null) // http body (model or byte[]) parameter - { - if (postBody.GetType() == typeof(String)) - { - request.AddParameter("application/json", postBody, ParameterType.RequestBody); - } - else if (postBody.GetType() == typeof(byte[])) - { - request.AddParameter(contentType, postBody, ParameterType.RequestBody); - } - } - - return request; - } - - /// - /// Makes the HTTP request (Sync). - /// - /// URL path. - /// HTTP method. - /// Query parameters. - /// HTTP body (POST request). - /// Header parameters. - /// Form parameters. - /// File parameters. - /// Path parameters. - /// Content Type of the request - /// Object - public Object CallApi( - String path, Method method, List> queryParams, Object postBody, - Dictionary headerParams, Dictionary formParams, - Dictionary fileParams, Dictionary pathParams, - String contentType) - { - var request = PrepareRequest( - path, method, queryParams, postBody, headerParams, formParams, fileParams, - pathParams, contentType); - - // set timeout - RestClient.Timeout = Configuration.Timeout; - // set user agent - RestClient.UserAgent = Configuration.UserAgent; - - InterceptRequest(request); - var response = RestClient.Execute(request).Result; - InterceptResponse(request, response); - - return (Object) response; - } - /// - /// Makes the asynchronous HTTP request. - /// - /// URL path. - /// HTTP method. - /// Query parameters. - /// HTTP body (POST request). - /// Header parameters. - /// Form parameters. - /// File parameters. - /// Path parameters. - /// Content type. - /// The Task instance. - public async System.Threading.Tasks.Task CallApiAsync( - String path, Method method, List> queryParams, Object postBody, - Dictionary headerParams, Dictionary formParams, - Dictionary fileParams, Dictionary pathParams, - String contentType) - { - var request = PrepareRequest( - path, method, queryParams, postBody, headerParams, formParams, fileParams, - pathParams, contentType); - InterceptRequest(request); - var response = await RestClient.Execute(request); - InterceptResponse(request, response); - return (Object)response; - } - - /// - /// Escape string (url-encoded). - /// - /// String to be escaped. - /// Escaped string. - public string EscapeString(string str) - { - return UrlEncode(str); - } - - /// - /// Create FileParameter based on Stream. - /// - /// Parameter name. - /// Input stream. - /// FileParameter. - public FileParameter ParameterToFile(string name, Stream stream) - { - if (stream is FileStream) - return FileParameter.Create(name, ReadAsBytes(stream), Path.GetFileName(((FileStream)stream).Name)); - else - return FileParameter.Create(name, ReadAsBytes(stream), "no_file_name_provided"); - } - - /// - /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. - /// If parameter is a list, join the list with ",". - /// Otherwise just return the string. - /// - /// The parameter (header, path, query, form). - /// Formatted string. - public string ParameterToString(object obj) - { - if (obj is DateTime) - // Return a formatted date string - Can be customized with Configuration.DateTimeFormat - // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") - // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 - // For example: 2009-06-15T13:45:30.0000000 - return ((DateTime)obj).ToString (Configuration.DateTimeFormat); - else if (obj is DateTimeOffset) - // Return a formatted date string - Can be customized with Configuration.DateTimeFormat - // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") - // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 - // For example: 2009-06-15T13:45:30.0000000 - return ((DateTimeOffset)obj).ToString (Configuration.DateTimeFormat); - else if (obj is IList) - { - var flattenedString = new StringBuilder(); - foreach (var param in (IList)obj) - { - if (flattenedString.Length > 0) - flattenedString.Append(","); - flattenedString.Append(param); - } - return flattenedString.ToString(); - } - else - return Convert.ToString (obj); - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - public object Deserialize(IRestResponse response, Type type) - { - IHttpHeaders headers = response.Headers; - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - if (type == typeof(Stream)) - { - if (headers != null) - { - var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath) - ? Path.GetTempPath() - : Configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - File.WriteAllBytes(fileName, response.RawBytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(response.RawBytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind); - } - - if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return ConvertType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - /// - /// Serialize an input (model) into JSON string - /// - /// Object. - /// JSON string. - public String Serialize(object obj) - { - try - { - return obj != null ? JsonConvert.SerializeObject(obj) : null; - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - /// - /// Select the Content-Type header's value from the given content-type array: - /// if JSON exists in the given array, use it; - /// otherwise use the first one defined in 'consumes' - /// - /// The Content-Type array to select from. - /// The Content-Type header to use. - public String SelectHeaderContentType(String[] contentTypes) - { - if (contentTypes.Length == 0) - return null; - - if (contentTypes.Contains("application/json", StringComparer.OrdinalIgnoreCase)) - return "application/json"; - - return contentTypes[0]; // use the first content type specified in 'consumes' - } - - /// - /// Select the Accept header's value from the given accepts array: - /// if JSON exists in the given array, use it; - /// otherwise use all of them (joining into a string) - /// - /// The accepts array to select from. - /// The Accept header to use. - public String SelectHeaderAccept(String[] accepts) - { - if (accepts.Length == 0) - return null; - - if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) - return "application/json"; - - return String.Join(",", accepts); - } - - /// - /// Encode string in base64 format. - /// - /// String to be encoded. - /// Encoded string. - public static string Base64Encode(string text) - { - return System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); - } - - /// - /// Dynamically cast the object into target type. - /// Ref: http://stackoverflow.com/questions/4925718/c-dynamic-runtime-cast - /// - /// Object to be casted - /// Target type - /// Casted object - public static dynamic ConvertType(dynamic source, Type dest) - { - return Convert.ChangeType(source, dest); - } - - /// - /// Convert stream to byte array - /// Credit/Ref: http://stackoverflow.com/a/221941/677735 - /// - /// Input stream to be converted - /// Byte array - public static byte[] ReadAsBytes(Stream input) - { - byte[] buffer = new byte[16*1024]; - using (MemoryStream ms = new MemoryStream()) - { - int read; - while ((read = input.Read(buffer, 0, buffer.Length)) > 0) - { - ms.Write(buffer, 0, read); - } - return ms.ToArray(); - } - } - - /// - /// URL encode a string - /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 - /// - /// String to be URL encoded - /// Byte array - public static string UrlEncode(string input) - { - const int maxLength = 32766; - - if (input == null) - { - throw new ArgumentNullException("input"); - } - - if (input.Length <= maxLength) - { - return Uri.EscapeDataString(input); - } - - StringBuilder sb = new StringBuilder(input.Length * 2); - int index = 0; - - while (index < input.Length) - { - int length = Math.Min(input.Length - index, maxLength); - string subString = input.Substring(index, length); - - sb.Append(Uri.EscapeDataString(subString)); - index += subString.Length; - } - - return sb.ToString(); - } - - /// - /// Sanitize filename by removing the path - /// - /// Filename - /// Filename - public static string SanitizeFilename(string filename) - { - Match match = Regex.Match(filename, @".*[/\\](.*)$"); - - if (match.Success) - { - return match.Groups[1].Value; - } - else - { - return filename; - } - } - - /// - /// Convert params to key/value pairs. - /// Use collectionFormat to properly format lists and collections. - /// - /// Key name. - /// Value object. - /// A list of KeyValuePairs - public IEnumerable> ParameterToKeyValuePairs(string collectionFormat, string name, object value) - { - var parameters = new List>(); - - if (IsCollection(value) && collectionFormat == "multi") - { - var valueCollection = value as IEnumerable; - parameters.AddRange(from object item in valueCollection select new KeyValuePair(name, ParameterToString(item))); - } - else - { - parameters.Add(new KeyValuePair(name, ParameterToString(value))); - } - - return parameters; - } - - /// - /// Check if generic object is a collection. - /// - /// - /// True if object is a collection type - private static bool IsCollection(object value) - { - return value is IList || value is ICollection; - } - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiException.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiException.cs deleted file mode 100644 index 79c6432ffc67..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiException.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; - -namespace IO.Swagger.Client -{ - /// - /// API Exception - /// - public class ApiException : Exception - { - /// - /// Gets or sets the error code (HTTP status code) - /// - /// The error code (HTTP status code). - public int ErrorCode { get; set; } - - /// - /// Gets or sets the error content (body json object) - /// - /// The error content (Http response body). - public dynamic ErrorContent { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - public ApiException() {} - - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// Error message. - public ApiException(int errorCode, string message) : base(message) - { - this.ErrorCode = errorCode; - } - - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// Error message. - /// Error content. - public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message) - { - this.ErrorCode = errorCode; - this.ErrorContent = errorContent; - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiResponse.cs deleted file mode 100644 index b21347aa408f..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ApiResponse.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Collections.Generic; - -namespace IO.Swagger.Client -{ - /// - /// API Response - /// - public class ApiResponse - { - /// - /// Gets or sets the status code (HTTP status code) - /// - /// The status code. - public int StatusCode { get; private set; } - - /// - /// Gets or sets the HTTP headers - /// - /// HTTP headers - public IDictionary Headers { get; private set; } - - /// - /// Gets or sets the data (parsed HTTP body) - /// - /// The data. - public T Data { get; private set; } - - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// HTTP headers. - /// Data (parsed HTTP body) - public ApiResponse(int statusCode, IDictionary headers, T data) - { - this.StatusCode= statusCode; - this.Headers = headers; - this.Data = data; - } - - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/Configuration.cs deleted file mode 100644 index eee4f3bad89b..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/Configuration.cs +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Reflection; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace IO.Swagger.Client -{ - /// - /// Represents a set of configuration settings - /// - public class Configuration - { - /// - /// Initializes a new instance of the Configuration class with different settings - /// - /// Api client - /// Dictionary of default HTTP header - /// Username - /// Password - /// accessToken - /// Dictionary of API key - /// Dictionary of API key prefix - /// Temp folder path - /// DateTime format string - /// HTTP connection timeout (in milliseconds) - /// HTTP user agent - public Configuration(ApiClient apiClient = null, - Dictionary defaultHeader = null, - string username = null, - string password = null, - string accessToken = null, - Dictionary apiKey = null, - Dictionary apiKeyPrefix = null, - string tempFolderPath = null, - string dateTimeFormat = null, - int timeout = 100000, - string userAgent = "Swagger-Codegen/1.0.0/csharp" - ) - { - setApiClientUsingDefault(apiClient); - - Username = username; - Password = password; - AccessToken = accessToken; - UserAgent = userAgent; - - if (defaultHeader != null) - DefaultHeader = defaultHeader; - if (apiKey != null) - ApiKey = apiKey; - if (apiKeyPrefix != null) - ApiKeyPrefix = apiKeyPrefix; - - TempFolderPath = tempFolderPath; - DateTimeFormat = dateTimeFormat; - Timeout = TimeSpan.FromMilliseconds(timeout); - } - - /// - /// Initializes a new instance of the Configuration class. - /// - /// Api client. - public Configuration(ApiClient apiClient) - { - setApiClientUsingDefault(apiClient); - } - - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "1.0.0"; - - /// - /// Gets or sets the default Configuration. - /// - /// Configuration. - public static Configuration Default = new Configuration(); - - /// - /// Default creation of exceptions for a given method name and response object - /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => - { - int status = (int) response.StatusCode; - if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); - return null; - }; - - /// - /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. - /// - /// Timeout. - public TimeSpan? Timeout - { - get { return ApiClient.RestClient.Timeout; } - - set - { - if (ApiClient != null) - ApiClient.RestClient.Timeout = value; - } - } - - /// - /// Gets or sets the default API client for making HTTP calls. - /// - /// The API client. - public ApiClient ApiClient; - - /// - /// Set the ApiClient using Default or ApiClient instance. - /// - /// An instance of ApiClient. - /// - public void setApiClientUsingDefault (ApiClient apiClient = null) - { - if (apiClient == null) - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = new ApiClient(); - - ApiClient = Default != null ? Default.ApiClient : new ApiClient(); - } - else - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = apiClient; - - ApiClient = apiClient; - } - } - - private Dictionary _defaultHeaderMap = new Dictionary(); - - /// - /// Gets or sets the default header. - /// - public Dictionary DefaultHeader - { - get { return _defaultHeaderMap; } - - set - { - _defaultHeaderMap = value; - } - } - - /// - /// Add default header. - /// - /// Header field name. - /// Header field value. - /// - public void AddDefaultHeader(string key, string value) - { - _defaultHeaderMap[key] = value; - } - - /// - /// Add Api Key Header. - /// - /// Api Key name. - /// Api Key value. - /// - public void AddApiKey(string key, string value) - { - ApiKey[key] = value; - } - - /// - /// Sets the API key prefix. - /// - /// Api Key name. - /// Api Key value. - public void AddApiKeyPrefix(string key, string value) - { - ApiKeyPrefix[key] = value; - } - - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public String UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public String Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public String Password { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// The access token. - public String AccessToken { get; set; } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public Dictionary ApiKey = new Dictionary(); - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - public Dictionary ApiKeyPrefix = new Dictionary(); - - /// - /// Get the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix (string apiKeyIdentifier) - { - var apiKeyValue = ""; - ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); - var apiKeyPrefix = ""; - if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) - return apiKeyPrefix + " " + apiKeyValue; - else - return apiKeyValue; - } - - private string _tempFolderPath; - - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public String TempFolderPath - { - get - { - // default to Path.GetTempPath() if _tempFolderPath is not set - if (String.IsNullOrEmpty(_tempFolderPath)) - { - _tempFolderPath = Path.GetTempPath(); - } - return _tempFolderPath; - } - - set - { - if (String.IsNullOrEmpty(value)) - { - _tempFolderPath = value; - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - Directory.CreateDirectory(value); - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - _tempFolderPath = value; - else - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - - private const string ISO8601_DATETIME_FORMAT = "o"; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - - /// - /// Gets or sets the the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public String DateTimeFormat - { - get - { - return _dateTimeFormat; - } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Returns a string with essential information for debugging. - /// - public static String ToDebugReport() - { - String report = "C# SDK (IO.Swagger) Debug Report:\n"; - report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; - report += " Version of the API: 1.0.0\n"; - report += " SDK Package Version: 1.0.0\n"; - - return report; - } - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ExceptionFactory.cs deleted file mode 100644 index fd7e15d33eb1..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/ExceptionFactory.cs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - - -using System; -using RestSharp.Portable; - -namespace IO.Swagger.Client -{ - /// - /// A delegate to ExceptionFactory method - /// - /// Method name - /// Response - /// Exceptions - public delegate Exception ExceptionFactory(string methodName, IRestResponse response); -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/IApiAccessor.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/IApiAccessor.cs deleted file mode 100644 index 054dd600ab24..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Client/IApiAccessor.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using RestSharp.Portable; - -namespace IO.Swagger.Client -{ - /// - /// Represents configuration aspects required to interact with the API endpoints. - /// - public interface IApiAccessor - { - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - Configuration Configuration {get; set;} - - /// - /// Gets the base path of the API client. - /// - /// The base path - String GetBasePath(); - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - ExceptionFactory ExceptionFactory { get; set; } - } -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/IO.Swagger.csproj deleted file mode 100644 index 2429b4217d14..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/IO.Swagger.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - - 14.0 - Debug - AnyCPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C} - Library - Properties - IO.Swagger - IO.Swagger - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - v5.0 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/AdditionalPropertiesClass.cs deleted file mode 100644 index abbd4946d5cd..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/AdditionalPropertiesClass.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// AdditionalPropertiesClass - /// - [DataContract] - public partial class AdditionalPropertiesClass : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// MapProperty. - /// MapOfMapProperty. - public AdditionalPropertiesClass(Dictionary MapProperty = default(Dictionary), Dictionary> MapOfMapProperty = default(Dictionary>)) - { - this.MapProperty = MapProperty; - this.MapOfMapProperty = MapOfMapProperty; - } - - /// - /// Gets or Sets MapProperty - /// - [DataMember(Name="map_property", EmitDefaultValue=false)] - public Dictionary MapProperty { get; set; } - /// - /// Gets or Sets MapOfMapProperty - /// - [DataMember(Name="map_of_map_property", EmitDefaultValue=false)] - public Dictionary> MapOfMapProperty { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class AdditionalPropertiesClass {\n"); - sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); - sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as AdditionalPropertiesClass); - } - - /// - /// Returns true if AdditionalPropertiesClass instances are equal - /// - /// Instance of AdditionalPropertiesClass to be compared - /// Boolean - public bool Equals(AdditionalPropertiesClass other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.MapProperty == other.MapProperty || - this.MapProperty != null && - this.MapProperty.SequenceEqual(other.MapProperty) - ) && - ( - this.MapOfMapProperty == other.MapOfMapProperty || - this.MapOfMapProperty != null && - this.MapOfMapProperty.SequenceEqual(other.MapOfMapProperty) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.MapProperty != null) - hash = hash * 59 + this.MapProperty.GetHashCode(); - if (this.MapOfMapProperty != null) - hash = hash * 59 + this.MapOfMapProperty.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Animal.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Animal.cs deleted file mode 100644 index b5deb62a3d41..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Animal.cs +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Animal - /// - [DataContract] - public partial class Animal : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected Animal() { } - /// - /// Initializes a new instance of the class. - /// - /// ClassName (required). - /// Color (default to "red"). - public Animal(string ClassName = default(string), string Color = "red") - { - // to ensure "ClassName" is required (not null) - if (ClassName == null) - { - throw new InvalidDataException("ClassName is a required property for Animal and cannot be null"); - } - else - { - this.ClassName = ClassName; - } - // use default value if no "Color" provided - if (Color == null) - { - this.Color = "red"; - } - else - { - this.Color = Color; - } - } - - /// - /// Gets or Sets ClassName - /// - [DataMember(Name="className", EmitDefaultValue=false)] - public string ClassName { get; set; } - /// - /// Gets or Sets Color - /// - [DataMember(Name="color", EmitDefaultValue=false)] - public string Color { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Animal {\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" Color: ").Append(Color).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Animal); - } - - /// - /// Returns true if Animal instances are equal - /// - /// Instance of Animal to be compared - /// Boolean - public bool Equals(Animal other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.ClassName == other.ClassName || - this.ClassName != null && - this.ClassName.Equals(other.ClassName) - ) && - ( - this.Color == other.Color || - this.Color != null && - this.Color.Equals(other.Color) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.ClassName != null) - hash = hash * 59 + this.ClassName.GetHashCode(); - if (this.Color != null) - hash = hash * 59 + this.Color.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs deleted file mode 100644 index af0261d185df..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayOfArrayOfNumberOnly.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// ArrayOfArrayOfNumberOnly - /// - [DataContract] - public partial class ArrayOfArrayOfNumberOnly : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// ArrayArrayNumber. - public ArrayOfArrayOfNumberOnly(List> ArrayArrayNumber = default(List>)) - { - this.ArrayArrayNumber = ArrayArrayNumber; - } - - /// - /// Gets or Sets ArrayArrayNumber - /// - [DataMember(Name="ArrayArrayNumber", EmitDefaultValue=false)] - public List> ArrayArrayNumber { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class ArrayOfArrayOfNumberOnly {\n"); - sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ArrayOfArrayOfNumberOnly); - } - - /// - /// Returns true if ArrayOfArrayOfNumberOnly instances are equal - /// - /// Instance of ArrayOfArrayOfNumberOnly to be compared - /// Boolean - public bool Equals(ArrayOfArrayOfNumberOnly other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.ArrayArrayNumber == other.ArrayArrayNumber || - this.ArrayArrayNumber != null && - this.ArrayArrayNumber.SequenceEqual(other.ArrayArrayNumber) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.ArrayArrayNumber != null) - hash = hash * 59 + this.ArrayArrayNumber.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayOfNumberOnly.cs deleted file mode 100644 index 8e20ad3b36d7..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayOfNumberOnly.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// ArrayOfNumberOnly - /// - [DataContract] - public partial class ArrayOfNumberOnly : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// ArrayNumber. - public ArrayOfNumberOnly(List ArrayNumber = default(List)) - { - this.ArrayNumber = ArrayNumber; - } - - /// - /// Gets or Sets ArrayNumber - /// - [DataMember(Name="ArrayNumber", EmitDefaultValue=false)] - public List ArrayNumber { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class ArrayOfNumberOnly {\n"); - sb.Append(" ArrayNumber: ").Append(ArrayNumber).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ArrayOfNumberOnly); - } - - /// - /// Returns true if ArrayOfNumberOnly instances are equal - /// - /// Instance of ArrayOfNumberOnly to be compared - /// Boolean - public bool Equals(ArrayOfNumberOnly other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.ArrayNumber == other.ArrayNumber || - this.ArrayNumber != null && - this.ArrayNumber.SequenceEqual(other.ArrayNumber) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.ArrayNumber != null) - hash = hash * 59 + this.ArrayNumber.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayTest.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayTest.cs deleted file mode 100644 index df50f57e3b11..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ArrayTest.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// ArrayTest - /// - [DataContract] - public partial class ArrayTest : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// ArrayOfString. - /// ArrayArrayOfInteger. - /// ArrayArrayOfModel. - public ArrayTest(List ArrayOfString = default(List), List> ArrayArrayOfInteger = default(List>), List> ArrayArrayOfModel = default(List>)) - { - this.ArrayOfString = ArrayOfString; - this.ArrayArrayOfInteger = ArrayArrayOfInteger; - this.ArrayArrayOfModel = ArrayArrayOfModel; - } - - /// - /// Gets or Sets ArrayOfString - /// - [DataMember(Name="array_of_string", EmitDefaultValue=false)] - public List ArrayOfString { get; set; } - /// - /// Gets or Sets ArrayArrayOfInteger - /// - [DataMember(Name="array_array_of_integer", EmitDefaultValue=false)] - public List> ArrayArrayOfInteger { get; set; } - /// - /// Gets or Sets ArrayArrayOfModel - /// - [DataMember(Name="array_array_of_model", EmitDefaultValue=false)] - public List> ArrayArrayOfModel { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class ArrayTest {\n"); - sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); - sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); - sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ArrayTest); - } - - /// - /// Returns true if ArrayTest instances are equal - /// - /// Instance of ArrayTest to be compared - /// Boolean - public bool Equals(ArrayTest other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.ArrayOfString == other.ArrayOfString || - this.ArrayOfString != null && - this.ArrayOfString.SequenceEqual(other.ArrayOfString) - ) && - ( - this.ArrayArrayOfInteger == other.ArrayArrayOfInteger || - this.ArrayArrayOfInteger != null && - this.ArrayArrayOfInteger.SequenceEqual(other.ArrayArrayOfInteger) - ) && - ( - this.ArrayArrayOfModel == other.ArrayArrayOfModel || - this.ArrayArrayOfModel != null && - this.ArrayArrayOfModel.SequenceEqual(other.ArrayArrayOfModel) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.ArrayOfString != null) - hash = hash * 59 + this.ArrayOfString.GetHashCode(); - if (this.ArrayArrayOfInteger != null) - hash = hash * 59 + this.ArrayArrayOfInteger.GetHashCode(); - if (this.ArrayArrayOfModel != null) - hash = hash * 59 + this.ArrayArrayOfModel.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Capitalization.cs deleted file mode 100644 index f4fc45d584d2..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Capitalization.cs +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Capitalization - /// - [DataContract] - public partial class Capitalization : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// SmallCamel. - /// CapitalCamel. - /// SmallSnake. - /// CapitalSnake. - /// SCAETHFlowPoints. - /// Name of the pet . - public Capitalization(string SmallCamel = default(string), string CapitalCamel = default(string), string SmallSnake = default(string), string CapitalSnake = default(string), string SCAETHFlowPoints = default(string), string ATT_NAME = default(string)) - { - this.SmallCamel = SmallCamel; - this.CapitalCamel = CapitalCamel; - this.SmallSnake = SmallSnake; - this.CapitalSnake = CapitalSnake; - this.SCAETHFlowPoints = SCAETHFlowPoints; - this.ATT_NAME = ATT_NAME; - } - - /// - /// Gets or Sets SmallCamel - /// - [DataMember(Name="smallCamel", EmitDefaultValue=false)] - public string SmallCamel { get; set; } - /// - /// Gets or Sets CapitalCamel - /// - [DataMember(Name="CapitalCamel", EmitDefaultValue=false)] - public string CapitalCamel { get; set; } - /// - /// Gets or Sets SmallSnake - /// - [DataMember(Name="small_Snake", EmitDefaultValue=false)] - public string SmallSnake { get; set; } - /// - /// Gets or Sets CapitalSnake - /// - [DataMember(Name="Capital_Snake", EmitDefaultValue=false)] - public string CapitalSnake { get; set; } - /// - /// Gets or Sets SCAETHFlowPoints - /// - [DataMember(Name="SCA_ETH_Flow_Points", EmitDefaultValue=false)] - public string SCAETHFlowPoints { get; set; } - /// - /// Name of the pet - /// - /// Name of the pet - [DataMember(Name="ATT_NAME", EmitDefaultValue=false)] - public string ATT_NAME { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Capitalization {\n"); - sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); - sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); - sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); - sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); - sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); - sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Capitalization); - } - - /// - /// Returns true if Capitalization instances are equal - /// - /// Instance of Capitalization to be compared - /// Boolean - public bool Equals(Capitalization other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.SmallCamel == other.SmallCamel || - this.SmallCamel != null && - this.SmallCamel.Equals(other.SmallCamel) - ) && - ( - this.CapitalCamel == other.CapitalCamel || - this.CapitalCamel != null && - this.CapitalCamel.Equals(other.CapitalCamel) - ) && - ( - this.SmallSnake == other.SmallSnake || - this.SmallSnake != null && - this.SmallSnake.Equals(other.SmallSnake) - ) && - ( - this.CapitalSnake == other.CapitalSnake || - this.CapitalSnake != null && - this.CapitalSnake.Equals(other.CapitalSnake) - ) && - ( - this.SCAETHFlowPoints == other.SCAETHFlowPoints || - this.SCAETHFlowPoints != null && - this.SCAETHFlowPoints.Equals(other.SCAETHFlowPoints) - ) && - ( - this.ATT_NAME == other.ATT_NAME || - this.ATT_NAME != null && - this.ATT_NAME.Equals(other.ATT_NAME) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.SmallCamel != null) - hash = hash * 59 + this.SmallCamel.GetHashCode(); - if (this.CapitalCamel != null) - hash = hash * 59 + this.CapitalCamel.GetHashCode(); - if (this.SmallSnake != null) - hash = hash * 59 + this.SmallSnake.GetHashCode(); - if (this.CapitalSnake != null) - hash = hash * 59 + this.CapitalSnake.GetHashCode(); - if (this.SCAETHFlowPoints != null) - hash = hash * 59 + this.SCAETHFlowPoints.GetHashCode(); - if (this.ATT_NAME != null) - hash = hash * 59 + this.ATT_NAME.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Cat.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Cat.cs deleted file mode 100644 index 4507cb84797f..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Cat.cs +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Cat - /// - [DataContract] - public partial class Cat : Animal, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected Cat() { } - /// - /// Initializes a new instance of the class. - /// - /// ClassName (required). - /// Color (default to "red"). - /// Declawed. - public Cat(string ClassName = default(string), string Color = "red", bool? Declawed = default(bool?)) - { - // to ensure "ClassName" is required (not null) - if (ClassName == null) - { - throw new InvalidDataException("ClassName is a required property for Cat and cannot be null"); - } - else - { - this.ClassName = ClassName; - } - // use default value if no "Color" provided - if (Color == null) - { - this.Color = "red"; - } - else - { - this.Color = Color; - } - this.Declawed = Declawed; - } - - /// - /// Gets or Sets ClassName - /// - [DataMember(Name="className", EmitDefaultValue=false)] - public string ClassName { get; set; } - /// - /// Gets or Sets Color - /// - [DataMember(Name="color", EmitDefaultValue=false)] - public string Color { get; set; } - /// - /// Gets or Sets Declawed - /// - [DataMember(Name="declawed", EmitDefaultValue=false)] - public bool? Declawed { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Cat {\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" Color: ").Append(Color).Append("\n"); - sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public new string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Cat); - } - - /// - /// Returns true if Cat instances are equal - /// - /// Instance of Cat to be compared - /// Boolean - public bool Equals(Cat other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.ClassName == other.ClassName || - this.ClassName != null && - this.ClassName.Equals(other.ClassName) - ) && - ( - this.Color == other.Color || - this.Color != null && - this.Color.Equals(other.Color) - ) && - ( - this.Declawed == other.Declawed || - this.Declawed != null && - this.Declawed.Equals(other.Declawed) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.ClassName != null) - hash = hash * 59 + this.ClassName.GetHashCode(); - if (this.Color != null) - hash = hash * 59 + this.Color.GetHashCode(); - if (this.Declawed != null) - hash = hash * 59 + this.Declawed.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Category.cs deleted file mode 100644 index 24af926ed4ee..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Category.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Category - /// - [DataContract] - public partial class Category : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// Id. - /// Name. - public Category(long? Id = default(long?), string Name = default(string)) - { - this.Id = Id; - this.Name = Name; - } - - /// - /// Gets or Sets Id - /// - [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } - /// - /// Gets or Sets Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public string Name { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Category); - } - - /// - /// Returns true if Category instances are equal - /// - /// Instance of Category to be compared - /// Boolean - public bool Equals(Category other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) - ) && - ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ClassModel.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ClassModel.cs deleted file mode 100644 index c58469095111..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ClassModel.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Model for testing model with \"_class\" property - /// - [DataContract] - public partial class ClassModel : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// _Class. - public ClassModel(string _Class = default(string)) - { - this._Class = _Class; - } - - /// - /// Gets or Sets _Class - /// - [DataMember(Name="_class", EmitDefaultValue=false)] - public string _Class { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class ClassModel {\n"); - sb.Append(" _Class: ").Append(_Class).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ClassModel); - } - - /// - /// Returns true if ClassModel instances are equal - /// - /// Instance of ClassModel to be compared - /// Boolean - public bool Equals(ClassModel other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this._Class == other._Class || - this._Class != null && - this._Class.Equals(other._Class) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this._Class != null) - hash = hash * 59 + this._Class.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Dog.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Dog.cs deleted file mode 100644 index 9efa2b274766..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Dog.cs +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Dog - /// - [DataContract] - public partial class Dog : Animal, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected Dog() { } - /// - /// Initializes a new instance of the class. - /// - /// ClassName (required). - /// Color (default to "red"). - /// Breed. - public Dog(string ClassName = default(string), string Color = "red", string Breed = default(string)) - { - // to ensure "ClassName" is required (not null) - if (ClassName == null) - { - throw new InvalidDataException("ClassName is a required property for Dog and cannot be null"); - } - else - { - this.ClassName = ClassName; - } - // use default value if no "Color" provided - if (Color == null) - { - this.Color = "red"; - } - else - { - this.Color = Color; - } - this.Breed = Breed; - } - - /// - /// Gets or Sets ClassName - /// - [DataMember(Name="className", EmitDefaultValue=false)] - public string ClassName { get; set; } - /// - /// Gets or Sets Color - /// - [DataMember(Name="color", EmitDefaultValue=false)] - public string Color { get; set; } - /// - /// Gets or Sets Breed - /// - [DataMember(Name="breed", EmitDefaultValue=false)] - public string Breed { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Dog {\n"); - sb.Append(" ClassName: ").Append(ClassName).Append("\n"); - sb.Append(" Color: ").Append(Color).Append("\n"); - sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public new string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Dog); - } - - /// - /// Returns true if Dog instances are equal - /// - /// Instance of Dog to be compared - /// Boolean - public bool Equals(Dog other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.ClassName == other.ClassName || - this.ClassName != null && - this.ClassName.Equals(other.ClassName) - ) && - ( - this.Color == other.Color || - this.Color != null && - this.Color.Equals(other.Color) - ) && - ( - this.Breed == other.Breed || - this.Breed != null && - this.Breed.Equals(other.Breed) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.ClassName != null) - hash = hash * 59 + this.ClassName.GetHashCode(); - if (this.Color != null) - hash = hash * 59 + this.Color.GetHashCode(); - if (this.Breed != null) - hash = hash * 59 + this.Breed.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumArrays.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumArrays.cs deleted file mode 100644 index a7e1844d2cd6..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumArrays.cs +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// EnumArrays - /// - [DataContract] - public partial class EnumArrays : IEquatable - { - /// - /// Gets or Sets JustSymbol - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum JustSymbolEnum - { - - /// - /// Enum GreaterThanOrEqualTo for ">=" - /// - [EnumMember(Value = ">=")] - GreaterThanOrEqualTo, - - /// - /// Enum Dollar for "$" - /// - [EnumMember(Value = "$")] - Dollar - } - - - /// - /// Gets or Sets ArrayEnum - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ArrayEnumEnum - { - - /// - /// Enum Fish for "fish" - /// - [EnumMember(Value = "fish")] - Fish, - - /// - /// Enum Crab for "crab" - /// - [EnumMember(Value = "crab")] - Crab - } - - /// - /// Gets or Sets JustSymbol - /// - [DataMember(Name="just_symbol", EmitDefaultValue=false)] - public JustSymbolEnum? JustSymbol { get; set; } - /// - /// Gets or Sets ArrayEnum - /// - [DataMember(Name="array_enum", EmitDefaultValue=false)] - public List ArrayEnum { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// JustSymbol. - /// ArrayEnum. - public EnumArrays(JustSymbolEnum? JustSymbol = default(JustSymbolEnum?), List ArrayEnum = default(List)) - { - this.JustSymbol = JustSymbol; - this.ArrayEnum = ArrayEnum; - } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class EnumArrays {\n"); - sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); - sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as EnumArrays); - } - - /// - /// Returns true if EnumArrays instances are equal - /// - /// Instance of EnumArrays to be compared - /// Boolean - public bool Equals(EnumArrays other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.JustSymbol == other.JustSymbol || - this.JustSymbol != null && - this.JustSymbol.Equals(other.JustSymbol) - ) && - ( - this.ArrayEnum == other.ArrayEnum || - this.ArrayEnum != null && - this.ArrayEnum.SequenceEqual(other.ArrayEnum) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.JustSymbol != null) - hash = hash * 59 + this.JustSymbol.GetHashCode(); - if (this.ArrayEnum != null) - hash = hash * 59 + this.ArrayEnum.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumClass.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumClass.cs deleted file mode 100644 index cbabcb69da42..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumClass.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Defines EnumClass - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum EnumClass - { - - /// - /// Enum Abc for "_abc" - /// - [EnumMember(Value = "_abc")] - Abc, - - /// - /// Enum Efg for "-efg" - /// - [EnumMember(Value = "-efg")] - Efg, - - /// - /// Enum Xyz for "(xyz)" - /// - [EnumMember(Value = "(xyz)")] - Xyz - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumTest.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumTest.cs deleted file mode 100644 index 61180e59ff35..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/EnumTest.cs +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// EnumTest - /// - [DataContract] - public partial class EnumTest : IEquatable - { - /// - /// Gets or Sets EnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum EnumStringEnum - { - - /// - /// Enum UPPER for "UPPER" - /// - [EnumMember(Value = "UPPER")] - UPPER, - - /// - /// Enum Lower for "lower" - /// - [EnumMember(Value = "lower")] - Lower, - - /// - /// Enum Empty for "" - /// - [EnumMember(Value = "")] - Empty - } - - /// - /// Gets or Sets EnumInteger - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum EnumIntegerEnum - { - - /// - /// Enum NUMBER_1 for 1 - /// - [EnumMember(Value = "1")] - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for -1 - /// - [EnumMember(Value = "-1")] - NUMBER_MINUS_1 = -1 - } - - /// - /// Gets or Sets EnumNumber - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum EnumNumberEnum - { - - /// - /// Enum NUMBER_1_DOT_1 for 1.1 - /// - [EnumMember(Value = "1.1")] - NUMBER_1_DOT_1, - - /// - /// Enum NUMBER_MINUS_1_DOT_2 for -1.2 - /// - [EnumMember(Value = "-1.2")] - NUMBER_MINUS_1_DOT_2 - } - - /// - /// Gets or Sets EnumString - /// - [DataMember(Name="enum_string", EmitDefaultValue=false)] - public EnumStringEnum? EnumString { get; set; } - /// - /// Gets or Sets EnumInteger - /// - [DataMember(Name="enum_integer", EmitDefaultValue=false)] - public EnumIntegerEnum? EnumInteger { get; set; } - /// - /// Gets or Sets EnumNumber - /// - [DataMember(Name="enum_number", EmitDefaultValue=false)] - public EnumNumberEnum? EnumNumber { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// EnumString. - /// EnumInteger. - /// EnumNumber. - /// OuterEnum. - public EnumTest(EnumStringEnum? EnumString = default(EnumStringEnum?), EnumIntegerEnum? EnumInteger = default(EnumIntegerEnum?), EnumNumberEnum? EnumNumber = default(EnumNumberEnum?), OuterEnum OuterEnum = default(OuterEnum)) - { - this.EnumString = EnumString; - this.EnumInteger = EnumInteger; - this.EnumNumber = EnumNumber; - this.OuterEnum = OuterEnum; - } - - /// - /// Gets or Sets OuterEnum - /// - [DataMember(Name="outerEnum", EmitDefaultValue=false)] - public OuterEnum OuterEnum { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class EnumTest {\n"); - sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); - sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); - sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as EnumTest); - } - - /// - /// Returns true if EnumTest instances are equal - /// - /// Instance of EnumTest to be compared - /// Boolean - public bool Equals(EnumTest other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.EnumString == other.EnumString || - this.EnumString != null && - this.EnumString.Equals(other.EnumString) - ) && - ( - this.EnumInteger == other.EnumInteger || - this.EnumInteger != null && - this.EnumInteger.Equals(other.EnumInteger) - ) && - ( - this.EnumNumber == other.EnumNumber || - this.EnumNumber != null && - this.EnumNumber.Equals(other.EnumNumber) - ) && - ( - this.OuterEnum == other.OuterEnum || - this.OuterEnum != null && - this.OuterEnum.Equals(other.OuterEnum) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.EnumString != null) - hash = hash * 59 + this.EnumString.GetHashCode(); - if (this.EnumInteger != null) - hash = hash * 59 + this.EnumInteger.GetHashCode(); - if (this.EnumNumber != null) - hash = hash * 59 + this.EnumNumber.GetHashCode(); - if (this.OuterEnum != null) - hash = hash * 59 + this.OuterEnum.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/FormatTest.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/FormatTest.cs deleted file mode 100644 index ee866b6352be..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/FormatTest.cs +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// FormatTest - /// - [DataContract] - public partial class FormatTest : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected FormatTest() { } - /// - /// Initializes a new instance of the class. - /// - /// Integer. - /// Int32. - /// Int64. - /// Number (required). - /// _Float. - /// _Double. - /// _String. - /// _Byte (required). - /// Binary. - /// Date (required). - /// DateTime. - /// Uuid. - /// Password (required). - public FormatTest(int? Integer = default(int?), int? Int32 = default(int?), long? Int64 = default(long?), decimal? Number = default(decimal?), float? _Float = default(float?), double? _Double = default(double?), string _String = default(string), byte[] _Byte = default(byte[]), byte[] Binary = default(byte[]), DateTime? Date = default(DateTime?), DateTime? DateTime = default(DateTime?), Guid? Uuid = default(Guid?), string Password = default(string)) - { - // to ensure "Number" is required (not null) - if (Number == null) - { - throw new InvalidDataException("Number is a required property for FormatTest and cannot be null"); - } - else - { - this.Number = Number; - } - // to ensure "_Byte" is required (not null) - if (_Byte == null) - { - throw new InvalidDataException("_Byte is a required property for FormatTest and cannot be null"); - } - else - { - this._Byte = _Byte; - } - // to ensure "Date" is required (not null) - if (Date == null) - { - throw new InvalidDataException("Date is a required property for FormatTest and cannot be null"); - } - else - { - this.Date = Date; - } - // to ensure "Password" is required (not null) - if (Password == null) - { - throw new InvalidDataException("Password is a required property for FormatTest and cannot be null"); - } - else - { - this.Password = Password; - } - this.Integer = Integer; - this.Int32 = Int32; - this.Int64 = Int64; - this._Float = _Float; - this._Double = _Double; - this._String = _String; - this.Binary = Binary; - this.DateTime = DateTime; - this.Uuid = Uuid; - } - - /// - /// Gets or Sets Integer - /// - [DataMember(Name="integer", EmitDefaultValue=false)] - public int? Integer { get; set; } - /// - /// Gets or Sets Int32 - /// - [DataMember(Name="int32", EmitDefaultValue=false)] - public int? Int32 { get; set; } - /// - /// Gets or Sets Int64 - /// - [DataMember(Name="int64", EmitDefaultValue=false)] - public long? Int64 { get; set; } - /// - /// Gets or Sets Number - /// - [DataMember(Name="number", EmitDefaultValue=false)] - public decimal? Number { get; set; } - /// - /// Gets or Sets _Float - /// - [DataMember(Name="float", EmitDefaultValue=false)] - public float? _Float { get; set; } - /// - /// Gets or Sets _Double - /// - [DataMember(Name="double", EmitDefaultValue=false)] - public double? _Double { get; set; } - /// - /// Gets or Sets _String - /// - [DataMember(Name="string", EmitDefaultValue=false)] - public string _String { get; set; } - /// - /// Gets or Sets _Byte - /// - [DataMember(Name="byte", EmitDefaultValue=false)] - public byte[] _Byte { get; set; } - /// - /// Gets or Sets Binary - /// - [DataMember(Name="binary", EmitDefaultValue=false)] - public byte[] Binary { get; set; } - /// - /// Gets or Sets Date - /// - [DataMember(Name="date", EmitDefaultValue=false)] - public DateTime? Date { get; set; } - /// - /// Gets or Sets DateTime - /// - [DataMember(Name="dateTime", EmitDefaultValue=false)] - public DateTime? DateTime { get; set; } - /// - /// Gets or Sets Uuid - /// - [DataMember(Name="uuid", EmitDefaultValue=false)] - public Guid? Uuid { get; set; } - /// - /// Gets or Sets Password - /// - [DataMember(Name="password", EmitDefaultValue=false)] - public string Password { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class FormatTest {\n"); - sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Int32: ").Append(Int32).Append("\n"); - sb.Append(" Int64: ").Append(Int64).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" _Float: ").Append(_Float).Append("\n"); - sb.Append(" _Double: ").Append(_Double).Append("\n"); - sb.Append(" _String: ").Append(_String).Append("\n"); - sb.Append(" _Byte: ").Append(_Byte).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); - sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" DateTime: ").Append(DateTime).Append("\n"); - sb.Append(" Uuid: ").Append(Uuid).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as FormatTest); - } - - /// - /// Returns true if FormatTest instances are equal - /// - /// Instance of FormatTest to be compared - /// Boolean - public bool Equals(FormatTest other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Integer == other.Integer || - this.Integer != null && - this.Integer.Equals(other.Integer) - ) && - ( - this.Int32 == other.Int32 || - this.Int32 != null && - this.Int32.Equals(other.Int32) - ) && - ( - this.Int64 == other.Int64 || - this.Int64 != null && - this.Int64.Equals(other.Int64) - ) && - ( - this.Number == other.Number || - this.Number != null && - this.Number.Equals(other.Number) - ) && - ( - this._Float == other._Float || - this._Float != null && - this._Float.Equals(other._Float) - ) && - ( - this._Double == other._Double || - this._Double != null && - this._Double.Equals(other._Double) - ) && - ( - this._String == other._String || - this._String != null && - this._String.Equals(other._String) - ) && - ( - this._Byte == other._Byte || - this._Byte != null && - this._Byte.Equals(other._Byte) - ) && - ( - this.Binary == other.Binary || - this.Binary != null && - this.Binary.Equals(other.Binary) - ) && - ( - this.Date == other.Date || - this.Date != null && - this.Date.Equals(other.Date) - ) && - ( - this.DateTime == other.DateTime || - this.DateTime != null && - this.DateTime.Equals(other.DateTime) - ) && - ( - this.Uuid == other.Uuid || - this.Uuid != null && - this.Uuid.Equals(other.Uuid) - ) && - ( - this.Password == other.Password || - this.Password != null && - this.Password.Equals(other.Password) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Integer != null) - hash = hash * 59 + this.Integer.GetHashCode(); - if (this.Int32 != null) - hash = hash * 59 + this.Int32.GetHashCode(); - if (this.Int64 != null) - hash = hash * 59 + this.Int64.GetHashCode(); - if (this.Number != null) - hash = hash * 59 + this.Number.GetHashCode(); - if (this._Float != null) - hash = hash * 59 + this._Float.GetHashCode(); - if (this._Double != null) - hash = hash * 59 + this._Double.GetHashCode(); - if (this._String != null) - hash = hash * 59 + this._String.GetHashCode(); - if (this._Byte != null) - hash = hash * 59 + this._Byte.GetHashCode(); - if (this.Binary != null) - hash = hash * 59 + this.Binary.GetHashCode(); - if (this.Date != null) - hash = hash * 59 + this.Date.GetHashCode(); - if (this.DateTime != null) - hash = hash * 59 + this.DateTime.GetHashCode(); - if (this.Uuid != null) - hash = hash * 59 + this.Uuid.GetHashCode(); - if (this.Password != null) - hash = hash * 59 + this.Password.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/HasOnlyReadOnly.cs deleted file mode 100644 index ec193d2d3eca..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/HasOnlyReadOnly.cs +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// HasOnlyReadOnly - /// - [DataContract] - public partial class HasOnlyReadOnly : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - public HasOnlyReadOnly() - { - } - - /// - /// Gets or Sets Bar - /// - [DataMember(Name="bar", EmitDefaultValue=false)] - public string Bar { get; private set; } - /// - /// Gets or Sets Foo - /// - [DataMember(Name="foo", EmitDefaultValue=false)] - public string Foo { get; private set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class HasOnlyReadOnly {\n"); - sb.Append(" Bar: ").Append(Bar).Append("\n"); - sb.Append(" Foo: ").Append(Foo).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as HasOnlyReadOnly); - } - - /// - /// Returns true if HasOnlyReadOnly instances are equal - /// - /// Instance of HasOnlyReadOnly to be compared - /// Boolean - public bool Equals(HasOnlyReadOnly other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Bar == other.Bar || - this.Bar != null && - this.Bar.Equals(other.Bar) - ) && - ( - this.Foo == other.Foo || - this.Foo != null && - this.Foo.Equals(other.Foo) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Bar != null) - hash = hash * 59 + this.Bar.GetHashCode(); - if (this.Foo != null) - hash = hash * 59 + this.Foo.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/MapTest.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/MapTest.cs deleted file mode 100644 index 7f12eb1bce4e..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/MapTest.cs +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// MapTest - /// - [DataContract] - public partial class MapTest : IEquatable - { - - /// - /// Gets or Sets Inner - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum InnerEnum - { - - /// - /// Enum UPPER for "UPPER" - /// - [EnumMember(Value = "UPPER")] - UPPER, - - /// - /// Enum Lower for "lower" - /// - [EnumMember(Value = "lower")] - Lower - } - - /// - /// Gets or Sets MapOfEnumString - /// - [DataMember(Name="map_of_enum_string", EmitDefaultValue=false)] - public Dictionary MapOfEnumString { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// MapMapOfString. - /// MapOfEnumString. - public MapTest(Dictionary> MapMapOfString = default(Dictionary>), Dictionary MapOfEnumString = default(Dictionary)) - { - this.MapMapOfString = MapMapOfString; - this.MapOfEnumString = MapOfEnumString; - } - - /// - /// Gets or Sets MapMapOfString - /// - [DataMember(Name="map_map_of_string", EmitDefaultValue=false)] - public Dictionary> MapMapOfString { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class MapTest {\n"); - sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); - sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as MapTest); - } - - /// - /// Returns true if MapTest instances are equal - /// - /// Instance of MapTest to be compared - /// Boolean - public bool Equals(MapTest other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.MapMapOfString == other.MapMapOfString || - this.MapMapOfString != null && - this.MapMapOfString.SequenceEqual(other.MapMapOfString) - ) && - ( - this.MapOfEnumString == other.MapOfEnumString || - this.MapOfEnumString != null && - this.MapOfEnumString.SequenceEqual(other.MapOfEnumString) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.MapMapOfString != null) - hash = hash * 59 + this.MapMapOfString.GetHashCode(); - if (this.MapOfEnumString != null) - hash = hash * 59 + this.MapOfEnumString.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs deleted file mode 100644 index 65f176b799e1..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// MixedPropertiesAndAdditionalPropertiesClass - /// - [DataContract] - public partial class MixedPropertiesAndAdditionalPropertiesClass : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// Uuid. - /// DateTime. - /// Map. - public MixedPropertiesAndAdditionalPropertiesClass(Guid? Uuid = default(Guid?), DateTime? DateTime = default(DateTime?), Dictionary Map = default(Dictionary)) - { - this.Uuid = Uuid; - this.DateTime = DateTime; - this.Map = Map; - } - - /// - /// Gets or Sets Uuid - /// - [DataMember(Name="uuid", EmitDefaultValue=false)] - public Guid? Uuid { get; set; } - /// - /// Gets or Sets DateTime - /// - [DataMember(Name="dateTime", EmitDefaultValue=false)] - public DateTime? DateTime { get; set; } - /// - /// Gets or Sets Map - /// - [DataMember(Name="map", EmitDefaultValue=false)] - public Dictionary Map { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); - sb.Append(" Uuid: ").Append(Uuid).Append("\n"); - sb.Append(" DateTime: ").Append(DateTime).Append("\n"); - sb.Append(" Map: ").Append(Map).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as MixedPropertiesAndAdditionalPropertiesClass); - } - - /// - /// Returns true if MixedPropertiesAndAdditionalPropertiesClass instances are equal - /// - /// Instance of MixedPropertiesAndAdditionalPropertiesClass to be compared - /// Boolean - public bool Equals(MixedPropertiesAndAdditionalPropertiesClass other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Uuid == other.Uuid || - this.Uuid != null && - this.Uuid.Equals(other.Uuid) - ) && - ( - this.DateTime == other.DateTime || - this.DateTime != null && - this.DateTime.Equals(other.DateTime) - ) && - ( - this.Map == other.Map || - this.Map != null && - this.Map.SequenceEqual(other.Map) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Uuid != null) - hash = hash * 59 + this.Uuid.GetHashCode(); - if (this.DateTime != null) - hash = hash * 59 + this.DateTime.GetHashCode(); - if (this.Map != null) - hash = hash * 59 + this.Map.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Model200Response.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Model200Response.cs deleted file mode 100644 index d585e0a67113..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Model200Response.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Model for testing model name starting with number - /// - [DataContract] - public partial class Model200Response : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// Name. - /// _Class. - public Model200Response(int? Name = default(int?), string _Class = default(string)) - { - this.Name = Name; - this._Class = _Class; - } - - /// - /// Gets or Sets Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public int? Name { get; set; } - /// - /// Gets or Sets _Class - /// - [DataMember(Name="class", EmitDefaultValue=false)] - public string _Class { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Model200Response {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" _Class: ").Append(_Class).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Model200Response); - } - - /// - /// Returns true if Model200Response instances are equal - /// - /// Instance of Model200Response to be compared - /// Boolean - public bool Equals(Model200Response other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) - ) && - ( - this._Class == other._Class || - this._Class != null && - this._Class.Equals(other._Class) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - if (this._Class != null) - hash = hash * 59 + this._Class.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ModelReturn.cs deleted file mode 100644 index 902d8e8c4ad5..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ModelReturn.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Model for testing reserved words - /// - [DataContract] - public partial class ModelReturn : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// _Return. - public ModelReturn(int? _Return = default(int?)) - { - this._Return = _Return; - } - - /// - /// Gets or Sets _Return - /// - [DataMember(Name="return", EmitDefaultValue=false)] - public int? _Return { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class ModelReturn {\n"); - sb.Append(" _Return: ").Append(_Return).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ModelReturn); - } - - /// - /// Returns true if ModelReturn instances are equal - /// - /// Instance of ModelReturn to be compared - /// Boolean - public bool Equals(ModelReturn other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this._Return == other._Return || - this._Return != null && - this._Return.Equals(other._Return) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this._Return != null) - hash = hash * 59 + this._Return.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Name.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Name.cs deleted file mode 100644 index a34536c76ef3..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Name.cs +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Model for testing model name same as property name - /// - [DataContract] - public partial class Name : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected Name() { } - /// - /// Initializes a new instance of the class. - /// - /// _Name (required). - /// Property. - public Name(int? _Name = default(int?), string Property = default(string)) - { - // to ensure "_Name" is required (not null) - if (_Name == null) - { - throw new InvalidDataException("_Name is a required property for Name and cannot be null"); - } - else - { - this._Name = _Name; - } - this.Property = Property; - } - - /// - /// Gets or Sets _Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public int? _Name { get; set; } - /// - /// Gets or Sets SnakeCase - /// - [DataMember(Name="snake_case", EmitDefaultValue=false)] - public int? SnakeCase { get; private set; } - /// - /// Gets or Sets Property - /// - [DataMember(Name="property", EmitDefaultValue=false)] - public string Property { get; set; } - /// - /// Gets or Sets _123Number - /// - [DataMember(Name="123Number", EmitDefaultValue=false)] - public int? _123Number { get; private set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Name {\n"); - sb.Append(" _Name: ").Append(_Name).Append("\n"); - sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); - sb.Append(" Property: ").Append(Property).Append("\n"); - sb.Append(" _123Number: ").Append(_123Number).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Name); - } - - /// - /// Returns true if Name instances are equal - /// - /// Instance of Name to be compared - /// Boolean - public bool Equals(Name other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this._Name == other._Name || - this._Name != null && - this._Name.Equals(other._Name) - ) && - ( - this.SnakeCase == other.SnakeCase || - this.SnakeCase != null && - this.SnakeCase.Equals(other.SnakeCase) - ) && - ( - this.Property == other.Property || - this.Property != null && - this.Property.Equals(other.Property) - ) && - ( - this._123Number == other._123Number || - this._123Number != null && - this._123Number.Equals(other._123Number) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this._Name != null) - hash = hash * 59 + this._Name.GetHashCode(); - if (this.SnakeCase != null) - hash = hash * 59 + this.SnakeCase.GetHashCode(); - if (this.Property != null) - hash = hash * 59 + this.Property.GetHashCode(); - if (this._123Number != null) - hash = hash * 59 + this._123Number.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/NumberOnly.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/NumberOnly.cs deleted file mode 100644 index 82837173db05..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/NumberOnly.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// NumberOnly - /// - [DataContract] - public partial class NumberOnly : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// JustNumber. - public NumberOnly(decimal? JustNumber = default(decimal?)) - { - this.JustNumber = JustNumber; - } - - /// - /// Gets or Sets JustNumber - /// - [DataMember(Name="JustNumber", EmitDefaultValue=false)] - public decimal? JustNumber { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class NumberOnly {\n"); - sb.Append(" JustNumber: ").Append(JustNumber).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as NumberOnly); - } - - /// - /// Returns true if NumberOnly instances are equal - /// - /// Instance of NumberOnly to be compared - /// Boolean - public bool Equals(NumberOnly other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.JustNumber == other.JustNumber || - this.JustNumber != null && - this.JustNumber.Equals(other.JustNumber) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.JustNumber != null) - hash = hash * 59 + this.JustNumber.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Order.cs deleted file mode 100644 index 91f7f018e13d..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Order.cs +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Order - /// - [DataContract] - public partial class Order : IEquatable - { - /// - /// Order Status - /// - /// Order Status - [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum - { - - /// - /// Enum Placed for "placed" - /// - [EnumMember(Value = "placed")] - Placed, - - /// - /// Enum Approved for "approved" - /// - [EnumMember(Value = "approved")] - Approved, - - /// - /// Enum Delivered for "delivered" - /// - [EnumMember(Value = "delivered")] - Delivered - } - - /// - /// Order Status - /// - /// Order Status - [DataMember(Name="status", EmitDefaultValue=false)] - public StatusEnum? Status { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// Id. - /// PetId. - /// Quantity. - /// ShipDate. - /// Order Status. - /// Complete (default to false). - public Order(long? Id = default(long?), long? PetId = default(long?), int? Quantity = default(int?), DateTime? ShipDate = default(DateTime?), StatusEnum? Status = default(StatusEnum?), bool? Complete = false) - { - this.Id = Id; - this.PetId = PetId; - this.Quantity = Quantity; - this.ShipDate = ShipDate; - this.Status = Status; - // use default value if no "Complete" provided - if (Complete == null) - { - this.Complete = false; - } - else - { - this.Complete = Complete; - } - } - - /// - /// Gets or Sets Id - /// - [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } - /// - /// Gets or Sets PetId - /// - [DataMember(Name="petId", EmitDefaultValue=false)] - public long? PetId { get; set; } - /// - /// Gets or Sets Quantity - /// - [DataMember(Name="quantity", EmitDefaultValue=false)] - public int? Quantity { get; set; } - /// - /// Gets or Sets ShipDate - /// - [DataMember(Name="shipDate", EmitDefaultValue=false)] - public DateTime? ShipDate { get; set; } - /// - /// Gets or Sets Complete - /// - [DataMember(Name="complete", EmitDefaultValue=false)] - public bool? Complete { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Order {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" PetId: ").Append(PetId).Append("\n"); - sb.Append(" Quantity: ").Append(Quantity).Append("\n"); - sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Order); - } - - /// - /// Returns true if Order instances are equal - /// - /// Instance of Order to be compared - /// Boolean - public bool Equals(Order other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) - ) && - ( - this.PetId == other.PetId || - this.PetId != null && - this.PetId.Equals(other.PetId) - ) && - ( - this.Quantity == other.Quantity || - this.Quantity != null && - this.Quantity.Equals(other.Quantity) - ) && - ( - this.ShipDate == other.ShipDate || - this.ShipDate != null && - this.ShipDate.Equals(other.ShipDate) - ) && - ( - this.Status == other.Status || - this.Status != null && - this.Status.Equals(other.Status) - ) && - ( - this.Complete == other.Complete || - this.Complete != null && - this.Complete.Equals(other.Complete) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.PetId != null) - hash = hash * 59 + this.PetId.GetHashCode(); - if (this.Quantity != null) - hash = hash * 59 + this.Quantity.GetHashCode(); - if (this.ShipDate != null) - hash = hash * 59 + this.ShipDate.GetHashCode(); - if (this.Status != null) - hash = hash * 59 + this.Status.GetHashCode(); - if (this.Complete != null) - hash = hash * 59 + this.Complete.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/OuterEnum.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/OuterEnum.cs deleted file mode 100644 index 3395da21369c..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/OuterEnum.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Defines OuterEnum - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum OuterEnum - { - - /// - /// Enum Placed for "placed" - /// - [EnumMember(Value = "placed")] - Placed, - - /// - /// Enum Approved for "approved" - /// - [EnumMember(Value = "approved")] - Approved, - - /// - /// Enum Delivered for "delivered" - /// - [EnumMember(Value = "delivered")] - Delivered - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Pet.cs deleted file mode 100644 index bb38488dae3a..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Pet.cs +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Pet - /// - [DataContract] - public partial class Pet : IEquatable - { - /// - /// pet status in the store - /// - /// pet status in the store - [JsonConverter(typeof(StringEnumConverter))] - public enum StatusEnum - { - - /// - /// Enum Available for "available" - /// - [EnumMember(Value = "available")] - Available, - - /// - /// Enum Pending for "pending" - /// - [EnumMember(Value = "pending")] - Pending, - - /// - /// Enum Sold for "sold" - /// - [EnumMember(Value = "sold")] - Sold - } - - /// - /// pet status in the store - /// - /// pet status in the store - [DataMember(Name="status", EmitDefaultValue=false)] - public StatusEnum? Status { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected Pet() { } - /// - /// Initializes a new instance of the class. - /// - /// Id. - /// Category. - /// Name (required). - /// PhotoUrls (required). - /// Tags. - /// pet status in the store. - public Pet(long? Id = default(long?), Category Category = default(Category), string Name = default(string), List PhotoUrls = default(List), List Tags = default(List), StatusEnum? Status = default(StatusEnum?)) - { - // to ensure "Name" is required (not null) - if (Name == null) - { - throw new InvalidDataException("Name is a required property for Pet and cannot be null"); - } - else - { - this.Name = Name; - } - // to ensure "PhotoUrls" is required (not null) - if (PhotoUrls == null) - { - throw new InvalidDataException("PhotoUrls is a required property for Pet and cannot be null"); - } - else - { - this.PhotoUrls = PhotoUrls; - } - this.Id = Id; - this.Category = Category; - this.Tags = Tags; - this.Status = Status; - } - - /// - /// Gets or Sets Id - /// - [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } - /// - /// Gets or Sets Category - /// - [DataMember(Name="category", EmitDefaultValue=false)] - public Category Category { get; set; } - /// - /// Gets or Sets Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public string Name { get; set; } - /// - /// Gets or Sets PhotoUrls - /// - [DataMember(Name="photoUrls", EmitDefaultValue=false)] - public List PhotoUrls { get; set; } - /// - /// Gets or Sets Tags - /// - [DataMember(Name="tags", EmitDefaultValue=false)] - public List Tags { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Pet {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); - sb.Append(" Tags: ").Append(Tags).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Pet); - } - - /// - /// Returns true if Pet instances are equal - /// - /// Instance of Pet to be compared - /// Boolean - public bool Equals(Pet other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) - ) && - ( - this.Category == other.Category || - this.Category != null && - this.Category.Equals(other.Category) - ) && - ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) - ) && - ( - this.PhotoUrls == other.PhotoUrls || - this.PhotoUrls != null && - this.PhotoUrls.SequenceEqual(other.PhotoUrls) - ) && - ( - this.Tags == other.Tags || - this.Tags != null && - this.Tags.SequenceEqual(other.Tags) - ) && - ( - this.Status == other.Status || - this.Status != null && - this.Status.Equals(other.Status) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.Category != null) - hash = hash * 59 + this.Category.GetHashCode(); - if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - if (this.PhotoUrls != null) - hash = hash * 59 + this.PhotoUrls.GetHashCode(); - if (this.Tags != null) - hash = hash * 59 + this.Tags.GetHashCode(); - if (this.Status != null) - hash = hash * 59 + this.Status.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ReadOnlyFirst.cs deleted file mode 100644 index 717bbe49f078..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/ReadOnlyFirst.cs +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// ReadOnlyFirst - /// - [DataContract] - public partial class ReadOnlyFirst : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// Baz. - public ReadOnlyFirst(string Baz = default(string)) - { - this.Baz = Baz; - } - - /// - /// Gets or Sets Bar - /// - [DataMember(Name="bar", EmitDefaultValue=false)] - public string Bar { get; private set; } - /// - /// Gets or Sets Baz - /// - [DataMember(Name="baz", EmitDefaultValue=false)] - public string Baz { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class ReadOnlyFirst {\n"); - sb.Append(" Bar: ").Append(Bar).Append("\n"); - sb.Append(" Baz: ").Append(Baz).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as ReadOnlyFirst); - } - - /// - /// Returns true if ReadOnlyFirst instances are equal - /// - /// Instance of ReadOnlyFirst to be compared - /// Boolean - public bool Equals(ReadOnlyFirst other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Bar == other.Bar || - this.Bar != null && - this.Bar.Equals(other.Bar) - ) && - ( - this.Baz == other.Baz || - this.Baz != null && - this.Baz.Equals(other.Baz) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Bar != null) - hash = hash * 59 + this.Bar.GetHashCode(); - if (this.Baz != null) - hash = hash * 59 + this.Baz.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/SpecialModelName.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/SpecialModelName.cs deleted file mode 100644 index 023a87d91d1f..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/SpecialModelName.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// SpecialModelName - /// - [DataContract] - public partial class SpecialModelName : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// SpecialPropertyName. - public SpecialModelName(long? SpecialPropertyName = default(long?)) - { - this.SpecialPropertyName = SpecialPropertyName; - } - - /// - /// Gets or Sets SpecialPropertyName - /// - [DataMember(Name="$special[property.name]", EmitDefaultValue=false)] - public long? SpecialPropertyName { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class SpecialModelName {\n"); - sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as SpecialModelName); - } - - /// - /// Returns true if SpecialModelName instances are equal - /// - /// Instance of SpecialModelName to be compared - /// Boolean - public bool Equals(SpecialModelName other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.SpecialPropertyName == other.SpecialPropertyName || - this.SpecialPropertyName != null && - this.SpecialPropertyName.Equals(other.SpecialPropertyName) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.SpecialPropertyName != null) - hash = hash * 59 + this.SpecialPropertyName.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Tag.cs deleted file mode 100644 index 40b77533c464..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/Tag.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// Tag - /// - [DataContract] - public partial class Tag : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// Id. - /// Name. - public Tag(long? Id = default(long?), string Name = default(string)) - { - this.Id = Id; - this.Name = Name; - } - - /// - /// Gets or Sets Id - /// - [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } - /// - /// Gets or Sets Name - /// - [DataMember(Name="name", EmitDefaultValue=false)] - public string Name { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class Tag {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as Tag); - } - - /// - /// Returns true if Tag instances are equal - /// - /// Instance of Tag to be compared - /// Boolean - public bool Equals(Tag other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) - ) && - ( - this.Name == other.Name || - this.Name != null && - this.Name.Equals(other.Name) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.Name != null) - hash = hash * 59 + this.Name.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/User.cs deleted file mode 100644 index dc5a023bba06..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Model/User.cs +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Swagger Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * Contact: apiteam@swagger.io - * Generated by: https://github.com/swagger-api/swagger-codegen.git - */ - -using System; -using System.Linq; -using System.IO; -using System.Text; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.Serialization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace IO.Swagger.Model -{ - /// - /// User - /// - [DataContract] - public partial class User : IEquatable - { - /// - /// Initializes a new instance of the class. - /// - /// Id. - /// Username. - /// FirstName. - /// LastName. - /// Email. - /// Password. - /// Phone. - /// User Status. - public User(long? Id = default(long?), string Username = default(string), string FirstName = default(string), string LastName = default(string), string Email = default(string), string Password = default(string), string Phone = default(string), int? UserStatus = default(int?)) - { - this.Id = Id; - this.Username = Username; - this.FirstName = FirstName; - this.LastName = LastName; - this.Email = Email; - this.Password = Password; - this.Phone = Phone; - this.UserStatus = UserStatus; - } - - /// - /// Gets or Sets Id - /// - [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; set; } - /// - /// Gets or Sets Username - /// - [DataMember(Name="username", EmitDefaultValue=false)] - public string Username { get; set; } - /// - /// Gets or Sets FirstName - /// - [DataMember(Name="firstName", EmitDefaultValue=false)] - public string FirstName { get; set; } - /// - /// Gets or Sets LastName - /// - [DataMember(Name="lastName", EmitDefaultValue=false)] - public string LastName { get; set; } - /// - /// Gets or Sets Email - /// - [DataMember(Name="email", EmitDefaultValue=false)] - public string Email { get; set; } - /// - /// Gets or Sets Password - /// - [DataMember(Name="password", EmitDefaultValue=false)] - public string Password { get; set; } - /// - /// Gets or Sets Phone - /// - [DataMember(Name="phone", EmitDefaultValue=false)] - public string Phone { get; set; } - /// - /// User Status - /// - /// User Status - [DataMember(Name="userStatus", EmitDefaultValue=false)] - public int? UserStatus { get; set; } - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class User {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" FirstName: ").Append(FirstName).Append("\n"); - sb.Append(" LastName: ").Append(LastName).Append("\n"); - sb.Append(" Email: ").Append(Email).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Phone: ").Append(Phone).Append("\n"); - sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public string ToJson() - { - return JsonConvert.SerializeObject(this, Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - // credit: http://stackoverflow.com/a/10454552/677735 - return this.Equals(obj as User); - } - - /// - /// Returns true if User instances are equal - /// - /// Instance of User to be compared - /// Boolean - public bool Equals(User other) - { - // credit: http://stackoverflow.com/a/10454552/677735 - if (other == null) - return false; - - return - ( - this.Id == other.Id || - this.Id != null && - this.Id.Equals(other.Id) - ) && - ( - this.Username == other.Username || - this.Username != null && - this.Username.Equals(other.Username) - ) && - ( - this.FirstName == other.FirstName || - this.FirstName != null && - this.FirstName.Equals(other.FirstName) - ) && - ( - this.LastName == other.LastName || - this.LastName != null && - this.LastName.Equals(other.LastName) - ) && - ( - this.Email == other.Email || - this.Email != null && - this.Email.Equals(other.Email) - ) && - ( - this.Password == other.Password || - this.Password != null && - this.Password.Equals(other.Password) - ) && - ( - this.Phone == other.Phone || - this.Phone != null && - this.Phone.Equals(other.Phone) - ) && - ( - this.UserStatus == other.UserStatus || - this.UserStatus != null && - this.UserStatus.Equals(other.UserStatus) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - // credit: http://stackoverflow.com/a/263416/677735 - unchecked // Overflow is fine, just wrap - { - int hash = 41; - // Suitable nullity checks etc, of course :) - if (this.Id != null) - hash = hash * 59 + this.Id.GetHashCode(); - if (this.Username != null) - hash = hash * 59 + this.Username.GetHashCode(); - if (this.FirstName != null) - hash = hash * 59 + this.FirstName.GetHashCode(); - if (this.LastName != null) - hash = hash * 59 + this.LastName.GetHashCode(); - if (this.Email != null) - hash = hash * 59 + this.Email.GetHashCode(); - if (this.Password != null) - hash = hash * 59 + this.Password.GetHashCode(); - if (this.Phone != null) - hash = hash * 59 + this.Phone.GetHashCode(); - if (this.UserStatus != null) - hash = hash * 59 + this.UserStatus.GetHashCode(); - return hash; - } - } - } - -} diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Properties/AssemblyInfo.cs b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Properties/AssemblyInfo.cs deleted file mode 100644 index f3b9f7d1d145..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Swagger Library")] -[assembly: AssemblyDescription("A library generated from a Swagger doc")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Swagger")] -[assembly: AssemblyProduct("SwaggerLibrary")] -[assembly: AssemblyCopyright("No Copyright")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] diff --git a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/project.json b/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/project.json deleted file mode 100644 index 66cf3ab152c2..000000000000 --- a/samples/client/petstore/csharp/SwaggerClientNetStanard/src/IO.Swagger/project.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "supports": {}, - "dependencies": { - "FubarCoder.RestSharp.Portable.Core": "4.0.7", - "FubarCoder.RestSharp.Portable.HttpClient": "4.0.7", - "Newtonsoft.Json": "9.0.1" - }, - "frameworks": { - "netstandard1.3": {} - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/FakeApi.cs index a47ceb2b1f72..2a053d7821a0 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/FakeApi.cs @@ -416,15 +416,9 @@ namespace IO.Swagger.Api /// public FakeApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -441,12 +435,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -495,9 +483,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs index 07256da1e529..8c9f9c83fe1c 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/Fake_classname_tags123Api.cs @@ -84,15 +84,9 @@ namespace IO.Swagger.Api /// public Fake_classname_tags123Api(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -109,12 +103,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -163,9 +151,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/PetApi.cs index aba9f3a50fef..0a95c0e99ba1 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/PetApi.cs @@ -398,15 +398,9 @@ namespace IO.Swagger.Api /// public PetApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -423,12 +417,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -477,9 +465,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/StoreApi.cs index 2a74a1323872..c48bee756327 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/StoreApi.cs @@ -206,15 +206,9 @@ namespace IO.Swagger.Api /// public StoreApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -231,12 +225,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -285,9 +273,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/UserApi.cs index bcbdc71e9465..112baa5c8f62 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Api/UserApi.cs @@ -382,15 +382,9 @@ namespace IO.Swagger.Api /// public UserApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -407,12 +401,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -461,9 +449,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs index 8a4f59a76bb1..7ed77bfba21e 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs @@ -48,11 +48,11 @@ namespace IO.Swagger.Client /// /// Initializes a new instance of the class - /// with default configuration and base path (http://petstore.swagger.io:80/v2). + /// with default configuration. /// public ApiClient() { - Configuration = Configuration.Default; + Configuration = IO.Swagger.Client.Configuration.Default; RestClient = new RestClient("http://petstore.swagger.io:80/v2"); RestClient.IgnoreResponseStatusCode = true; } @@ -62,14 +62,11 @@ namespace IO.Swagger.Client /// with default base path (http://petstore.swagger.io:80/v2). /// /// An instance of Configuration. - public ApiClient(Configuration config = null) + public ApiClient(Configuration config) { - if (config == null) - Configuration = Configuration.Default; - else - Configuration = config; + Configuration = config ?? IO.Swagger.Client.Configuration.Default; - RestClient = new RestClient("http://petstore.swagger.io:80/v2"); + RestClient = new RestClient(Configuration.BasePath); RestClient.IgnoreResponseStatusCode = true; } @@ -85,7 +82,7 @@ namespace IO.Swagger.Client RestClient = new RestClient(basePath); RestClient.IgnoreResponseStatusCode = true; - Configuration = Configuration.Default; + Configuration = Client.Configuration.Default; } /// @@ -96,10 +93,15 @@ namespace IO.Swagger.Client public static ApiClient Default; /// - /// Gets or sets the Configuration. + /// Gets or sets an instance of the IReadableConfiguration. /// - /// An instance of the Configuration. - public Configuration Configuration { get; set; } + /// An instance of the IReadableConfiguration. + /// + /// helps us to avoid modifying possibly global + /// configuration values from within a given client. It does not gaurantee thread-safety + /// of the instance in any way. + /// + public IReadableConfiguration Configuration { get; set; } /// /// Gets or sets the RestClient. @@ -179,7 +181,8 @@ namespace IO.Swagger.Client pathParams, contentType); // set timeout - RestClient.Timeout = Configuration.Timeout; + RestClient.Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout); + // set user agent RestClient.UserAgent = Configuration.UserAgent; @@ -291,6 +294,7 @@ namespace IO.Swagger.Client return response.RawBytes; } + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) if (type == typeof(Stream)) { if (headers != null) diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/Configuration.cs index eee4f3bad89b..bfea3c89bbaf 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/Configuration.cs @@ -10,6 +10,7 @@ using System; using System.Reflection; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -20,10 +21,143 @@ namespace IO.Swagger.Client /// /// Represents a set of configuration settings /// - public class Configuration + public class Configuration : IReadableConfiguration { + #region Constants + /// - /// Initializes a new instance of the Configuration class with different settings + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + private static readonly object GlobalConfigSync = new { }; + private static Configuration _globalConfiguration; + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.Content), + response.Content); + } + + return null; + }; + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static Configuration Default + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + + #endregion Static Members + + #region Private Members + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + private IDictionary _apiKey = null; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix = null; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + #endregion Private Members + + #region Constructors + + static Configuration() + { + _globalConfiguration = new GlobalConfiguration(); + } + + /// + /// Initializes a new instance of the class + /// + public Configuration() + { + UserAgent = "Swagger-Codegen/1.0.0/csharp"; + BasePath = "http://petstore.swagger.io:80/v2"; + DefaultHeader = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + public Configuration( + IDictionary defaultHeader, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "http://petstore.swagger.io:80/v2") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeader == null) + throw new ArgumentNullException("defaultHeader"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeader) + { + DefaultHeader.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + /// + /// Initializes a new instance of the class with different settings /// /// Api client /// Dictionary of default HTTP header @@ -36,128 +170,223 @@ namespace IO.Swagger.Client /// DateTime format string /// HTTP connection timeout (in milliseconds) /// HTTP user agent - public Configuration(ApiClient apiClient = null, - Dictionary defaultHeader = null, - string username = null, - string password = null, - string accessToken = null, - Dictionary apiKey = null, - Dictionary apiKeyPrefix = null, - string tempFolderPath = null, - string dateTimeFormat = null, - int timeout = 100000, - string userAgent = "Swagger-Codegen/1.0.0/csharp" - ) + [Obsolete("Use explicit object construction and setting of properties.", true)] + public Configuration( + // ReSharper disable UnusedParameter.Local + ApiClient apiClient = null, + IDictionary defaultHeader = null, + string username = null, + string password = null, + string accessToken = null, + IDictionary apiKey = null, + IDictionary apiKeyPrefix = null, + string tempFolderPath = null, + string dateTimeFormat = null, + int timeout = 100000, + string userAgent = "Swagger-Codegen/1.0.0/csharp" + // ReSharper restore UnusedParameter.Local + ) { - setApiClientUsingDefault(apiClient); - Username = username; - Password = password; - AccessToken = accessToken; - UserAgent = userAgent; - - if (defaultHeader != null) - DefaultHeader = defaultHeader; - if (apiKey != null) - ApiKey = apiKey; - if (apiKeyPrefix != null) - ApiKeyPrefix = apiKeyPrefix; - - TempFolderPath = tempFolderPath; - DateTimeFormat = dateTimeFormat; - Timeout = TimeSpan.FromMilliseconds(timeout); } /// /// Initializes a new instance of the Configuration class. /// /// Api client. + [Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)] + // ReSharper disable once UnusedParameter.Local public Configuration(ApiClient apiClient) { - setApiClientUsingDefault(apiClient); + } - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "1.0.0"; + #endregion Constructors - /// - /// Gets or sets the default Configuration. - /// - /// Configuration. - public static Configuration Default = new Configuration(); + #region Properties + + private ApiClient _apiClient = null; /// - /// Default creation of exceptions for a given method name and response object + /// Gets an instance of an ApiClient for this configuration /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + public virtual ApiClient ApiClient { - int status = (int) response.StatusCode; - if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); - return null; - }; - - /// - /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. - /// - /// Timeout. - public TimeSpan? Timeout - { - get { return ApiClient.RestClient.Timeout; } - - set + get { - if (ApiClient != null) - ApiClient.RestClient.Timeout = value; + if (_apiClient == null) _apiClient = CreateApiClient(); + return _apiClient; } } + private String _basePath = null; /// - /// Gets or sets the default API client for making HTTP calls. + /// Gets or sets the base path for API access. /// - /// The API client. - public ApiClient ApiClient; - - /// - /// Set the ApiClient using Default or ApiClient instance. - /// - /// An instance of ApiClient. - /// - public void setApiClientUsingDefault (ApiClient apiClient = null) - { - if (apiClient == null) - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = new ApiClient(); - - ApiClient = Default != null ? Default.ApiClient : new ApiClient(); - } - else - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = apiClient; - - ApiClient = apiClient; + public virtual string BasePath { + get { return _basePath; } + set { + _basePath = value; + // pass-through to ApiClient if it's set. + if(_apiClient != null) { + _apiClient.RestClient.BaseUrl = new Uri(_basePath); + } } } - private Dictionary _defaultHeaderMap = new Dictionary(); - /// /// Gets or sets the default header. /// - public Dictionary DefaultHeader + public virtual IDictionary DefaultHeader { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { - get { return _defaultHeaderMap; } + get { return (int)ApiClient.RestClient.Timeout.GetValueOrDefault(TimeSpan.FromSeconds(0)).TotalMilliseconds; } + set { ApiClient.RestClient.Timeout = TimeSpan.FromMilliseconds(value); } + } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix (string apiKeyIdentifier) + { + var apiKeyValue = ""; + ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + var apiKeyPrefix = ""; + if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) + return apiKeyPrefix + " " + apiKeyValue; + else + return apiKeyValue; + } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } set { - _defaultHeaderMap = value; + if (string.IsNullOrEmpty(value)) + { + // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set. + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } } } + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + #endregion Properties + + #region Methods + /// /// Add default header. /// @@ -166,7 +395,30 @@ namespace IO.Swagger.Client /// public void AddDefaultHeader(string key, string value) { - _defaultHeaderMap[key] = value; + DefaultHeader[key] = value; + } + + /// + /// Creates a new based on this instance. + /// + /// + public ApiClient CreateApiClient() + { + return new ApiClient(BasePath) { Configuration = this }; + } + + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (IO.Swagger) Debug Report:\n"; + report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; } /// @@ -190,140 +442,6 @@ namespace IO.Swagger.Client ApiKeyPrefix[key] = value; } - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public String UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public String Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public String Password { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// The access token. - public String AccessToken { get; set; } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public Dictionary ApiKey = new Dictionary(); - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - public Dictionary ApiKeyPrefix = new Dictionary(); - - /// - /// Get the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix (string apiKeyIdentifier) - { - var apiKeyValue = ""; - ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); - var apiKeyPrefix = ""; - if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) - return apiKeyPrefix + " " + apiKeyValue; - else - return apiKeyValue; - } - - private string _tempFolderPath; - - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public String TempFolderPath - { - get - { - // default to Path.GetTempPath() if _tempFolderPath is not set - if (String.IsNullOrEmpty(_tempFolderPath)) - { - _tempFolderPath = Path.GetTempPath(); - } - return _tempFolderPath; - } - - set - { - if (String.IsNullOrEmpty(value)) - { - _tempFolderPath = value; - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - Directory.CreateDirectory(value); - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - _tempFolderPath = value; - else - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - - private const string ISO8601_DATETIME_FORMAT = "o"; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - - /// - /// Gets or sets the the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public String DateTimeFormat - { - get - { - return _dateTimeFormat; - } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Returns a string with essential information for debugging. - /// - public static String ToDebugReport() - { - String report = "C# SDK (IO.Swagger) Debug Report:\n"; - report += " OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription + "\n"; - report += " Version of the API: 1.0.0\n"; - report += " SDK Package Version: 1.0.0\n"; - - return report; - } + #endregion Methods } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/GlobalConfiguration.cs new file mode 100644 index 000000000000..d8b196fc3e8b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/GlobalConfiguration.cs @@ -0,0 +1,34 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; + +namespace IO.Swagger.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .swagger-codegen-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/IReadableConfiguration.cs new file mode 100644 index 000000000000..ed1b6eddeacf --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/IReadableConfiguration.cs @@ -0,0 +1,35 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System.Collections.Generic; + +namespace IO.Swagger.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + string AccessToken { get; } + IDictionary ApiKey { get; } + IDictionary ApiKeyPrefix { get; } + string BasePath { get; } + string DateTimeFormat { get; } + IDictionary DefaultHeader { get; } + string Password { get; } + string TempFolderPath { get; } + int Timeout { get; } + string UserAgent { get; } + string Username { get; } + + string GetApiKeyWithPrefix(string apiKeyIdentifier); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs index 9cedd3045da6..a44a589dc88d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs @@ -416,15 +416,9 @@ namespace IO.Swagger.Api /// public FakeApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -441,12 +435,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -495,9 +483,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs index a2ac952b00a7..72d9b04836b3 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs @@ -84,15 +84,9 @@ namespace IO.Swagger.Api /// public Fake_classname_tags123Api(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -109,12 +103,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -163,9 +151,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/PetApi.cs index 3d1f1ea9c608..6ebddb476f46 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/PetApi.cs @@ -398,15 +398,9 @@ namespace IO.Swagger.Api /// public PetApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -423,12 +417,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -477,9 +465,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/StoreApi.cs index 04cd66ef1172..1317209a857c 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/StoreApi.cs @@ -206,15 +206,9 @@ namespace IO.Swagger.Api /// public StoreApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -231,12 +225,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -285,9 +273,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/UserApi.cs index 81e0a6fb4c7f..8fe02dff0ec1 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/UserApi.cs @@ -382,15 +382,9 @@ namespace IO.Swagger.Api /// public UserApi(String basePath) { - this.Configuration = new Configuration(new ApiClient(basePath)); + this.Configuration = new Configuration { BasePath = basePath }; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -407,12 +401,6 @@ namespace IO.Swagger.Api this.Configuration = configuration; ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; - - // ensure API client has configuration ready - if (Configuration.ApiClient.Configuration == null) - { - this.Configuration.ApiClient.Configuration = this.Configuration; - } } /// @@ -461,9 +449,9 @@ namespace IO.Swagger.Api /// /// Dictionary of HTTP header [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] - public Dictionary DefaultHeader() + public IDictionary DefaultHeader() { - return this.Configuration.DefaultHeader; + return new ReadOnlyDictionary(this.Configuration.DefaultHeader); } /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/ApiClient.cs index 6531cc1a0261..32545398ce45 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/ApiClient.cs @@ -48,11 +48,11 @@ namespace IO.Swagger.Client /// /// Initializes a new instance of the class - /// with default configuration and base path (http://petstore.swagger.io:80/v2). + /// with default configuration. /// public ApiClient() { - Configuration = Configuration.Default; + Configuration = IO.Swagger.Client.Configuration.Default; RestClient = new RestClient("http://petstore.swagger.io:80/v2"); } @@ -61,14 +61,11 @@ namespace IO.Swagger.Client /// with default base path (http://petstore.swagger.io:80/v2). /// /// An instance of Configuration. - public ApiClient(Configuration config = null) + public ApiClient(Configuration config) { - if (config == null) - Configuration = Configuration.Default; - else - Configuration = config; + Configuration = config ?? IO.Swagger.Client.Configuration.Default; - RestClient = new RestClient("http://petstore.swagger.io:80/v2"); + RestClient = new RestClient(Configuration.BasePath); } /// @@ -82,7 +79,7 @@ namespace IO.Swagger.Client throw new ArgumentException("basePath cannot be empty"); RestClient = new RestClient(basePath); - Configuration = Configuration.Default; + Configuration = Client.Configuration.Default; } /// @@ -93,10 +90,15 @@ namespace IO.Swagger.Client public static ApiClient Default; /// - /// Gets or sets the Configuration. + /// Gets or sets an instance of the IReadableConfiguration. /// - /// An instance of the Configuration. - public Configuration Configuration { get; set; } + /// An instance of the IReadableConfiguration. + /// + /// helps us to avoid modifying possibly global + /// configuration values from within a given client. It does not gaurantee thread-safety + /// of the instance in any way. + /// + public IReadableConfiguration Configuration { get; set; } /// /// Gets or sets the RestClient. @@ -174,6 +176,7 @@ namespace IO.Swagger.Client pathParams, contentType); // set timeout + RestClient.Timeout = Configuration.Timeout; // set user agent RestClient.UserAgent = Configuration.UserAgent; @@ -286,6 +289,7 @@ namespace IO.Swagger.Client return response.RawBytes; } + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) if (type == typeof(Stream)) { if (headers != null) diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/Configuration.cs index fce50ae0b743..1e1e12c35229 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/Configuration.cs @@ -10,6 +10,7 @@ using System; using System.Reflection; +using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -20,10 +21,147 @@ namespace IO.Swagger.Client /// /// Represents a set of configuration settings /// - public class Configuration + public class Configuration : IReadableConfiguration { + #region Constants + /// - /// Initializes a new instance of the Configuration class with different settings + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + private static readonly object GlobalConfigSync = new { }; + private static Configuration _globalConfiguration; + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.Content), + response.Content); + } + if (status == 0) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); + } + return null; + }; + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static Configuration Default + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + + #endregion Static Members + + #region Private Members + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + private IDictionary _apiKey = null; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix = null; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + #endregion Private Members + + #region Constructors + + static Configuration() + { + _globalConfiguration = new GlobalConfiguration(); + } + + /// + /// Initializes a new instance of the class + /// + public Configuration() + { + UserAgent = "Swagger-Codegen/1.0.0/csharp"; + BasePath = "http://petstore.swagger.io:80/v2"; + DefaultHeader = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + public Configuration( + IDictionary defaultHeader, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "http://petstore.swagger.io:80/v2") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeader == null) + throw new ArgumentNullException("defaultHeader"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeader) + { + DefaultHeader.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + /// + /// Initializes a new instance of the class with different settings /// /// Api client /// Dictionary of default HTTP header @@ -36,129 +174,224 @@ namespace IO.Swagger.Client /// DateTime format string /// HTTP connection timeout (in milliseconds) /// HTTP user agent - public Configuration(ApiClient apiClient = null, - Dictionary defaultHeader = null, - string username = null, - string password = null, - string accessToken = null, - Dictionary apiKey = null, - Dictionary apiKeyPrefix = null, - string tempFolderPath = null, - string dateTimeFormat = null, - int timeout = 100000, - string userAgent = "Swagger-Codegen/1.0.0/csharp" - ) + [Obsolete("Use explicit object construction and setting of properties.", true)] + public Configuration( + // ReSharper disable UnusedParameter.Local + ApiClient apiClient = null, + IDictionary defaultHeader = null, + string username = null, + string password = null, + string accessToken = null, + IDictionary apiKey = null, + IDictionary apiKeyPrefix = null, + string tempFolderPath = null, + string dateTimeFormat = null, + int timeout = 100000, + string userAgent = "Swagger-Codegen/1.0.0/csharp" + // ReSharper restore UnusedParameter.Local + ) { - setApiClientUsingDefault(apiClient); - Username = username; - Password = password; - AccessToken = accessToken; - UserAgent = userAgent; - - if (defaultHeader != null) - DefaultHeader = defaultHeader; - if (apiKey != null) - ApiKey = apiKey; - if (apiKeyPrefix != null) - ApiKeyPrefix = apiKeyPrefix; - - TempFolderPath = tempFolderPath; - DateTimeFormat = dateTimeFormat; - Timeout = timeout; } /// /// Initializes a new instance of the Configuration class. /// /// Api client. + [Obsolete("This constructor caused unexpected sharing of static data. It is no longer supported.", true)] + // ReSharper disable once UnusedParameter.Local public Configuration(ApiClient apiClient) { - setApiClientUsingDefault(apiClient); + } - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "1.0.0"; + #endregion Constructors - /// - /// Gets or sets the default Configuration. - /// - /// Configuration. - public static Configuration Default = new Configuration(); + #region Properties + + private ApiClient _apiClient = null; /// - /// Default creation of exceptions for a given method name and response object + /// Gets an instance of an ApiClient for this configuration /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + public virtual ApiClient ApiClient { - int status = (int) response.StatusCode; - if (status >= 400) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.Content), response.Content); - if (status == 0) return new ApiException(status, String.Format("Error calling {0}: {1}", methodName, response.ErrorMessage), response.ErrorMessage); - return null; - }; - - /// - /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. - /// - /// Timeout. - public int Timeout - { - get { return ApiClient.RestClient.Timeout; } - - set + get { - if (ApiClient != null) - ApiClient.RestClient.Timeout = value; + if (_apiClient == null) _apiClient = CreateApiClient(); + return _apiClient; } } + private String _basePath = null; /// - /// Gets or sets the default API client for making HTTP calls. + /// Gets or sets the base path for API access. /// - /// The API client. - public ApiClient ApiClient; - - /// - /// Set the ApiClient using Default or ApiClient instance. - /// - /// An instance of ApiClient. - /// - public void setApiClientUsingDefault (ApiClient apiClient = null) - { - if (apiClient == null) - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = new ApiClient(); - - ApiClient = Default != null ? Default.ApiClient : new ApiClient(); - } - else - { - if (Default != null && Default.ApiClient == null) - Default.ApiClient = apiClient; - - ApiClient = apiClient; + public virtual string BasePath { + get { return _basePath; } + set { + _basePath = value; + // pass-through to ApiClient if it's set. + if(_apiClient != null) { + _apiClient.RestClient.BaseUrl = new Uri(_basePath); + } } } - private Dictionary _defaultHeaderMap = new Dictionary(); - /// /// Gets or sets the default header. /// - public Dictionary DefaultHeader + public virtual IDictionary DefaultHeader { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { - get { return _defaultHeaderMap; } + + get { return ApiClient.RestClient.Timeout; } + set { ApiClient.RestClient.Timeout = value; } + } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public virtual string Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public virtual string Password { get; set; } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix (string apiKeyIdentifier) + { + var apiKeyValue = ""; + ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + var apiKeyPrefix = ""; + if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) + return apiKeyPrefix + " " + apiKeyValue; + else + return apiKeyValue; + } + + /// + /// Gets or sets the access token for OAuth2 authentication. + /// + /// The access token. + public virtual string AccessToken { get; set; } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } set { - _defaultHeaderMap = value; + if (string.IsNullOrEmpty(value)) + { + // Possible breaking change since swagger-codegen 2.2.1, enforce a valid temporary path on set. + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } } } + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + #endregion Properties + + #region Methods + /// /// Add default header. /// @@ -167,7 +400,31 @@ namespace IO.Swagger.Client /// public void AddDefaultHeader(string key, string value) { - _defaultHeaderMap[key] = value; + DefaultHeader[key] = value; + } + + /// + /// Creates a new based on this instance. + /// + /// + public ApiClient CreateApiClient() + { + return new ApiClient(BasePath) { Configuration = this }; + } + + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (IO.Swagger) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; } /// @@ -191,144 +448,6 @@ namespace IO.Swagger.Client ApiKeyPrefix[key] = value; } - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public String UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public String Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public String Password { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// The access token. - public String AccessToken { get; set; } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public Dictionary ApiKey = new Dictionary(); - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - public Dictionary ApiKeyPrefix = new Dictionary(); - - /// - /// Get the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix (string apiKeyIdentifier) - { - var apiKeyValue = ""; - ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); - var apiKeyPrefix = ""; - if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) - return apiKeyPrefix + " " + apiKeyValue; - else - return apiKeyValue; - } - - private string _tempFolderPath; - - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public String TempFolderPath - { - get - { - // default to Path.GetTempPath() if _tempFolderPath is not set - if (String.IsNullOrEmpty(_tempFolderPath)) - { - _tempFolderPath = Path.GetTempPath(); - } - return _tempFolderPath; - } - - set - { - if (String.IsNullOrEmpty(value)) - { - _tempFolderPath = value; - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - Directory.CreateDirectory(value); - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - _tempFolderPath = value; - else - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - - private const string ISO8601_DATETIME_FORMAT = "o"; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - - /// - /// Gets or sets the the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public String DateTimeFormat - { - get - { - return _dateTimeFormat; - } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Returns a string with essential information for debugging. - /// - public static String ToDebugReport() - { - String report = "C# SDK (IO.Swagger) Debug Report:\n"; - report += " OS: " + Environment.OSVersion + "\n"; - report += " .NET Framework Version: " + Assembly - .GetExecutingAssembly() - .GetReferencedAssemblies() - .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n"; - report += " Version of the API: 1.0.0\n"; - report += " SDK Package Version: 1.0.0\n"; - - return report; - } + #endregion Methods } } diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/GlobalConfiguration.cs new file mode 100644 index 000000000000..d8b196fc3e8b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/GlobalConfiguration.cs @@ -0,0 +1,34 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; + +namespace IO.Swagger.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .swagger-codegen-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/IReadableConfiguration.cs new file mode 100644 index 000000000000..ed1b6eddeacf --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Client/IReadableConfiguration.cs @@ -0,0 +1,35 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using System.Collections.Generic; + +namespace IO.Swagger.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + string AccessToken { get; } + IDictionary ApiKey { get; } + IDictionary ApiKeyPrefix { get; } + string BasePath { get; } + string DateTimeFormat { get; } + IDictionary DefaultHeader { get; } + string Password { get; } + string TempFolderPath { get; } + int Timeout { get; } + string UserAgent { get; } + string Username { get; } + + string GetApiKeyWithPrefix(string apiKeyIdentifier); + } +} \ No newline at end of file