mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 16:03:43 +00:00
fix testing respone (#21687)
This commit is contained in:
parent
31060931b6
commit
302590a215
@ -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}}
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -969,6 +1028,207 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -969,6 +1028,207 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -969,6 +1028,207 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -969,6 +1028,207 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -971,6 +1030,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,6 +100,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>?></returns>
|
||||
Task<IHelloApiResponse?> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>?></returns>
|
||||
Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -179,6 +200,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string?>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -268,6 +307,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs>? OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs>? OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -973,6 +1032,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string? Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -971,6 +1030,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,6 +100,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>?></returns>
|
||||
Task<IHelloApiResponse?> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>?></returns>
|
||||
Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -179,6 +200,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string?>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -268,6 +307,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs>? OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs>? OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -973,6 +1032,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string? Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -971,6 +1030,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,6 +100,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>?></returns>
|
||||
Task<IHelloApiResponse?> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>?></returns>
|
||||
Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -179,6 +200,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string?>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -268,6 +307,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs>? OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs>? OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -973,6 +1032,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string? Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -98,6 +98,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -177,6 +198,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -266,6 +305,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -971,6 +1030,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,6 +100,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>?></returns>
|
||||
Task<IHelloApiResponse?> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>?></returns>
|
||||
Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -179,6 +200,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string?>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -268,6 +307,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs>? OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs>? OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -973,6 +1032,208 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse?> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string? Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -82,6 +82,15 @@ namespace Org.OpenAPITools.Test.Api
|
||||
Assert.IsType<List<Guid>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RedirectOrDefault
|
||||
/// </summary>
|
||||
[Fact (Skip = "not implemented")]
|
||||
public async Task RedirectOrDefaultAsyncTest()
|
||||
{
|
||||
await _instance.RedirectOrDefaultAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test RolesReportGet
|
||||
/// </summary>
|
||||
@ -90,7 +99,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
{
|
||||
var response = await _instance.RolesReportGetAsync();
|
||||
var model = response.Ok();
|
||||
Assert.IsType<List<List<RolesReportsHash>>>(model);
|
||||
Assert.IsType<List<List>>(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -97,6 +97,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// <returns><see cref="Task"/><<see cref="IHelloApiResponse"/>></returns>
|
||||
Task<IHelloApiResponse> HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@ -176,6 +197,24 @@ namespace Org.OpenAPITools.Api
|
||||
bool IsOk { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public interface IRedirectOrDefaultApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsMovedPermanently { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool IsDefault { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="IRolesReportGetApiResponse"/>
|
||||
/// </summary>
|
||||
@ -265,6 +304,26 @@ namespace Org.OpenAPITools.Api
|
||||
OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
public event EventHandler<ApiResponseEventArgs> OnRedirectOrDefault;
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after an error querying the server
|
||||
/// </summary>
|
||||
public event EventHandler<ExceptionEventArgs> OnErrorRedirectOrDefault;
|
||||
|
||||
internal void ExecuteOnRedirectOrDefault(DefaultApi.RedirectOrDefaultApiResponse apiResponse)
|
||||
{
|
||||
OnRedirectOrDefault?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||
}
|
||||
|
||||
internal void ExecuteOnErrorRedirectOrDefault(Exception exception)
|
||||
{
|
||||
OnErrorRedirectOrDefault?.Invoke(this, new ExceptionEventArgs(exception));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The event raised after the server response
|
||||
/// </summary>
|
||||
@ -968,6 +1027,207 @@ namespace Org.OpenAPITools.Api
|
||||
partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLog"></param>
|
||||
/// <param name="apiResponseLocalVar"></param>
|
||||
partial void AfterRedirectOrDefault(ref bool suppressDefaultLog, IRedirectOrDefaultApiResponse apiResponseLocalVar);
|
||||
|
||||
/// <summary>
|
||||
/// Logs exceptions that occur while retrieving the server response
|
||||
/// </summary>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A partial method that gives developers a way to provide customized exception handling
|
||||
/// </summary>
|
||||
/// <param name="suppressDefaultLogLocalVar"></param>
|
||||
/// <param name="exceptionLocalVar"></param>
|
||||
/// <param name="pathFormatLocalVar"></param>
|
||||
/// <param name="pathLocalVar"></param>
|
||||
partial void OnErrorRedirectOrDefault(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> RedirectOrDefaultOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await RedirectOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns><see cref="Task"/><<see cref="IRedirectOrDefaultApiResponse"/>></returns>
|
||||
public async Task<IRedirectOrDefaultApiResponse> 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<RedirectOrDefaultApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<RedirectOrDefaultApiResponse>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
public partial class RedirectOrDefaultApiResponse : Org.OpenAPITools.Client.ApiResponse, IRedirectOrDefaultApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
public ILogger<RedirectOrDefaultApiResponse> Logger { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="RedirectOrDefaultApiResponse"/>
|
||||
/// </summary>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="httpRequestMessage"></param>
|
||||
/// <param name="httpResponseMessage"></param>
|
||||
/// <param name="rawContent"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="requestedAt"></param>
|
||||
/// <param name="jsonSerializerOptions"></param>
|
||||
public RedirectOrDefaultApiResponse(ILogger<RedirectOrDefaultApiResponse> 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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 301 MovedPermanently
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsMovedPermanently => 301 == (int)StatusCode;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is the default response type
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsDefault => !IsMovedPermanently;
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes the response if the response is 0 Default
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Default()
|
||||
{
|
||||
// This logic may be modified with the AsModel.mustache template
|
||||
return IsDefault
|
||||
? System.Text.Json.JsonSerializer.Deserialize<string>(RawContent, _jsonSerializerOptions)
|
||||
: default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the response is 0 Default and the deserialized response is not null
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the server response
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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<string> 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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -84,6 +84,22 @@ namespace Org.OpenAPITools.Api
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
string RedirectOrDefault();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> RedirectOrDefaultWithHttpInfo();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>List<List<RolesReportsHash>></returns>
|
||||
List<List<RolesReportsHash>> RolesReportGet();
|
||||
|
||||
@ -194,6 +210,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of List<List<RolesReportsHash>></returns>
|
||||
System.Threading.Tasks.Task<List<List<RolesReportsHash>>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
@ -756,6 +793,107 @@ namespace Org.OpenAPITools.Api
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
public string RedirectOrDefault()
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = RedirectOrDefaultWithHttpInfo();
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
public Org.OpenAPITools.Client.ApiResponse<string> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null) throw _exception;
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
public async System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(cancellationToken).ConfigureAwait(false);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null) throw _exception;
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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<string> 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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -84,6 +84,22 @@ namespace Org.OpenAPITools.Api
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
string RedirectOrDefault();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> RedirectOrDefaultWithHttpInfo();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>List<List<RolesReportsHash>></returns>
|
||||
List<List<RolesReportsHash>> RolesReportGet();
|
||||
|
||||
@ -194,6 +210,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of List<List<RolesReportsHash>></returns>
|
||||
System.Threading.Tasks.Task<List<List<RolesReportsHash>>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
@ -756,6 +793,107 @@ namespace Org.OpenAPITools.Api
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
public string RedirectOrDefault()
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = RedirectOrDefaultWithHttpInfo();
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
public Org.OpenAPITools.Client.ApiResponse<string> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null) throw _exception;
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
public async System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(cancellationToken).ConfigureAwait(false);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null) throw _exception;
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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<string> 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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -91,6 +91,24 @@ namespace Org.OpenAPITools.Api
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>string</returns>
|
||||
string RedirectOrDefault(int operationIndex = 0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> RedirectOrDefaultWithHttpInfo(int operationIndex = 0);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>List<List<RolesReportsHash>></returns>
|
||||
List<List<RolesReportsHash>> RolesReportGet(int operationIndex = 0);
|
||||
|
||||
@ -211,6 +229,29 @@ namespace Org.OpenAPITools.Api
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> RedirectOrDefaultWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of List<List<RolesReportsHash>></returns>
|
||||
System.Threading.Tasks.Task<List<List<RolesReportsHash>>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
@ -765,6 +806,133 @@ namespace Org.OpenAPITools.Api
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>string</returns>
|
||||
public string RedirectOrDefault(int operationIndex = 0)
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = RedirectOrDefaultWithHttpInfo();
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
public Org.OpenAPITools.Client.ApiResponse<string> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration);
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
public async System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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<string> 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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -91,6 +91,24 @@ namespace Org.OpenAPITools.Api
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>string</returns>
|
||||
string RedirectOrDefault(int operationIndex = 0);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> RedirectOrDefaultWithHttpInfo(int operationIndex = 0);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>List<List<RolesReportsHash>></returns>
|
||||
List<List<RolesReportsHash>> RolesReportGet(int operationIndex = 0);
|
||||
|
||||
@ -211,6 +229,29 @@ namespace Org.OpenAPITools.Api
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> RedirectOrDefaultWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of List<List<RolesReportsHash>></returns>
|
||||
System.Threading.Tasks.Task<List<List<RolesReportsHash>>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
@ -765,6 +806,133 @@ namespace Org.OpenAPITools.Api
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>string</returns>
|
||||
public string RedirectOrDefault(int operationIndex = 0)
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = RedirectOrDefaultWithHttpInfo();
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
public Org.OpenAPITools.Client.ApiResponse<string> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration);
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
public async System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await RedirectOrDefaultWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false);
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="operationIndex">Index associated with the operation.</param>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
}
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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<string> 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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -83,6 +83,22 @@ namespace Org.OpenAPITools.Api
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
string RedirectOrDefault();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> RedirectOrDefaultWithHttpInfo();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>List<List<RolesReportsHash>></returns>
|
||||
List<List<RolesReportsHash>> RolesReportGet();
|
||||
|
||||
@ -193,6 +209,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of List<List<RolesReportsHash>></returns>
|
||||
System.Threading.Tasks.Task<List<List<RolesReportsHash>>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
@ -719,6 +756,118 @@ namespace Org.OpenAPITools.Api
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
public string RedirectOrDefault()
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = RedirectOrDefaultWithHttpInfo();
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
public Org.OpenAPITools.Client.ApiResponse<string> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null) throw _exception;
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
public async System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
var task = RedirectOrDefaultWithHttpInfoAsync(cancellationToken);
|
||||
#if UNITY_EDITOR || !UNITY_WEBGL
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await task.ConfigureAwait(false);
|
||||
#else
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await task;
|
||||
#endif
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> 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<string>("/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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
<a id="redirectordefault"></a>
|
||||
# **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<string> 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)
|
||||
|
||||
<a id="rolesreportget"></a>
|
||||
# **RolesReportGet**
|
||||
> List<List<RolesReportsHash>> RolesReportGet ()
|
||||
|
@ -83,6 +83,22 @@ namespace Org.OpenAPITools.Api
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
string RedirectOrDefault();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
ApiResponse<string> RedirectOrDefaultWithHttpInfo();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>List<List<RolesReportsHash>></returns>
|
||||
List<List<RolesReportsHash>> RolesReportGet();
|
||||
|
||||
@ -193,6 +209,27 @@ namespace Org.OpenAPITools.Api
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
System.Threading.Tasks.Task<ApiResponse<string>> RedirectOrDefaultWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of List<List<RolesReportsHash>></returns>
|
||||
System.Threading.Tasks.Task<List<List<RolesReportsHash>>> RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default);
|
||||
|
||||
@ -719,6 +756,118 @@ namespace Org.OpenAPITools.Api
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>string</returns>
|
||||
public string RedirectOrDefault()
|
||||
{
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = RedirectOrDefaultWithHttpInfo();
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <returns>ApiResponse of string</returns>
|
||||
public Org.OpenAPITools.Client.ApiResponse<string> 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<string>("/redirectOrDefault", localVarRequestOptions, this.Configuration);
|
||||
|
||||
if (this.ExceptionFactory != null)
|
||||
{
|
||||
Exception _exception = this.ExceptionFactory("RedirectOrDefault", localVarResponse);
|
||||
if (_exception != null) throw _exception;
|
||||
}
|
||||
|
||||
return localVarResponse;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of string</returns>
|
||||
public async System.Threading.Tasks.Task<string> RedirectOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default)
|
||||
{
|
||||
var task = RedirectOrDefaultWithHttpInfoAsync(cancellationToken);
|
||||
#if UNITY_EDITOR || !UNITY_WEBGL
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await task.ConfigureAwait(false);
|
||||
#else
|
||||
Org.OpenAPITools.Client.ApiResponse<string> localVarResponse = await task;
|
||||
#endif
|
||||
return localVarResponse.Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
|
||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||
/// <returns>Task of ApiResponse (string)</returns>
|
||||
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<string>> 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<string>("/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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user