diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache
index 330b4cc8f800..32eb2b769f31 100644
--- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache
+++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache
@@ -37,14 +37,18 @@ namespace {{packageName}}.Test.{{apiPackage}}
{{#allParams}}
{{^required}}Client.Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}} = default{{nrt!}};
{{/allParams}}
- {{#returnType}}
+ {{#responses}}
+ {{#-first}}
+ {{#dataType}}
var response = await _instance.{{operationId}}Async({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
- var model = response.{{#lambda.first}}{{#responses}}{{vendorExtensions.x-http-status}} {{/responses}}{{/lambda.first}}();
+ var model = response.{{vendorExtensions.x-http-status}}();
Assert.IsType<{{{.}}}>(model);
- {{/returnType}}
- {{^returnType}}
+ {{/dataType}}
+ {{^dataType}}
await _instance.{{operationId}}Async({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
- {{/returnType}}
+ {{/dataType}}
+ {{/-first}}
+ {{/responses}}
}
{{/operation}}
{{/operations}}
diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
index d4a570cdb157..6e1648d8ccad 100644
--- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
@@ -612,6 +612,19 @@ paths:
- api_key_query: []
requestBody:
$ref: '#/components/requestBodies/Client'
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ '301':
+ description: redirect
+ # response that does not provide any content
+ default:
+ description: default
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Bar'
/fake:
patch:
tags:
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml
index 3afd9359ab7d..0ed7bc2cfd43 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml
@@ -639,6 +639,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
index d58c2e585a05..755860d2565e 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -969,6 +1028,207 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new RedirectOrDefaultApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault(out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index d58c2e585a05..755860d2565e 100644
--- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -969,6 +1028,207 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new RedirectOrDefaultApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault(out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml
index 3afd9359ab7d..0ed7bc2cfd43 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml
@@ -639,6 +639,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
index d58c2e585a05..755860d2565e 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -969,6 +1028,207 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new RedirectOrDefaultApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault(out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index d58c2e585a05..755860d2565e 100644
--- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -969,6 +1028,207 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new RedirectOrDefaultApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault(out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
index 3afd9359ab7d..0ed7bc2cfd43 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml
@@ -639,6 +639,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
index b26e51c70f3b..5e3e95be15d5 100644
--- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -971,6 +1030,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 3e6e9af57c4e..d7d20bf00f27 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs
index 545c65127912..57f363756f2e 100644
--- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -100,6 +100,27 @@ public interface IDefaultApi : IApi
/// <?>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <?>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -179,6 +200,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -268,6 +307,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler? OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler? OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -973,6 +1032,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string? Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string? result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index b26e51c70f3b..5e3e95be15d5 100644
--- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -971,6 +1030,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 3e6e9af57c4e..d7d20bf00f27 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs
index 545c65127912..57f363756f2e 100644
--- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -100,6 +100,27 @@ public interface IDefaultApi : IApi
/// <?>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <?>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -179,6 +200,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -268,6 +307,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler? OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler? OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -973,6 +1032,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string? Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string? result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
index 3afd9359ab7d..0ed7bc2cfd43 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml
@@ -639,6 +639,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
index b26e51c70f3b..5e3e95be15d5 100644
--- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -971,6 +1030,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 3e6e9af57c4e..d7d20bf00f27 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs
index 545c65127912..57f363756f2e 100644
--- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -100,6 +100,27 @@ public interface IDefaultApi : IApi
/// <?>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <?>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -179,6 +200,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -268,6 +307,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler? OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler? OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -973,6 +1032,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string? Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string? result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index b26e51c70f3b..5e3e95be15d5 100644
--- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -98,6 +98,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -177,6 +198,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -266,6 +305,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -971,6 +1030,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 3e6e9af57c4e..d7d20bf00f27 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs
index 545c65127912..57f363756f2e 100644
--- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -100,6 +100,27 @@ public interface IDefaultApi : IApi
/// <?>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <?>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -179,6 +200,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -268,6 +307,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler? OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler? OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -973,6 +1032,208 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+
+ httpRequestMessageLocalVar.Method = HttpMethod.Get;
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string? Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : null;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault([NotNullWhen(true)]out string? result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/DefaultApi.md
index e97541b8b6a5..7f42903b91d1 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/DefaultApi.md
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -106,6 +107,37 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
index 88cf05ba9ed8..9234433a2864 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs
@@ -82,6 +82,15 @@ public async Task HelloAsyncTest()
Assert.IsType>(model);
}
+ ///
+ /// Test RedirectOrDefault
+ ///
+ [Fact (Skip = "not implemented")]
+ public async Task RedirectOrDefaultAsyncTest()
+ {
+ await _instance.RedirectOrDefaultAsync();
+ }
+
///
/// Test RolesReportGet
///
@@ -90,7 +99,7 @@ public async Task RolesReportGetAsyncTest()
{
var response = await _instance.RolesReportGetAsync();
var model = response.Ok();
- Assert.IsType>>(model);
+ Assert.IsType>(model);
}
///
diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index 44e664fb69b7..0ce906cd0d49 100644
--- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -97,6 +97,27 @@ public interface IDefaultApi : IApi
/// <>
Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
///
///
///
@@ -176,6 +197,24 @@ public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk
+ /// The
+ ///
+ public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault
+ {
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ bool IsMovedPermanently { get; }
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ bool IsDefault { get; }
+ }
+
///
/// The
///
@@ -265,6 +304,26 @@ internal void ExecuteOnErrorHello(Exception exception)
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
}
+ ///
+ /// The event raised after the server response
+ ///
+ public event EventHandler OnRedirectOrDefault;
+
+ ///
+ /// The event raised after an error querying the server
+ ///
+ public event EventHandler OnErrorRedirectOrDefault;
+
+ internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
+ {
+ OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
+ }
+
+ internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
+ {
+ OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
+ }
+
///
/// The event raised after the server response
///
@@ -968,6 +1027,207 @@ private void OnDeserializationErrorDefaultImplementation(Exception exception, Ht
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
}
+ ///
+ /// Processes the server response
+ ///
+ ///
+ private void AfterRedirectOrDefaultDefaultImplementation(IRedirectOrDefaultApiResponse apiResponseLocalVar)
+ {
+ bool suppressDefaultLog = false;
+ AfterRedirectOrDefault(ref suppressDefaultLog, apiResponseLocalVar);
+ if (!suppressDefaultLog)
+ Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
+ }
+
+ ///
+ /// Processes the server response
+ ///
+ ///
+ ///
+ partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
+
+ ///
+ /// Logs exceptions that occur while retrieving the server response
+ ///
+ ///
+ ///
+ ///
+ private void OnErrorRedirectOrDefaultDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar)
+ {
+ bool suppressDefaultLogLocalVar = false;
+ OnErrorRedirectOrDefault(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar);
+ if (!suppressDefaultLogLocalVar)
+ Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
+ }
+
+ ///
+ /// A partial method that gives developers a way to provide customized exception handling
+ ///
+ ///
+ ///
+ ///
+ ///
+ partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
+
+ ///
+ ///
+ ///
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ try
+ {
+ return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
+ }
+ catch (Exception)
+ {
+ return null;
+ }
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// <>
+ public async Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ UriBuilder uriBuilderLocalVar = new UriBuilder();
+
+ try
+ {
+ using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
+ {
+ uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host;
+ uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port;
+ uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme;
+ uriBuilderLocalVar.Path = HttpClient.BaseAddress.AbsolutePath == "/"
+ ? "/redirectOrDefault"
+ : string.Concat(HttpClient.BaseAddress.AbsolutePath, "/redirectOrDefault");
+
+ httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri;
+
+ string[] acceptLocalVars = new string[] {
+ "application/json"
+ };
+
+ string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars);
+
+ if (acceptLocalVar != null)
+ httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar));
+ httpRequestMessageLocalVar.Method = new HttpMethod("GET");
+
+ DateTime requestedAtLocalVar = DateTime.UtcNow;
+
+ using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false))
+ {
+ string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false);
+
+ ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger();
+
+ RedirectOrDefaultApiResponse apiResponseLocalVar = new RedirectOrDefaultApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/redirectOrDefault", requestedAtLocalVar, _jsonSerializerOptions);
+
+ AfterRedirectOrDefaultDefaultImplementation(apiResponseLocalVar);
+
+ Events.ExecuteOnRedirectOrDefault(apiResponseLocalVar);
+
+ return apiResponseLocalVar;
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ OnErrorRedirectOrDefaultDefaultImplementation(e, "/redirectOrDefault", uriBuilderLocalVar.Path);
+ Events.ExecuteOnErrorRedirectOrDefault(e);
+ throw;
+ }
+ }
+
+ ///
+ /// The
+ ///
+ public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
+ {
+ ///
+ /// The logger
+ ///
+ public ILogger Logger { get; }
+
+ ///
+ /// The
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public RedirectOrDefaultApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions)
+ {
+ Logger = logger;
+ OnCreated(httpRequestMessage, httpResponseMessage);
+ }
+
+ partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage);
+
+ ///
+ /// Returns true if the response is 301 MovedPermanently
+ ///
+ ///
+ public bool IsMovedPermanently => 301 == (int)StatusCode;
+
+ ///
+ /// Returns true if the response is the default response type
+ ///
+ ///
+ public bool IsDefault => !IsMovedPermanently;
+
+ ///
+ /// Deserializes the response if the response is 0 Default
+ ///
+ ///
+ public string Default()
+ {
+ // This logic may be modified with the AsModel.mustache template
+ return IsDefault
+ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions)
+ : default;
+ }
+
+ ///
+ /// Returns true if the response is 0 Default and the deserialized response is not null
+ ///
+ ///
+ ///
+ public bool TryDefault(out string result)
+ {
+ result = null;
+
+ try
+ {
+ result = Default();
+ } catch (Exception e)
+ {
+ OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0);
+ }
+
+ return result != null;
+ }
+
+ private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode)
+ {
+ bool suppressDefaultLog = false;
+ OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode);
+ if (!suppressDefaultLog)
+ Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode);
+ }
+
+ partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
+ }
+
///
/// Processes the server response
///
diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md b/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md
index 730cf84112de..322a7ddd39a2 100644
--- a/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md
+++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md
@@ -145,6 +145,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **GET** /foo |
*DefaultApi* | [**GetCountry**](docs/DefaultApi.md#getcountry) | **POST** /country |
*DefaultApi* | [**Hello**](docs/DefaultApi.md#hello) | **GET** /hello | Hello
+*DefaultApi* | [**RedirectOrDefault**](docs/DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault |
*DefaultApi* | [**RolesReportGet**](docs/DefaultApi.md#rolesreportget) | **GET** /roles/report |
*DefaultApi* | [**Test**](docs/DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements
*FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/DefaultApi.md b/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/DefaultApi.md
index 13db7cec8ee1..c791a17328c4 100644
--- a/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/DefaultApi.md
+++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -273,6 +274,93 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+### Example
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Net.Http;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Client;
+using Org.OpenAPITools.Model;
+
+namespace Example
+{
+ public class RedirectOrDefaultExample
+ {
+ public static void Main()
+ {
+ Configuration config = new Configuration();
+ config.BasePath = "http://petstore.swagger.io:80/v2";
+ // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
+ HttpClient httpClient = new HttpClient();
+ HttpClientHandler httpClientHandler = new HttpClientHandler();
+ var apiInstance = new DefaultApi(httpClient, config, httpClientHandler);
+
+ try
+ {
+ string result = apiInstance.RedirectOrDefault();
+ Debug.WriteLine(result);
+ }
+ catch (ApiException e)
+ {
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefault: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+ }
+ }
+ }
+}
+```
+
+#### Using the RedirectOrDefaultWithHttpInfo variant
+This returns an ApiResponse object which contains the response data, status code and headers.
+
+```csharp
+try
+{
+ ApiResponse response = apiInstance.RedirectOrDefaultWithHttpInfo();
+ Debug.Write("Status Code: " + response.StatusCode);
+ Debug.Write("Response Headers: " + response.Headers);
+ Debug.Write("Response Body: " + response.Data);
+}
+catch (ApiException e)
+{
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefaultWithHttpInfo: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index 00b6dcfecfea..9fc0e000a3f3 100644
--- a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -84,6 +84,22 @@ public interface IDefaultApiSync : IApiAccessor
///
///
/// Thrown when fails to make API call
+ /// string
+ string RedirectOrDefault();
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ ApiResponse RedirectOrDefaultWithHttpInfo();
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
/// List<List<RolesReportsHash>>
List> RolesReportGet();
@@ -194,6 +210,27 @@ public interface IDefaultApiAsync : IApiAccessor
///
/// Thrown when fails to make API call
/// Cancellation Token to cancel the request.
+ /// Task of string
+ System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
/// Task of List<List<RolesReportsHash>>
System.Threading.Tasks.Task>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
@@ -756,6 +793,107 @@ public async System.Threading.Tasks.Task> HelloAsync(System.Threading
return localVarResponse;
}
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// string
+ public string RedirectOrDefault()
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = RedirectOrDefaultWithHttpInfo();
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ public Org.OpenAPITools.Client.ApiResponse RedirectOrDefaultWithHttpInfo()
+ {
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+ var localVarResponse = this.Client.Get("/redirectOrDefault", localVarRequestOptions, this.Configuration);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null) throw _exception;
+ }
+
+ return localVarResponse;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of string
+ public async System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(cancellationToken).ConfigureAwait(false);
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ public async System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+
+ var localVarResponse = await this.AsynchronousClient.GetAsync("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null) throw _exception;
+ }
+
+ return localVarResponse;
+ }
+
///
///
///
diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md
index 392942e432bf..3974e57dfee4 100644
--- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md
+++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md
@@ -133,6 +133,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **GET** /foo |
*DefaultApi* | [**GetCountry**](docs/DefaultApi.md#getcountry) | **POST** /country |
*DefaultApi* | [**Hello**](docs/DefaultApi.md#hello) | **GET** /hello | Hello
+*DefaultApi* | [**RedirectOrDefault**](docs/DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault |
*DefaultApi* | [**RolesReportGet**](docs/DefaultApi.md#rolesreportget) | **GET** /roles/report |
*DefaultApi* | [**Test**](docs/DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements
*FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/DefaultApi.md b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/DefaultApi.md
index 13db7cec8ee1..c791a17328c4 100644
--- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/DefaultApi.md
+++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -273,6 +274,93 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+### Example
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Net.Http;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Client;
+using Org.OpenAPITools.Model;
+
+namespace Example
+{
+ public class RedirectOrDefaultExample
+ {
+ public static void Main()
+ {
+ Configuration config = new Configuration();
+ config.BasePath = "http://petstore.swagger.io:80/v2";
+ // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
+ HttpClient httpClient = new HttpClient();
+ HttpClientHandler httpClientHandler = new HttpClientHandler();
+ var apiInstance = new DefaultApi(httpClient, config, httpClientHandler);
+
+ try
+ {
+ string result = apiInstance.RedirectOrDefault();
+ Debug.WriteLine(result);
+ }
+ catch (ApiException e)
+ {
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefault: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+ }
+ }
+ }
+}
+```
+
+#### Using the RedirectOrDefaultWithHttpInfo variant
+This returns an ApiResponse object which contains the response data, status code and headers.
+
+```csharp
+try
+{
+ ApiResponse response = apiInstance.RedirectOrDefaultWithHttpInfo();
+ Debug.Write("Status Code: " + response.StatusCode);
+ Debug.Write("Response Headers: " + response.Headers);
+ Debug.Write("Response Body: " + response.Data);
+}
+catch (ApiException e)
+{
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefaultWithHttpInfo: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index 00b6dcfecfea..9fc0e000a3f3 100644
--- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -84,6 +84,22 @@ public interface IDefaultApiSync : IApiAccessor
///
///
/// Thrown when fails to make API call
+ /// string
+ string RedirectOrDefault();
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ ApiResponse RedirectOrDefaultWithHttpInfo();
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
/// List<List<RolesReportsHash>>
List> RolesReportGet();
@@ -194,6 +210,27 @@ public interface IDefaultApiAsync : IApiAccessor
///
/// Thrown when fails to make API call
/// Cancellation Token to cancel the request.
+ /// Task of string
+ System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
/// Task of List<List<RolesReportsHash>>
System.Threading.Tasks.Task>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
@@ -756,6 +793,107 @@ public async System.Threading.Tasks.Task> HelloAsync(System.Threading
return localVarResponse;
}
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// string
+ public string RedirectOrDefault()
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = RedirectOrDefaultWithHttpInfo();
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ public Org.OpenAPITools.Client.ApiResponse RedirectOrDefaultWithHttpInfo()
+ {
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+ var localVarResponse = this.Client.Get("/redirectOrDefault", localVarRequestOptions, this.Configuration);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null) throw _exception;
+ }
+
+ return localVarResponse;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of string
+ public async System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(cancellationToken).ConfigureAwait(false);
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ public async System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+
+ var localVarResponse = await this.AsynchronousClient.GetAsync("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null) throw _exception;
+ }
+
+ return localVarResponse;
+ }
+
///
///
///
diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md
index b29a1f02bc19..dac7869f82af 100644
--- a/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md
+++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md
@@ -120,6 +120,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **GET** /foo |
*DefaultApi* | [**GetCountry**](docs/DefaultApi.md#getcountry) | **POST** /country |
*DefaultApi* | [**Hello**](docs/DefaultApi.md#hello) | **GET** /hello | Hello
+*DefaultApi* | [**RedirectOrDefault**](docs/DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault |
*DefaultApi* | [**RolesReportGet**](docs/DefaultApi.md#rolesreportget) | **GET** /roles/report |
*DefaultApi* | [**Test**](docs/DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements
*FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DefaultApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DefaultApi.md
index d9d4abc6ebbc..ef2cf6ce0bcb 100644
--- a/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DefaultApi.md
+++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -261,6 +262,89 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+### Example
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Client;
+using Org.OpenAPITools.Model;
+
+namespace Example
+{
+ public class RedirectOrDefaultExample
+ {
+ public static void Main()
+ {
+ Configuration config = new Configuration();
+ config.BasePath = "http://petstore.swagger.io:80/v2";
+ var apiInstance = new DefaultApi(config);
+
+ try
+ {
+ string result = apiInstance.RedirectOrDefault();
+ Debug.WriteLine(result);
+ }
+ catch (ApiException e)
+ {
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefault: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+ }
+ }
+ }
+}
+```
+
+#### Using the RedirectOrDefaultWithHttpInfo variant
+This returns an ApiResponse object which contains the response data, status code and headers.
+
+```csharp
+try
+{
+ ApiResponse response = apiInstance.RedirectOrDefaultWithHttpInfo();
+ Debug.Write("Status Code: " + response.StatusCode);
+ Debug.Write("Response Headers: " + response.Headers);
+ Debug.Write("Response Body: " + response.Data);
+}
+catch (ApiException e)
+{
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefaultWithHttpInfo: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index 6446a8be8118..58a8a014f339 100644
--- a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -91,6 +91,24 @@ public interface IDefaultApiSync : IApiAccessor
///
/// Thrown when fails to make API call
/// Index associated with the operation.
+ /// string
+ string RedirectOrDefault(int operationIndex = 0);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// ApiResponse of string
+ ApiResponse RedirectOrDefaultWithHttpInfo(int operationIndex = 0);
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
/// List<List<RolesReportsHash>>
List> RolesReportGet(int operationIndex = 0);
@@ -211,6 +229,29 @@ public interface IDefaultApiAsync : IApiAccessor
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
+ /// Task of string
+ System.Threading.Tasks.Task RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
/// Task of List<List<RolesReportsHash>>
System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
@@ -765,6 +806,133 @@ public async System.Threading.Tasks.Task> HelloAsync(int operationInd
return localVarResponse;
}
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// string
+ public string RedirectOrDefault(int operationIndex = 0)
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = RedirectOrDefaultWithHttpInfo();
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// ApiResponse of string
+ public Org.OpenAPITools.Client.ApiResponse RedirectOrDefaultWithHttpInfo(int operationIndex = 0)
+ {
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ var localVarMultipartFormData = localVarContentType == "multipart/form-data";
+ if (localVarContentType != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+ }
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+ }
+
+
+ localVarRequestOptions.Operation = "DefaultApi.RedirectOrDefault";
+ localVarRequestOptions.OperationIndex = operationIndex;
+
+
+ // make the HTTP request
+ var localVarResponse = this.Client.Get("/redirectOrDefault", localVarRequestOptions, this.Configuration);
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null)
+ {
+ throw _exception;
+ }
+ }
+
+ return localVarResponse;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
+ /// Task of string
+ public async System.Threading.Tasks.Task RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default)
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ public async System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+ }
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+ }
+
+
+ localVarRequestOptions.Operation = "DefaultApi.RedirectOrDefault";
+ localVarRequestOptions.OperationIndex = operationIndex;
+
+
+ // make the HTTP request
+ var localVarResponse = await this.AsynchronousClient.GetAsync("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null)
+ {
+ throw _exception;
+ }
+ }
+
+ return localVarResponse;
+ }
+
///
///
///
diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md
index c42db0586c07..ca68f7ad0cbd 100644
--- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md
+++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md
@@ -108,6 +108,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**FooGet**](docs/DefaultApi.md#fooget) | **GET** /foo |
*DefaultApi* | [**GetCountry**](docs/DefaultApi.md#getcountry) | **POST** /country |
*DefaultApi* | [**Hello**](docs/DefaultApi.md#hello) | **GET** /hello | Hello
+*DefaultApi* | [**RedirectOrDefault**](docs/DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault |
*DefaultApi* | [**RolesReportGet**](docs/DefaultApi.md#rolesreportget) | **GET** /roles/report |
*DefaultApi* | [**Test**](docs/DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements
*FakeApi* | [**FakeHealthGet**](docs/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml
+++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/DefaultApi.md b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/DefaultApi.md
index d9d4abc6ebbc..ef2cf6ce0bcb 100644
--- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/DefaultApi.md
+++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -261,6 +262,89 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+### Example
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Client;
+using Org.OpenAPITools.Model;
+
+namespace Example
+{
+ public class RedirectOrDefaultExample
+ {
+ public static void Main()
+ {
+ Configuration config = new Configuration();
+ config.BasePath = "http://petstore.swagger.io:80/v2";
+ var apiInstance = new DefaultApi(config);
+
+ try
+ {
+ string result = apiInstance.RedirectOrDefault();
+ Debug.WriteLine(result);
+ }
+ catch (ApiException e)
+ {
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefault: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+ }
+ }
+ }
+}
+```
+
+#### Using the RedirectOrDefaultWithHttpInfo variant
+This returns an ApiResponse object which contains the response data, status code and headers.
+
+```csharp
+try
+{
+ ApiResponse response = apiInstance.RedirectOrDefaultWithHttpInfo();
+ Debug.Write("Status Code: " + response.StatusCode);
+ Debug.Write("Response Headers: " + response.Headers);
+ Debug.Write("Response Body: " + response.Data);
+}
+catch (ApiException e)
+{
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefaultWithHttpInfo: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs
index 6446a8be8118..58a8a014f339 100644
--- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -91,6 +91,24 @@ public interface IDefaultApiSync : IApiAccessor
///
/// Thrown when fails to make API call
/// Index associated with the operation.
+ /// string
+ string RedirectOrDefault(int operationIndex = 0);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// ApiResponse of string
+ ApiResponse RedirectOrDefaultWithHttpInfo(int operationIndex = 0);
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
/// List<List<RolesReportsHash>>
List> RolesReportGet(int operationIndex = 0);
@@ -211,6 +229,29 @@ public interface IDefaultApiAsync : IApiAccessor
/// Thrown when fails to make API call
/// Index associated with the operation.
/// Cancellation Token to cancel the request.
+ /// Task of string
+ System.Threading.Tasks.Task RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
/// Task of List<List<RolesReportsHash>>
System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
@@ -765,6 +806,133 @@ public async System.Threading.Tasks.Task> HelloAsync(int operationInd
return localVarResponse;
}
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// string
+ public string RedirectOrDefault(int operationIndex = 0)
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = RedirectOrDefaultWithHttpInfo();
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// ApiResponse of string
+ public Org.OpenAPITools.Client.ApiResponse RedirectOrDefaultWithHttpInfo(int operationIndex = 0)
+ {
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ var localVarMultipartFormData = localVarContentType == "multipart/form-data";
+ if (localVarContentType != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+ }
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+ }
+
+
+ localVarRequestOptions.Operation = "DefaultApi.RedirectOrDefault";
+ localVarRequestOptions.OperationIndex = operationIndex;
+
+
+ // make the HTTP request
+ var localVarResponse = this.Client.Get("/redirectOrDefault", localVarRequestOptions, this.Configuration);
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null)
+ {
+ throw _exception;
+ }
+ }
+
+ return localVarResponse;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
+ /// Task of string
+ public async System.Threading.Tasks.Task RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default)
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Index associated with the operation.
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ public async System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+ }
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null)
+ {
+ localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+ }
+
+
+ localVarRequestOptions.Operation = "DefaultApi.RedirectOrDefault";
+ localVarRequestOptions.OperationIndex = operationIndex;
+
+
+ // make the HTTP request
+ var localVarResponse = await this.AsynchronousClient.GetAsync("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null)
+ {
+ throw _exception;
+ }
+ }
+
+ return localVarResponse;
+ }
+
///
///
///
diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md
index d60c61eaf065..da582eff3b39 100644
--- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md
+++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md
@@ -94,6 +94,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**FooGet**](DefaultApi.md#fooget) | **GET** /foo |
*DefaultApi* | [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country |
*DefaultApi* | [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello
+*DefaultApi* | [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault |
*DefaultApi* | [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report |
*DefaultApi* | [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements
*FakeApi* | [**FakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/DefaultApi.md b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/DefaultApi.md
index d9d4abc6ebbc..ef2cf6ce0bcb 100644
--- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/DefaultApi.md
+++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -261,6 +262,89 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+### Example
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Client;
+using Org.OpenAPITools.Model;
+
+namespace Example
+{
+ public class RedirectOrDefaultExample
+ {
+ public static void Main()
+ {
+ Configuration config = new Configuration();
+ config.BasePath = "http://petstore.swagger.io:80/v2";
+ var apiInstance = new DefaultApi(config);
+
+ try
+ {
+ string result = apiInstance.RedirectOrDefault();
+ Debug.WriteLine(result);
+ }
+ catch (ApiException e)
+ {
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefault: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+ }
+ }
+ }
+}
+```
+
+#### Using the RedirectOrDefaultWithHttpInfo variant
+This returns an ApiResponse object which contains the response data, status code and headers.
+
+```csharp
+try
+{
+ ApiResponse response = apiInstance.RedirectOrDefaultWithHttpInfo();
+ Debug.Write("Status Code: " + response.StatusCode);
+ Debug.Write("Response Headers: " + response.Headers);
+ Debug.Write("Response Body: " + response.Data);
+}
+catch (ApiException e)
+{
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefaultWithHttpInfo: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index 7392e37d6bcb..0bc77ce0f856 100644
--- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -83,6 +83,22 @@ public interface IDefaultApiSync : IApiAccessor
///
///
/// Thrown when fails to make API call
+ /// string
+ string RedirectOrDefault();
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ ApiResponse RedirectOrDefaultWithHttpInfo();
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
/// List<List<RolesReportsHash>>
List> RolesReportGet();
@@ -193,6 +209,27 @@ public interface IDefaultApiAsync : IApiAccessor
///
/// Thrown when fails to make API call
/// Cancellation Token to cancel the request.
+ /// Task of string
+ System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
/// Task of List<List<RolesReportsHash>>
System.Threading.Tasks.Task>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
@@ -719,6 +756,118 @@ public async System.Threading.Tasks.Task> HelloAsync(System.Threading
return localVarResponse;
}
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// string
+ public string RedirectOrDefault()
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = RedirectOrDefaultWithHttpInfo();
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ public Org.OpenAPITools.Client.ApiResponse RedirectOrDefaultWithHttpInfo()
+ {
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+ var localVarResponse = this.Client.Get("/redirectOrDefault", localVarRequestOptions, this.Configuration);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null) throw _exception;
+ }
+
+ return localVarResponse;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of string
+ public async System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ var task = RedirectOrDefaultWithHttpInfoAsync(cancellationToken);
+#if UNITY_EDITOR || !UNITY_WEBGL
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await task.ConfigureAwait(false);
+#else
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await task;
+#endif
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ public async System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+
+ var task = this.AsynchronousClient.GetAsync("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken);
+
+#if UNITY_EDITOR || !UNITY_WEBGL
+ var localVarResponse = await task.ConfigureAwait(false);
+#else
+ var localVarResponse = await task;
+#endif
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null) throw _exception;
+ }
+
+ return localVarResponse;
+ }
+
///
///
///
diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md
index d60c61eaf065..da582eff3b39 100644
--- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md
+++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md
@@ -94,6 +94,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**FooGet**](DefaultApi.md#fooget) | **GET** /foo |
*DefaultApi* | [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country |
*DefaultApi* | [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello
+*DefaultApi* | [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault |
*DefaultApi* | [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report |
*DefaultApi* | [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements
*FakeApi* | [**FakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint
diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml
index d86a1d2f6d87..b75294f7fc09 100644
--- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml
+++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml
@@ -644,6 +644,18 @@ paths:
summary: To test class name in snake case
tags:
- fake_classname_tags 123#$%^
+ /redirectOrDefault:
+ get:
+ operationId: redirectOrDefault
+ responses:
+ "301":
+ description: redirect
+ default:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/Bar"
+ description: default
/fake:
delete:
description: Fake endpoint to test group parameters (optional)
diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/DefaultApi.md b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/DefaultApi.md
index d9d4abc6ebbc..ef2cf6ce0bcb 100644
--- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/DefaultApi.md
+++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/DefaultApi.md
@@ -7,6 +7,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | |
| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | |
| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello |
+| [**RedirectOrDefault**](DefaultApi.md#redirectordefault) | **GET** /redirectOrDefault | |
| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | |
| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements |
@@ -261,6 +262,89 @@ No authorization required
[[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)
+
+# **RedirectOrDefault**
+> string RedirectOrDefault ()
+
+
+
+### Example
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Client;
+using Org.OpenAPITools.Model;
+
+namespace Example
+{
+ public class RedirectOrDefaultExample
+ {
+ public static void Main()
+ {
+ Configuration config = new Configuration();
+ config.BasePath = "http://petstore.swagger.io:80/v2";
+ var apiInstance = new DefaultApi(config);
+
+ try
+ {
+ string result = apiInstance.RedirectOrDefault();
+ Debug.WriteLine(result);
+ }
+ catch (ApiException e)
+ {
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefault: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+ }
+ }
+ }
+}
+```
+
+#### Using the RedirectOrDefaultWithHttpInfo variant
+This returns an ApiResponse object which contains the response data, status code and headers.
+
+```csharp
+try
+{
+ ApiResponse response = apiInstance.RedirectOrDefaultWithHttpInfo();
+ Debug.Write("Status Code: " + response.StatusCode);
+ Debug.Write("Response Headers: " + response.Headers);
+ Debug.Write("Response Body: " + response.Data);
+}
+catch (ApiException e)
+{
+ Debug.Print("Exception when calling DefaultApi.RedirectOrDefaultWithHttpInfo: " + e.Message);
+ Debug.Print("Status Code: " + e.ErrorCode);
+ Debug.Print(e.StackTrace);
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+### Return type
+
+**string**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **301** | redirect | - |
+| **0** | default | - |
+
+[[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)
+
# **RolesReportGet**
> List<List<RolesReportsHash>> RolesReportGet ()
diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
index 7392e37d6bcb..0bc77ce0f856 100644
--- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
+++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -83,6 +83,22 @@ public interface IDefaultApiSync : IApiAccessor
///
///
/// Thrown when fails to make API call
+ /// string
+ string RedirectOrDefault();
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ ApiResponse RedirectOrDefaultWithHttpInfo();
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
/// List<List<RolesReportsHash>>
List> RolesReportGet();
@@ -193,6 +209,27 @@ public interface IDefaultApiAsync : IApiAccessor
///
/// Thrown when fails to make API call
/// Cancellation Token to cancel the request.
+ /// Task of string
+ System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
/// Task of List<List<RolesReportsHash>>
System.Threading.Tasks.Task>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
@@ -719,6 +756,118 @@ public async System.Threading.Tasks.Task> HelloAsync(System.Threading
return localVarResponse;
}
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// string
+ public string RedirectOrDefault()
+ {
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = RedirectOrDefaultWithHttpInfo();
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// ApiResponse of string
+ public Org.OpenAPITools.Client.ApiResponse RedirectOrDefaultWithHttpInfo()
+ {
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+ var localVarResponse = this.Client.Get("/redirectOrDefault", localVarRequestOptions, this.Configuration);
+
+ if (this.ExceptionFactory != null)
+ {
+ Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
+ if (_exception != null) throw _exception;
+ }
+
+ return localVarResponse;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of string
+ public async System.Threading.Tasks.Task RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+ var task = RedirectOrDefaultWithHttpInfoAsync(cancellationToken);
+#if UNITY_EDITOR || !UNITY_WEBGL
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await task.ConfigureAwait(false);
+#else
+ Org.OpenAPITools.Client.ApiResponse localVarResponse = await task;
+#endif
+ return localVarResponse.Data;
+ }
+
+ ///
+ ///
+ ///
+ /// Thrown when fails to make API call
+ /// Cancellation Token to cancel the request.
+ /// Task of ApiResponse (string)
+ public async System.Threading.Tasks.Task> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions();
+
+ string[] _contentTypes = new string[] {
+ };
+
+ // to determine the Accept header
+ string[] _accepts = new string[] {
+ "application/json"
+ };
+
+
+ var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
+ if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);
+
+ var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts);
+ if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);
+
+
+
+ // make the HTTP request
+
+ var task = this.AsynchronousClient.GetAsync