forked from loafle/openapi-generator-original
[csharp][generichost] Better handling of duplicate operation ids (#19913)
* fixed missing output * bug fix * add new sample * build samples again * delete sample * move the sample and add to github workflow * remove model not needed for this test * handle specs with no models * better handling of duplicate operation ids * fixed mistake in resolving conflicts * build samples again * revert a change sent in another pr
This commit is contained in:
parent
f98073d508
commit
54920ff106
@ -5701,8 +5701,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Map<String, Integer> seenOperationIds = new HashMap<String, Integer>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add operation to group
|
* Add operation to group
|
||||||
*
|
*
|
||||||
@ -5723,18 +5721,13 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
// check for operationId uniqueness
|
// check for operationId uniqueness
|
||||||
String uniqueName = co.operationId;
|
String uniqueName = co.operationId;
|
||||||
int counter = seenOperationIds.getOrDefault(uniqueName, 0);
|
int counter = 0;
|
||||||
while (seenOperationIds.containsKey(uniqueName)) {
|
|
||||||
uniqueName = co.operationId + "_" + counter;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
for (CodegenOperation op : opList) {
|
for (CodegenOperation op : opList) {
|
||||||
if (uniqueName.equals(op.operationId)) {
|
if (uniqueName.equals(op.operationId)) {
|
||||||
uniqueName = co.operationId + "_" + counter;
|
uniqueName = co.operationId + "_" + counter;
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seenOperationIds.put(co.operationId, counter);
|
|
||||||
if (!co.operationId.equals(uniqueName)) {
|
if (!co.operationId.equals(uniqueName)) {
|
||||||
LOGGER.warn("generated unique operationId `{}`", uniqueName);
|
LOGGER.warn("generated unique operationId `{}`", uniqueName);
|
||||||
}
|
}
|
||||||
|
@ -823,6 +823,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
|||||||
httpStatusesWithReturn.add(status);
|
httpStatusesWithReturn.add(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private HashMap<String, String> duplicateOf = new HashMap<String, String>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -842,6 +843,12 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen {
|
|||||||
if (operations != null) {
|
if (operations != null) {
|
||||||
List<CodegenOperation> ops = operations.getOperation();
|
List<CodegenOperation> ops = operations.getOperation();
|
||||||
for (CodegenOperation operation : ops) {
|
for (CodegenOperation operation : ops) {
|
||||||
|
String duplicates = duplicateOf.get(operation.operationId);
|
||||||
|
if (duplicates != null) {
|
||||||
|
operation.vendorExtensions.put("x-duplicates", duplicates);
|
||||||
|
} else {
|
||||||
|
duplicateOf.put(operation.operationId, operations.getClassname());
|
||||||
|
}
|
||||||
if (operation.responses != null) {
|
if (operation.responses != null) {
|
||||||
for (CodegenResponse response : operation.responses) {
|
for (CodegenResponse response : operation.responses) {
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ namespace {{packageName}}.{{apiPackage}}
|
|||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
{{^vendorExtensions.x-duplicates}}
|
||||||
{{#responses}}
|
{{#responses}}
|
||||||
{{#-first}}
|
{{#-first}}
|
||||||
|
|
||||||
@ -115,6 +116,7 @@ namespace {{packageName}}.{{apiPackage}}
|
|||||||
}
|
}
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/responses}}
|
{{/responses}}
|
||||||
|
{{/vendorExtensions.x-duplicates}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -134,7 +136,7 @@ namespace {{packageName}}.{{apiPackage}}
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ExceptionEventArgs>{{nrt?}} OnError{{operationId}};
|
public event EventHandler<ExceptionEventArgs>{{nrt?}} OnError{{operationId}};
|
||||||
|
|
||||||
internal void ExecuteOn{{operationId}}({{classname}}.{{operationId}}ApiResponse apiResponse)
|
internal void ExecuteOn{{operationId}}({{#vendorExtensions.x-duplicates}}{{.}}{{/vendorExtensions.x-duplicates}}{{^vendorExtensions.x-duplicates}}{{classname}}{{/vendorExtensions.x-duplicates}}.{{operationId}}ApiResponse apiResponse)
|
||||||
{
|
{
|
||||||
On{{operationId}}?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
On{{operationId}}?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||||
}
|
}
|
||||||
@ -619,9 +621,9 @@ namespace {{packageName}}.{{apiPackage}}
|
|||||||
{
|
{
|
||||||
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync({{#net60OrLater}}cancellationToken{{/net60OrLater}}).ConfigureAwait(false);
|
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync({{#net60OrLater}}cancellationToken{{/net60OrLater}}).ConfigureAwait(false);
|
||||||
|
|
||||||
ILogger<{{operationId}}ApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<{{operationId}}ApiResponse>();
|
ILogger<{{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<{{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse>();
|
||||||
|
|
||||||
{{operationId}}ApiResponse apiResponseLocalVar = new{{^net60OrLater}} {{operationId}}ApiResponse{{/net60OrLater}}(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{{path}}}", requestedAtLocalVar, _jsonSerializerOptions);
|
{{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse apiResponseLocalVar = new{{^net60OrLater}} {{operationId}}ApiResponse{{/net60OrLater}}(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{{path}}}", requestedAtLocalVar, _jsonSerializerOptions);
|
||||||
|
|
||||||
After{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}apiResponseLocalVar {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}});
|
After{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}apiResponseLocalVar {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}});
|
||||||
|
|
||||||
@ -680,6 +682,7 @@ namespace {{packageName}}.{{apiPackage}}
|
|||||||
}
|
}
|
||||||
{{/lambda.trimLineBreaks}}
|
{{/lambda.trimLineBreaks}}
|
||||||
}
|
}
|
||||||
|
{{^vendorExtensions.x-duplicates}}
|
||||||
{{#responses}}
|
{{#responses}}
|
||||||
{{#-first}}
|
{{#-first}}
|
||||||
|
|
||||||
@ -792,6 +795,7 @@ namespace {{packageName}}.{{apiPackage}}
|
|||||||
}
|
}
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
{{/responses}}
|
{{/responses}}
|
||||||
|
{{/vendorExtensions.x-duplicates}}
|
||||||
{{/operation}}
|
{{/operation}}
|
||||||
}
|
}
|
||||||
{{/operations}}
|
{{/operations}}
|
||||||
|
@ -4,11 +4,11 @@ All URIs are relative to *http://app.files.com/api/rest/v1*
|
|||||||
|
|
||||||
| Method | HTTP request | Description |
|
| Method | HTTP request | Description |
|
||||||
|--------|--------------|-------------|
|
|--------|--------------|-------------|
|
||||||
| [**GetApiKeysId_1**](APIKEYSApi.md#getapikeysid_1) | **GET** /api_keys/{id} | Show API Key |
|
| [**GetApiKeysId**](APIKEYSApi.md#getapikeysid) | **GET** /api_keys/{id} | Show API Key |
|
||||||
|
|
||||||
<a id="getapikeysid_1"></a>
|
<a id="getapikeysid"></a>
|
||||||
# **GetApiKeysId_1**
|
# **GetApiKeysId**
|
||||||
> void GetApiKeysId_1 (int id)
|
> void GetApiKeysId (int id)
|
||||||
|
|
||||||
Show API Key
|
Show API Key
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ using Org.OpenAPITools.Model;
|
|||||||
|
|
||||||
namespace Example
|
namespace Example
|
||||||
{
|
{
|
||||||
public class GetApiKeysId_1Example
|
public class GetApiKeysIdExample
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
@ -36,11 +36,11 @@ namespace Example
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Show API Key
|
// Show API Key
|
||||||
apiInstance.GetApiKeysId_1(id);
|
apiInstance.GetApiKeysId(id);
|
||||||
}
|
}
|
||||||
catch (ApiException e)
|
catch (ApiException e)
|
||||||
{
|
{
|
||||||
Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1: " + e.Message);
|
Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId: " + e.Message);
|
||||||
Debug.Print("Status Code: " + e.ErrorCode);
|
Debug.Print("Status Code: " + e.ErrorCode);
|
||||||
Debug.Print(e.StackTrace);
|
Debug.Print(e.StackTrace);
|
||||||
}
|
}
|
||||||
@ -49,18 +49,18 @@ namespace Example
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Using the GetApiKeysId_1WithHttpInfo variant
|
#### Using the GetApiKeysIdWithHttpInfo variant
|
||||||
This returns an ApiResponse object which contains the response data, status code and headers.
|
This returns an ApiResponse object which contains the response data, status code and headers.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Show API Key
|
// Show API Key
|
||||||
apiInstance.GetApiKeysId_1WithHttpInfo(id);
|
apiInstance.GetApiKeysIdWithHttpInfo(id);
|
||||||
}
|
}
|
||||||
catch (ApiException e)
|
catch (ApiException e)
|
||||||
{
|
{
|
||||||
Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1WithHttpInfo: " + e.Message);
|
Debug.Print("Exception when calling APIKEYSApi.GetApiKeysIdWithHttpInfo: " + e.Message);
|
||||||
Debug.Print("Status Code: " + e.ErrorCode);
|
Debug.Print("Status Code: " + e.ErrorCode);
|
||||||
Debug.Print(e.StackTrace);
|
Debug.Print(e.StackTrace);
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,11 @@ All URIs are relative to *http://app.files.com/api/rest/v1*
|
|||||||
|
|
||||||
| Method | HTTP request | Description |
|
| Method | HTTP request | Description |
|
||||||
|--------|--------------|-------------|
|
|--------|--------------|-------------|
|
||||||
| [**GetApiKeysId_0**](APIKeysApi.md#getapikeysid_0) | **GET** /api_keys/{id} | Show API Key |
|
| [**GetApiKeysId**](APIKeysApi.md#getapikeysid) | **GET** /api_keys/{id} | Show API Key |
|
||||||
|
|
||||||
<a id="getapikeysid_0"></a>
|
<a id="getapikeysid"></a>
|
||||||
# **GetApiKeysId_0**
|
# **GetApiKeysId**
|
||||||
> void GetApiKeysId_0 (int id)
|
> void GetApiKeysId (int id)
|
||||||
|
|
||||||
Show API Key
|
Show API Key
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ using Org.OpenAPITools.Model;
|
|||||||
|
|
||||||
namespace Example
|
namespace Example
|
||||||
{
|
{
|
||||||
public class GetApiKeysId_0Example
|
public class GetApiKeysIdExample
|
||||||
{
|
{
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
@ -36,11 +36,11 @@ namespace Example
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Show API Key
|
// Show API Key
|
||||||
apiInstance.GetApiKeysId_0(id);
|
apiInstance.GetApiKeysId(id);
|
||||||
}
|
}
|
||||||
catch (ApiException e)
|
catch (ApiException e)
|
||||||
{
|
{
|
||||||
Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0: " + e.Message);
|
Debug.Print("Exception when calling APIKeysApi.GetApiKeysId: " + e.Message);
|
||||||
Debug.Print("Status Code: " + e.ErrorCode);
|
Debug.Print("Status Code: " + e.ErrorCode);
|
||||||
Debug.Print(e.StackTrace);
|
Debug.Print(e.StackTrace);
|
||||||
}
|
}
|
||||||
@ -49,18 +49,18 @@ namespace Example
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Using the GetApiKeysId_0WithHttpInfo variant
|
#### Using the GetApiKeysIdWithHttpInfo variant
|
||||||
This returns an ApiResponse object which contains the response data, status code and headers.
|
This returns an ApiResponse object which contains the response data, status code and headers.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Show API Key
|
// Show API Key
|
||||||
apiInstance.GetApiKeysId_0WithHttpInfo(id);
|
apiInstance.GetApiKeysIdWithHttpInfo(id);
|
||||||
}
|
}
|
||||||
catch (ApiException e)
|
catch (ApiException e)
|
||||||
{
|
{
|
||||||
Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0WithHttpInfo: " + e.Message);
|
Debug.Print("Exception when calling APIKeysApi.GetApiKeysIdWithHttpInfo: " + e.Message);
|
||||||
Debug.Print("Status Code: " + e.ErrorCode);
|
Debug.Print("Status Code: " + e.ErrorCode);
|
||||||
Debug.Print(e.StackTrace);
|
Debug.Print(e.StackTrace);
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,13 @@ namespace Org.OpenAPITools.Test.Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test GetApiKeysId_1
|
/// Test GetApiKeysId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact (Skip = "not implemented")]
|
[Fact (Skip = "not implemented")]
|
||||||
public async Task GetApiKeysId_1AsyncTest()
|
public async Task GetApiKeysIdAsyncTest()
|
||||||
{
|
{
|
||||||
int id = default!;
|
int id = default!;
|
||||||
await _instance.GetApiKeysId_1Async(id);
|
await _instance.GetApiKeysIdAsync(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,13 @@ namespace Org.OpenAPITools.Test.Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test GetApiKeysId_0
|
/// Test GetApiKeysId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Fact (Skip = "not implemented")]
|
[Fact (Skip = "not implemented")]
|
||||||
public async Task GetApiKeysId_0AsyncTest()
|
public async Task GetApiKeysIdAsyncTest()
|
||||||
{
|
{
|
||||||
int id = default!;
|
int id = default!;
|
||||||
await _instance.GetApiKeysId_0Async(id);
|
await _instance.GetApiKeysIdAsync(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_1ApiResponse"/>></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>></returns>
|
||||||
Task<IGetApiKeysId_1ApiResponse> GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default);
|
Task<IGetApiKeysIdApiResponse> GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show API Key
|
/// Show API Key
|
||||||
@ -55,14 +55,14 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_1ApiResponse"/>?></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>?></returns>
|
||||||
Task<IGetApiKeysId_1ApiResponse?> GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
Task<IGetApiKeysIdApiResponse?> GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="IGetApiKeysId_1ApiResponse"/>
|
/// The <see cref="IGetApiKeysIdApiResponse"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IGetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.IApiResponse
|
public interface IGetApiKeysIdApiResponse : Org.OpenAPITools.Client.IApiResponse
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if the response is 400 BadRequest
|
/// Returns true if the response is 400 BadRequest
|
||||||
@ -79,21 +79,21 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The event raised after the server response
|
/// The event raised after the server response
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ApiResponseEventArgs>? OnGetApiKeysId_1;
|
public event EventHandler<ApiResponseEventArgs>? OnGetApiKeysId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The event raised after an error querying the server
|
/// The event raised after an error querying the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ExceptionEventArgs>? OnErrorGetApiKeysId_1;
|
public event EventHandler<ExceptionEventArgs>? OnErrorGetApiKeysId;
|
||||||
|
|
||||||
internal void ExecuteOnGetApiKeysId_1(APIKEYSApi.GetApiKeysId_1ApiResponse apiResponse)
|
internal void ExecuteOnGetApiKeysId(APIKEYSApi.GetApiKeysIdApiResponse apiResponse)
|
||||||
{
|
{
|
||||||
OnGetApiKeysId_1?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
OnGetApiKeysId?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ExecuteOnErrorGetApiKeysId_1(Exception exception)
|
internal void ExecuteOnErrorGetApiKeysId(Exception exception)
|
||||||
{
|
{
|
||||||
OnErrorGetApiKeysId_1?.Invoke(this, new ExceptionEventArgs(exception));
|
OnErrorGetApiKeysId?.Invoke(this, new ExceptionEventArgs(exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,17 +144,17 @@ namespace Org.OpenAPITools.Api
|
|||||||
ApiKeyProvider = apiKeyProvider;
|
ApiKeyProvider = apiKeyProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void FormatGetApiKeysId_1(ref int id);
|
partial void FormatGetApiKeysId(ref int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes the server response
|
/// Processes the server response
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="apiResponseLocalVar"></param>
|
/// <param name="apiResponseLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
private void AfterGetApiKeysId_1DefaultImplementation(IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id)
|
private void AfterGetApiKeysIdDefaultImplementation(IGetApiKeysIdApiResponse apiResponseLocalVar, int id)
|
||||||
{
|
{
|
||||||
bool suppressDefaultLog = false;
|
bool suppressDefaultLog = false;
|
||||||
AfterGetApiKeysId_1(ref suppressDefaultLog, apiResponseLocalVar, id);
|
AfterGetApiKeysId(ref suppressDefaultLog, apiResponseLocalVar, id);
|
||||||
if (!suppressDefaultLog)
|
if (!suppressDefaultLog)
|
||||||
Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
|
Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <param name="suppressDefaultLog"></param>
|
/// <param name="suppressDefaultLog"></param>
|
||||||
/// <param name="apiResponseLocalVar"></param>
|
/// <param name="apiResponseLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
partial void AfterGetApiKeysId_1(ref bool suppressDefaultLog, IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id);
|
partial void AfterGetApiKeysId(ref bool suppressDefaultLog, IGetApiKeysIdApiResponse apiResponseLocalVar, int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs exceptions that occur while retrieving the server response
|
/// Logs exceptions that occur while retrieving the server response
|
||||||
@ -174,10 +174,10 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <param name="pathFormatLocalVar"></param>
|
/// <param name="pathFormatLocalVar"></param>
|
||||||
/// <param name="pathLocalVar"></param>
|
/// <param name="pathLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
private void OnErrorGetApiKeysId_1DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id)
|
private void OnErrorGetApiKeysIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id)
|
||||||
{
|
{
|
||||||
bool suppressDefaultLogLocalVar = false;
|
bool suppressDefaultLogLocalVar = false;
|
||||||
OnErrorGetApiKeysId_1(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id);
|
OnErrorGetApiKeysId(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id);
|
||||||
if (!suppressDefaultLogLocalVar)
|
if (!suppressDefaultLogLocalVar)
|
||||||
Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
|
Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
|
||||||
}
|
}
|
||||||
@ -190,19 +190,19 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <param name="pathFormatLocalVar"></param>
|
/// <param name="pathFormatLocalVar"></param>
|
||||||
/// <param name="pathLocalVar"></param>
|
/// <param name="pathLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
partial void OnErrorGetApiKeysId_1(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id);
|
partial void OnErrorGetApiKeysId(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show API Key Show API Key
|
/// Show API Key Show API Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_1ApiResponse"/>></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>></returns>
|
||||||
public async Task<IGetApiKeysId_1ApiResponse?> GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default)
|
public async Task<IGetApiKeysIdApiResponse?> GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await GetApiKeysId_1Async(id, cancellationToken).ConfigureAwait(false);
|
return await GetApiKeysIdAsync(id, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -216,14 +216,14 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_1ApiResponse"/>></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>></returns>
|
||||||
public async Task<IGetApiKeysId_1ApiResponse> GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default)
|
public async Task<IGetApiKeysIdApiResponse> GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
UriBuilder uriBuilderLocalVar = new UriBuilder();
|
UriBuilder uriBuilderLocalVar = new UriBuilder();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FormatGetApiKeysId_1(ref id);
|
FormatGetApiKeysId(ref id);
|
||||||
|
|
||||||
using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
|
using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
|
||||||
{
|
{
|
||||||
@ -243,13 +243,13 @@ namespace Org.OpenAPITools.Api
|
|||||||
{
|
{
|
||||||
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
ILogger<GetApiKeysId_1ApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<GetApiKeysId_1ApiResponse>();
|
ILogger<GetApiKeysIdApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<GetApiKeysIdApiResponse>();
|
||||||
|
|
||||||
GetApiKeysId_1ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions);
|
GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions);
|
||||||
|
|
||||||
AfterGetApiKeysId_1DefaultImplementation(apiResponseLocalVar, id);
|
AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id);
|
||||||
|
|
||||||
Events.ExecuteOnGetApiKeysId_1(apiResponseLocalVar);
|
Events.ExecuteOnGetApiKeysId(apiResponseLocalVar);
|
||||||
|
|
||||||
return apiResponseLocalVar;
|
return apiResponseLocalVar;
|
||||||
}
|
}
|
||||||
@ -257,24 +257,24 @@ namespace Org.OpenAPITools.Api
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
OnErrorGetApiKeysId_1DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id);
|
OnErrorGetApiKeysIdDefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id);
|
||||||
Events.ExecuteOnErrorGetApiKeysId_1(e);
|
Events.ExecuteOnErrorGetApiKeysId(e);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="GetApiKeysId_1ApiResponse"/>
|
/// The <see cref="GetApiKeysIdApiResponse"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class GetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_1ApiResponse
|
public partial class GetApiKeysIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysIdApiResponse
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The logger
|
/// The logger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ILogger<GetApiKeysId_1ApiResponse> Logger { get; }
|
public ILogger<GetApiKeysIdApiResponse> Logger { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="GetApiKeysId_1ApiResponse"/>
|
/// The <see cref="GetApiKeysIdApiResponse"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger"></param>
|
/// <param name="logger"></param>
|
||||||
/// <param name="httpRequestMessage"></param>
|
/// <param name="httpRequestMessage"></param>
|
||||||
@ -283,7 +283,7 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <param name="requestedAt"></param>
|
/// <param name="requestedAt"></param>
|
||||||
/// <param name="jsonSerializerOptions"></param>
|
/// <param name="jsonSerializerOptions"></param>
|
||||||
public GetApiKeysId_1ApiResponse(ILogger<GetApiKeysId_1ApiResponse> 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)
|
public GetApiKeysIdApiResponse(ILogger<GetApiKeysIdApiResponse> 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;
|
Logger = logger;
|
||||||
OnCreated(httpRequestMessage, httpResponseMessage);
|
OnCreated(httpRequestMessage, httpResponseMessage);
|
||||||
|
@ -44,8 +44,8 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_0ApiResponse"/>></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>></returns>
|
||||||
Task<IGetApiKeysId_0ApiResponse> GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default);
|
Task<IGetApiKeysIdApiResponse> GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show API Key
|
/// Show API Key
|
||||||
@ -55,20 +55,8 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_0ApiResponse"/>?></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>?></returns>
|
||||||
Task<IGetApiKeysId_0ApiResponse?> GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
Task<IGetApiKeysIdApiResponse?> GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="IGetApiKeysId_0ApiResponse"/>
|
|
||||||
/// </summary>
|
|
||||||
public interface IGetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.IApiResponse
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if the response is 400 BadRequest
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool IsBadRequest { get; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -79,21 +67,21 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The event raised after the server response
|
/// The event raised after the server response
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ApiResponseEventArgs>? OnGetApiKeysId_0;
|
public event EventHandler<ApiResponseEventArgs>? OnGetApiKeysId;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The event raised after an error querying the server
|
/// The event raised after an error querying the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ExceptionEventArgs>? OnErrorGetApiKeysId_0;
|
public event EventHandler<ExceptionEventArgs>? OnErrorGetApiKeysId;
|
||||||
|
|
||||||
internal void ExecuteOnGetApiKeysId_0(APIKeysApi.GetApiKeysId_0ApiResponse apiResponse)
|
internal void ExecuteOnGetApiKeysId(APIKEYSApi.GetApiKeysIdApiResponse apiResponse)
|
||||||
{
|
{
|
||||||
OnGetApiKeysId_0?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
OnGetApiKeysId?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ExecuteOnErrorGetApiKeysId_0(Exception exception)
|
internal void ExecuteOnErrorGetApiKeysId(Exception exception)
|
||||||
{
|
{
|
||||||
OnErrorGetApiKeysId_0?.Invoke(this, new ExceptionEventArgs(exception));
|
OnErrorGetApiKeysId?.Invoke(this, new ExceptionEventArgs(exception));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,17 +132,17 @@ namespace Org.OpenAPITools.Api
|
|||||||
ApiKeyProvider = apiKeyProvider;
|
ApiKeyProvider = apiKeyProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void FormatGetApiKeysId_0(ref int id);
|
partial void FormatGetApiKeysId(ref int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes the server response
|
/// Processes the server response
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="apiResponseLocalVar"></param>
|
/// <param name="apiResponseLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
private void AfterGetApiKeysId_0DefaultImplementation(IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id)
|
private void AfterGetApiKeysIdDefaultImplementation(IGetApiKeysIdApiResponse apiResponseLocalVar, int id)
|
||||||
{
|
{
|
||||||
bool suppressDefaultLog = false;
|
bool suppressDefaultLog = false;
|
||||||
AfterGetApiKeysId_0(ref suppressDefaultLog, apiResponseLocalVar, id);
|
AfterGetApiKeysId(ref suppressDefaultLog, apiResponseLocalVar, id);
|
||||||
if (!suppressDefaultLog)
|
if (!suppressDefaultLog)
|
||||||
Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
|
Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path);
|
||||||
}
|
}
|
||||||
@ -165,7 +153,7 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <param name="suppressDefaultLog"></param>
|
/// <param name="suppressDefaultLog"></param>
|
||||||
/// <param name="apiResponseLocalVar"></param>
|
/// <param name="apiResponseLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
partial void AfterGetApiKeysId_0(ref bool suppressDefaultLog, IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id);
|
partial void AfterGetApiKeysId(ref bool suppressDefaultLog, IGetApiKeysIdApiResponse apiResponseLocalVar, int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs exceptions that occur while retrieving the server response
|
/// Logs exceptions that occur while retrieving the server response
|
||||||
@ -174,10 +162,10 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <param name="pathFormatLocalVar"></param>
|
/// <param name="pathFormatLocalVar"></param>
|
||||||
/// <param name="pathLocalVar"></param>
|
/// <param name="pathLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
private void OnErrorGetApiKeysId_0DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id)
|
private void OnErrorGetApiKeysIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id)
|
||||||
{
|
{
|
||||||
bool suppressDefaultLogLocalVar = false;
|
bool suppressDefaultLogLocalVar = false;
|
||||||
OnErrorGetApiKeysId_0(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id);
|
OnErrorGetApiKeysId(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id);
|
||||||
if (!suppressDefaultLogLocalVar)
|
if (!suppressDefaultLogLocalVar)
|
||||||
Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
|
Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server.");
|
||||||
}
|
}
|
||||||
@ -190,19 +178,19 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <param name="pathFormatLocalVar"></param>
|
/// <param name="pathFormatLocalVar"></param>
|
||||||
/// <param name="pathLocalVar"></param>
|
/// <param name="pathLocalVar"></param>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
partial void OnErrorGetApiKeysId_0(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id);
|
partial void OnErrorGetApiKeysId(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show API Key Show API Key
|
/// Show API Key Show API Key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_0ApiResponse"/>></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>></returns>
|
||||||
public async Task<IGetApiKeysId_0ApiResponse?> GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default)
|
public async Task<IGetApiKeysIdApiResponse?> GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await GetApiKeysId_0Async(id, cancellationToken).ConfigureAwait(false);
|
return await GetApiKeysIdAsync(id, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -216,14 +204,14 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
|
||||||
/// <param name="id">Api Key ID.</param>
|
/// <param name="id">Api Key ID.</param>
|
||||||
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
|
||||||
/// <returns><see cref="Task"/><<see cref="IGetApiKeysId_0ApiResponse"/>></returns>
|
/// <returns><see cref="Task"/><<see cref="IGetApiKeysIdApiResponse"/>></returns>
|
||||||
public async Task<IGetApiKeysId_0ApiResponse> GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default)
|
public async Task<IGetApiKeysIdApiResponse> GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
UriBuilder uriBuilderLocalVar = new UriBuilder();
|
UriBuilder uriBuilderLocalVar = new UriBuilder();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FormatGetApiKeysId_0(ref id);
|
FormatGetApiKeysId(ref id);
|
||||||
|
|
||||||
using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
|
using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage())
|
||||||
{
|
{
|
||||||
@ -243,13 +231,13 @@ namespace Org.OpenAPITools.Api
|
|||||||
{
|
{
|
||||||
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
ILogger<GetApiKeysId_0ApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<GetApiKeysId_0ApiResponse>();
|
ILogger<APIKEYSApi.GetApiKeysIdApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<APIKEYSApi.GetApiKeysIdApiResponse>();
|
||||||
|
|
||||||
GetApiKeysId_0ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions);
|
APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions);
|
||||||
|
|
||||||
AfterGetApiKeysId_0DefaultImplementation(apiResponseLocalVar, id);
|
AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id);
|
||||||
|
|
||||||
Events.ExecuteOnGetApiKeysId_0(apiResponseLocalVar);
|
Events.ExecuteOnGetApiKeysId(apiResponseLocalVar);
|
||||||
|
|
||||||
return apiResponseLocalVar;
|
return apiResponseLocalVar;
|
||||||
}
|
}
|
||||||
@ -257,55 +245,10 @@ namespace Org.OpenAPITools.Api
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
OnErrorGetApiKeysId_0DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id);
|
OnErrorGetApiKeysIdDefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id);
|
||||||
Events.ExecuteOnErrorGetApiKeysId_0(e);
|
Events.ExecuteOnErrorGetApiKeysId(e);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="GetApiKeysId_0ApiResponse"/>
|
|
||||||
/// </summary>
|
|
||||||
public partial class GetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_0ApiResponse
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The logger
|
|
||||||
/// </summary>
|
|
||||||
public ILogger<GetApiKeysId_0ApiResponse> Logger { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="GetApiKeysId_0ApiResponse"/>
|
|
||||||
/// </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 GetApiKeysId_0ApiResponse(ILogger<GetApiKeysId_0ApiResponse> 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 400 BadRequest
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool IsBadRequest => 400 == (int)StatusCode;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,18 +59,6 @@ namespace Org.OpenAPITools.Api
|
|||||||
Task<IGetApiKeysIdApiResponse?> GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
Task<IGetApiKeysIdApiResponse?> GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="IGetApiKeysIdApiResponse"/>
|
|
||||||
/// </summary>
|
|
||||||
public interface IGetApiKeysIdApiResponse : Org.OpenAPITools.Client.IApiResponse
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if the response is 400 BadRequest
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool IsBadRequest { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a collection of functions to interact with the API endpoints
|
/// Represents a collection of functions to interact with the API endpoints
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -86,7 +74,7 @@ namespace Org.OpenAPITools.Api
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<ExceptionEventArgs>? OnErrorGetApiKeysId;
|
public event EventHandler<ExceptionEventArgs>? OnErrorGetApiKeysId;
|
||||||
|
|
||||||
internal void ExecuteOnGetApiKeysId(ApiKeysApi.GetApiKeysIdApiResponse apiResponse)
|
internal void ExecuteOnGetApiKeysId(APIKEYSApi.GetApiKeysIdApiResponse apiResponse)
|
||||||
{
|
{
|
||||||
OnGetApiKeysId?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
OnGetApiKeysId?.Invoke(this, new ApiResponseEventArgs(apiResponse));
|
||||||
}
|
}
|
||||||
@ -243,9 +231,9 @@ namespace Org.OpenAPITools.Api
|
|||||||
{
|
{
|
||||||
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
ILogger<GetApiKeysIdApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<GetApiKeysIdApiResponse>();
|
ILogger<APIKEYSApi.GetApiKeysIdApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<APIKEYSApi.GetApiKeysIdApiResponse>();
|
||||||
|
|
||||||
GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions);
|
APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions);
|
||||||
|
|
||||||
AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id);
|
AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id);
|
||||||
|
|
||||||
@ -262,50 +250,5 @@ namespace Org.OpenAPITools.Api
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="GetApiKeysIdApiResponse"/>
|
|
||||||
/// </summary>
|
|
||||||
public partial class GetApiKeysIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysIdApiResponse
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The logger
|
|
||||||
/// </summary>
|
|
||||||
public ILogger<GetApiKeysIdApiResponse> Logger { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="GetApiKeysIdApiResponse"/>
|
|
||||||
/// </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 GetApiKeysIdApiResponse(ILogger<GetApiKeysIdApiResponse> 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 400 BadRequest
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool IsBadRequest => 400 == (int)StatusCode;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ namespace YourProject
|
|||||||
{
|
{
|
||||||
var host = CreateHostBuilder(args).Build();
|
var host = CreateHostBuilder(args).Build();
|
||||||
var api = host.Services.GetRequiredService<IAPIKEYSApi>();
|
var api = host.Services.GetRequiredService<IAPIKEYSApi>();
|
||||||
GetApiKeysId_1ApiResponse apiResponse = await api.GetApiKeysId_1Async("todo");
|
GetApiKeysIdApiResponse apiResponse = await api.GetApiKeysIdAsync("todo");
|
||||||
object model = apiResponse.Ok();
|
object model = apiResponse.Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user