From 806da65daa5cb51b6163020b9f05d143aba1f0e5 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 29 Sep 2024 18:50:23 -0400 Subject: [PATCH 1/8] fixed missing output --- .../openapitools/codegen/DefaultCodegen.java | 63 ++++++++++++++++--- .../codegen/DefaultGenerator.java | 7 +++ 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index f2dc457ad0a2..ea3af677bdf5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1452,7 +1452,7 @@ public String toRegularExpression(String pattern) { } /** - * Return the file name of the Api Test + * Return the file name of the Api * * @param name the file name of the Api * @return the file name of the Api @@ -5668,6 +5668,8 @@ protected void addHeaders(ApiResponse response, List properties } } + private final Set seenOperationIds = new HashSet<>(); + /** * Add operation to group * @@ -5695,6 +5697,10 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera counter++; } } + if (seenOperationIds.contains(uniqueName.toLowerCase(Locale.ROOT))) { + uniqueName = co.operationId + "_" + counter; + counter++; + } if (!co.operationId.equals(uniqueName)) { LOGGER.warn("generated unique operationId `{}`", uniqueName); } @@ -5704,6 +5710,7 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera co.operationIdSnakeCase = underscore(uniqueName); opList.add(co); co.baseName = tag; + seenOperationIds.add(co.operationId.toLowerCase(Locale.ROOT)); } protected void addParentFromContainer(CodegenModel model, Schema schema) { @@ -6070,30 +6077,68 @@ protected String removeNonNameElementToCamelCase(final String name, final String return result; } + /** + * Return a value that is unique, suffixed with _index to make it unique + * Ensures generated files are unique when compared case-insensitive + * Not all operating systems support case-sensitive paths + */ + private String uniqueCaseInsensitiveString(String value, Map seenValues) { + if (seenValues.keySet().contains(value)) { + return seenValues.get(value); + } + + Optional> foundEntry = seenValues.entrySet().stream().filter(v -> v.getKey().toLowerCase(Locale.ROOT).equals(value.toLowerCase(Locale.ROOT))).findAny(); + if (foundEntry.isPresent()) { + int counter = 0; + String uniqueValue = value + "_" + counter; + + while (seenValues.containsKey(uniqueValue)) { + counter++; + uniqueValue = value + "_" + counter; + } + + seenValues.put(value, uniqueValue); + return uniqueValue; + } + + seenValues.put(value, value); + return value; + } + + private final Map seenApiFilenames = new HashMap(); + @Override public String apiFilename(String templateName, String tag) { + String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiFilenames); String suffix = apiTemplateFiles().get(templateName); - return apiFileFolder() + File.separator + toApiFilename(tag) + suffix; + return apiFileFolder() + File.separator + toApiFilename(uniqueTag) + suffix; } @Override public String apiFilename(String templateName, String tag, String outputDir) { + String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiFilenames); String suffix = apiTemplateFiles().get(templateName); - return outputDir + File.separator + toApiFilename(tag) + suffix; + return outputDir + File.separator + toApiFilename(uniqueTag) + suffix; } + private final Map seenModelFilenames = new HashMap(); + @Override public String modelFilename(String templateName, String modelName) { + String uniqueModelName = uniqueCaseInsensitiveString(modelName, seenModelFilenames); String suffix = modelTemplateFiles().get(templateName); - return modelFileFolder() + File.separator + toModelFilename(modelName) + suffix; + return modelFileFolder() + File.separator + toModelFilename(uniqueModelName) + suffix; } @Override public String modelFilename(String templateName, String modelName, String outputDir) { + String uniqueModelName = uniqueCaseInsensitiveString(modelName, seenModelFilenames); String suffix = modelTemplateFiles().get(templateName); - return outputDir + File.separator + toModelFilename(modelName) + suffix; + return outputDir + File.separator + toModelFilename(uniqueModelName) + suffix; } + private final Map seenApiDocFilenames = new HashMap(); + /** * Return the full path and API documentation file * @@ -6103,11 +6148,14 @@ public String modelFilename(String templateName, String modelName, String output */ @Override public String apiDocFilename(String templateName, String tag) { + String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiDocFilenames); String docExtension = getDocExtension(); String suffix = docExtension != null ? docExtension : apiDocTemplateFiles().get(templateName); - return apiDocFileFolder() + File.separator + toApiDocFilename(tag) + suffix; + return apiDocFileFolder() + File.separator + toApiDocFilename(uniqueTag) + suffix; } + private final Map seenApiTestFilenames = new HashMap(); + /** * Return the full path and API test file * @@ -6117,8 +6165,9 @@ public String apiDocFilename(String templateName, String tag) { */ @Override public String apiTestFilename(String templateName, String tag) { + String uniqueTag = uniqueCaseInsensitiveString(tag, seenApiTestFilenames); String suffix = apiTestTemplateFiles().get(templateName); - return apiTestFileFolder() + File.separator + toApiTestFilename(tag) + suffix; + return apiTestFileFolder() + File.separator + toApiTestFilename(uniqueTag) + suffix; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index fe4d15461ffe..ef5bea60ab31 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -1434,6 +1434,8 @@ protected File processTemplateToFile(Map templateData, String te return processTemplateToFile(templateData, templateName, outputFilename, shouldGenerate, skippedByOption, this.config.getOutputDir()); } + private final Set seenFiles = new HashSet<>(); + private File processTemplateToFile(Map templateData, String templateName, String outputFilename, boolean shouldGenerate, String skippedByOption, String intendedOutputDir) throws IOException { String adjustedOutputFilename = outputFilename.replaceAll("//", "/").replace('/', File.separatorChar); File target = new File(adjustedOutputFilename); @@ -1444,6 +1446,11 @@ private File processTemplateToFile(Map templateData, String temp if (!absoluteTarget.startsWith(outDir)) { throw new RuntimeException(String.format(Locale.ROOT, "Target files must be generated within the output directory; absoluteTarget=%s outDir=%s", absoluteTarget, outDir)); } + + if (seenFiles.stream().filter(f -> f.toLowerCase(Locale.ROOT).equals(absoluteTarget.toString().toLowerCase(Locale.ROOT))).findAny().isPresent()) { + LOGGER.warn("Duplicate file path detected. Not all operating systems can handle case sensitive file paths. path={}", absoluteTarget.toString()); + } + seenFiles.add(absoluteTarget.toString()); return this.templateProcessor.write(templateData, templateName, target); } else { this.templateProcessor.skip(target.toPath(), String.format(Locale.ROOT, "Skipped by %s options supplied by user.", skippedByOption)); From 63b77d6c1845ee901bec2a91215207244bf76afb Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 29 Sep 2024 20:46:15 -0400 Subject: [PATCH 2/8] bug fix --- .../openapitools/codegen/DefaultCodegen.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index ea3af677bdf5..f14f61b721a9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -5668,7 +5668,7 @@ protected void addHeaders(ApiResponse response, List properties } } - private final Set seenOperationIds = new HashSet<>(); + private final Map seenOperationIds = new HashMap(); /** * Add operation to group @@ -5690,17 +5690,18 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera } // check for operationId uniqueness String uniqueName = co.operationId; - int counter = 0; + int counter = seenOperationIds.getOrDefault(uniqueName, 0); + while(seenOperationIds.containsKey(uniqueName)) { + uniqueName = co.operationId + "_" + counter; + counter++; + } for (CodegenOperation op : opList) { if (uniqueName.equals(op.operationId)) { uniqueName = co.operationId + "_" + counter; counter++; } } - if (seenOperationIds.contains(uniqueName.toLowerCase(Locale.ROOT))) { - uniqueName = co.operationId + "_" + counter; - counter++; - } + seenOperationIds.put(co.operationId, counter); if (!co.operationId.equals(uniqueName)) { LOGGER.warn("generated unique operationId `{}`", uniqueName); } @@ -5710,7 +5711,6 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera co.operationIdSnakeCase = underscore(uniqueName); opList.add(co); co.baseName = tag; - seenOperationIds.add(co.operationId.toLowerCase(Locale.ROOT)); } protected void addParentFromContainer(CodegenModel model, Schema schema) { @@ -6087,12 +6087,12 @@ private String uniqueCaseInsensitiveString(String value, Map see return seenValues.get(value); } - Optional> foundEntry = seenValues.entrySet().stream().filter(v -> v.getKey().toLowerCase(Locale.ROOT).equals(value.toLowerCase(Locale.ROOT))).findAny(); + Optional> foundEntry = seenValues.entrySet().stream().filter(v -> v.getValue().toLowerCase(Locale.ROOT).equals(value.toLowerCase(Locale.ROOT))).findAny(); if (foundEntry.isPresent()) { int counter = 0; String uniqueValue = value + "_" + counter; - while (seenValues.containsKey(uniqueValue)) { + while (seenValues.values().stream().map(v -> v.toLowerCase(Locale.ROOT)).collect(Collectors.toList()).contains(uniqueValue.toLowerCase(Locale.ROOT))) { counter++; uniqueValue = value + "_" + counter; } From b0cb8f300ed2eb424ded015fe41be33053c54420 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 29 Sep 2024 21:32:55 -0400 Subject: [PATCH 3/8] add new sample --- .../csharp-generichost-tags-latest.yaml | 10 + .../src/test/resources/3_0/csharp/tags.json | 158 +++++ .../csharp/generichost/net8/Tags/.gitignore | 362 ++++++++++++ .../net8/Tags/.openapi-generator-ignore | 23 + .../net8/Tags/.openapi-generator/FILES | 49 ++ .../net8/Tags/.openapi-generator/VERSION | 1 + .../net8/Tags/Org.OpenAPITools.sln | 27 + .../csharp/generichost/net8/Tags/README.md | 1 + .../generichost/net8/Tags/api/openapi.yaml | 141 +++++ .../csharp/generichost/net8/Tags/appveyor.yml | 9 + .../net8/Tags/docs/apis/APIKEYSApi.md | 95 +++ .../net8/Tags/docs/apis/APIKeys0Api.md | 95 +++ .../net8/Tags/docs/apis/ApiKeys1Api.md | 95 +++ .../models/ActionNotificationExportEntity.md | 23 + .../net8/Tags/docs/scripts/git_push.ps1 | 75 +++ .../net8/Tags/docs/scripts/git_push.sh | 49 ++ .../Api/APIKEYSApiTests.cs | 63 ++ .../Api/APIKeys0ApiTests.cs | 63 ++ .../Api/ApiKeys1ApiTests.cs | 63 ++ .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 61 ++ .../Api/DependencyInjectionTests.cs | 132 +++++ .../ActionNotificationExportEntityTests.cs | 174 ++++++ .../Org.OpenAPITools.Test.csproj | 20 + .../Tags/src/Org.OpenAPITools.Test/README.md | 0 .../src/Org.OpenAPITools/Api/APIKEYSApi.cs | 311 ++++++++++ .../src/Org.OpenAPITools/Api/APIKeys0Api.cs | 311 ++++++++++ .../src/Org.OpenAPITools/Api/ApiKeys1Api.cs | 311 ++++++++++ .../Tags/src/Org.OpenAPITools/Api/IApi.cs | 15 + .../Org.OpenAPITools/Client/ApiException.cs | 53 ++ .../src/Org.OpenAPITools/Client/ApiFactory.cs | 49 ++ .../Org.OpenAPITools/Client/ApiKeyToken.cs | 54 ++ .../Client/ApiResponseEventArgs.cs | 24 + .../Org.OpenAPITools/Client/ApiResponse`1.cs | 153 +++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 343 +++++++++++ .../Client/CookieContainer.cs | 20 + .../Client/DateOnlyJsonConverter.cs | 62 ++ .../Client/DateOnlyNullableJsonConverter.cs | 67 +++ .../Client/DateTimeJsonConverter.cs | 76 +++ .../Client/DateTimeNullableJsonConverter.cs | 81 +++ .../Client/ExceptionEventArgs.cs | 24 + .../Client/HostConfiguration.cs | 140 +++++ .../Client/JsonSerializerOptionsProvider.cs | 27 + .../src/Org.OpenAPITools/Client/Option.cs | 54 ++ .../Client/RateLimitProvider`1.cs | 75 +++ .../src/Org.OpenAPITools/Client/TokenBase.cs | 71 +++ .../Client/TokenContainer`1.cs | 37 ++ .../Client/TokenProvider`1.cs | 45 ++ .../Extensions/IHostBuilderExtensions.cs | 44 ++ .../IHttpClientBuilderExtensions.cs | 80 +++ .../IServiceCollectionExtensions.cs | 64 ++ .../Model/ActionNotificationExportEntity.cs | 545 ++++++++++++++++++ .../Org.OpenAPITools/Org.OpenAPITools.csproj | 31 + .../net8/Tags/src/Org.OpenAPITools/README.md | 190 ++++++ 53 files changed, 5146 insertions(+) create mode 100644 bin/configs/csharp-generichost-tags-latest.yaml create mode 100644 modules/openapi-generator/src/test/resources/3_0/csharp/tags.json create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.gitignore create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/README.md create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/README.md create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md diff --git a/bin/configs/csharp-generichost-tags-latest.yaml b/bin/configs/csharp-generichost-tags-latest.yaml new file mode 100644 index 000000000000..32f9e6fca2a2 --- /dev/null +++ b/bin/configs/csharp-generichost-tags-latest.yaml @@ -0,0 +1,10 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net8/Tags +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/tags.json +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/tags.json b/modules/openapi-generator/src/test/resources/3_0/csharp/tags.json new file mode 100644 index 000000000000..766f359def40 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/tags.json @@ -0,0 +1,158 @@ +{ + "info": { + "title": "Files.com API", + "contact": { + "name": "Files.com Customer Success Team", + "email": "support@files.com" + }, + "version": "0.0.1" + }, + "swagger": "2.0", + "produces": [ + "application/json", + "application/msgpack", + "application/xml" + ], + "securityDefinitions": { + "api_key": { + "type": "apiKey", + "description": "API Key - supports user-based or site-wide API keys", + "name": "XFilesAPIKey", + "in": "header" + } + }, + "host": "app.files.com", + "basePath": "/api/rest/v1", + "tags": [ + { + "name": "api_key", + "description": "Operations about api_keys" + }, + { + "name": "API Keys", + "description": "Operations about API Keys" + }, + { + "name": "a_p_i_k_e_y_s", + "description": "Operations about API keys" + } + ], + "paths": { + "/api_keys/{id}": { + "get": { + "summary": "Show API Key", + "description": "Show API Key", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "id", + "description": "Api Key ID.", + "type": "integer", + "format": "int32", + "required": true, + "x-ms-summary": "Api Key ID." + } + ], + "responses": { + "400": { + "description": "Bad Request", + "x-ms-summary": "Bad Request" + } + }, + "tags": [ + "api_keys", + "API Keys", + "a_p_i_k_e_y_s" + ], + "operationId": "GetApiKeysId", + "x-authentication": [ + "self_managed" + ], + "x-category": [ + "developers" + ] + } + } + } + , + "definitions": { + "ActionNotificationExportEntity": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int32", + "example": 1, + "description": "History Export ID" + }, + "export_version": { + "type": "string", + "example": "example", + "description": "Version of the underlying records for the export." + }, + "start_at": { + "type": "string", + "format": "date-time", + "example": "2000-01-01T01:00:00Z", + "description": "Start date/time of export range." + }, + "end_at": { + "type": "string", + "format": "date-time", + "example": "2000-01-01T01:00:00Z", + "description": "End date/time of export range." + }, + "status": { + "type": "string", + "example": "ready", + "description": "Status of export. Valid values: `building`, `ready`, or `failed`" + }, + "query_path": { + "type": "string", + "example": "MyFile.txt", + "description": "Return notifications that were triggered by actions on this specific path." + }, + "query_folder": { + "type": "string", + "example": "MyFolder", + "description": "Return notifications that were triggered by actions in this folder." + }, + "query_message": { + "type": "string", + "example": "Connection Refused", + "description": "Error message associated with the request, if any." + }, + "query_request_method": { + "type": "string", + "example": "GET", + "description": "The HTTP request method used by the webhook." + }, + "query_request_url": { + "type": "string", + "example": "http://example.com/webhook", + "description": "The target webhook URL." + }, + "query_status": { + "type": "string", + "example": "200", + "description": "The HTTP status returned from the server in response to the webhook request." + }, + "query_success": { + "type": "boolean", + "example": true, + "description": "true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise." + }, + "results_url": { + "type": "string", + "example": "https://files.com/action_notification_results.csv", + "description": "If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV." + } + }, + "x-docs": "An ActionNotificationExport is an operation that provides access to outgoing webhook logs. Querying webhook logs is a little different than other APIs.\n\nAll queries against the archive must be submitted as Exports. (Even our Web UI creates an Export behind the scenes.)\n\nIn any query field in this API, you may specify multiple values separated by commas. That means that commas\ncannot be searched for themselves, and neither can single quotation marks.\n\nUse the following steps to complete an export:\n\n1. Initiate the export by using the Create Action Notification Export endpoint. Non Site Admins must query by folder or path.\n2. Using the `id` from the response to step 1, poll the Show Action Notification Export endpoint. Check the `status` field until it is `ready`.\n3. You can download the results of the export as a CSV file using the `results_url` field in the response from step 2. If you want to page through the records in JSON format, use the List Action Notification Export Results endpoint, passing the `id` that you got in step 1 as the `action_notification_export_id` parameter. Check the `X-Files-Cursor-Next` header to see if there are more records available, and resubmit the same request with a `cursor` parameter to fetch the next page of results. Unlike most API Endpoints, this endpoint does not provide `X-Files-Cursor-Prev` cursors allowing reverse pagination through the results. This is due to limitations in Amazon Athena, the underlying data lake for these records.\n\nIf you intend to use this API for high volume or automated use, please contact us with more information\nabout your use case.\n\n## Example Queries\n\n* History for a folder: `{ \"query_folder\": \"path/to/folder\" }`\n* History for a range of time: `{ \"start_at\": \"2021-03-18 12:00:00\", \"end_at\": \"2021-03-19 12:00:00\" }`\n* History of all notifications that used GET or POST: `{ \"query_request_method\": \"GET,POST\" }`\n", + "description": "ActionNotificationExportEntity model" + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.gitignore b/samples/client/petstore/csharp/generichost/net8/Tags/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES new file mode 100644 index 000000000000..ff9b2e64c1d0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES @@ -0,0 +1,49 @@ +.gitignore +.openapi-generator-ignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/APIKEYSApi.md +docs/apis/APIKeys0Api.md +docs/apis/ApiKeys1Api.md +docs/models/ActionNotificationExportEntity.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs +src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs +src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs +src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/APIKEYSApi.cs +src/Org.OpenAPITools/Api/APIKeys0Api.cs +src/Org.OpenAPITools/Api/ApiKeys1Api.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiKeyToken.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION new file mode 100644 index 000000000000..17f2442ff3bc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.9.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/README.md b/samples/client/petstore/csharp/generichost/net8/Tags/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml new file mode 100644 index 000000000000..c943de9c72c0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml @@ -0,0 +1,141 @@ +openapi: 3.0.1 +info: + contact: + email: support@files.com + name: Files.com Customer Success Team + title: Files.com API + version: 0.0.1 +servers: +- url: //app.files.com/api/rest/v1 +tags: +- description: Operations about api_keys + name: api_key +- description: Operations about API Keys + name: API Keys +- description: Operations about API keys + name: a_p_i_k_e_y_s +paths: + /api_keys/{id}: + get: + description: Show API Key + operationId: GetApiKeysId + parameters: + - description: Api Key ID. + in: path + name: id + required: true + schema: + format: int32 + type: integer + x-ms-summary: Api Key ID. + x-ms-summary: Api Key ID. + responses: + "400": + content: {} + description: Bad Request + x-ms-summary: Bad Request + summary: Show API Key + tags: + - api_keys + - API Keys + - a_p_i_k_e_y_s + x-authentication: + - self_managed + x-category: + - developers +components: + schemas: + ActionNotificationExportEntity: + description: ActionNotificationExportEntity model + properties: + id: + description: History Export ID + example: 1 + format: int32 + type: integer + export_version: + description: Version of the underlying records for the export. + example: example + type: string + start_at: + description: Start date/time of export range. + example: 2000-01-01T01:00:00Z + format: date-time + type: string + end_at: + description: End date/time of export range. + example: 2000-01-01T01:00:00Z + format: date-time + type: string + status: + description: "Status of export. Valid values: `building`, `ready`, or `failed`" + example: ready + type: string + query_path: + description: Return notifications that were triggered by actions on this + specific path. + example: MyFile.txt + type: string + query_folder: + description: Return notifications that were triggered by actions in this + folder. + example: MyFolder + type: string + query_message: + description: "Error message associated with the request, if any." + example: Connection Refused + type: string + query_request_method: + description: The HTTP request method used by the webhook. + example: GET + type: string + query_request_url: + description: The target webhook URL. + example: http://example.com/webhook + type: string + query_status: + description: The HTTP status returned from the server in response to the + webhook request. + example: "200" + type: string + query_success: + description: true if the webhook request succeeded (i.e. returned a 200 + or 204 response status). false otherwise. + example: true + type: boolean + results_url: + description: "If `status` is `ready`, this will be a URL where all the results\ + \ can be downloaded at once as a CSV." + example: https://files.com/action_notification_results.csv + type: string + type: object + x-docs: | + An ActionNotificationExport is an operation that provides access to outgoing webhook logs. Querying webhook logs is a little different than other APIs. + + All queries against the archive must be submitted as Exports. (Even our Web UI creates an Export behind the scenes.) + + In any query field in this API, you may specify multiple values separated by commas. That means that commas + cannot be searched for themselves, and neither can single quotation marks. + + Use the following steps to complete an export: + + 1. Initiate the export by using the Create Action Notification Export endpoint. Non Site Admins must query by folder or path. + 2. Using the `id` from the response to step 1, poll the Show Action Notification Export endpoint. Check the `status` field until it is `ready`. + 3. You can download the results of the export as a CSV file using the `results_url` field in the response from step 2. If you want to page through the records in JSON format, use the List Action Notification Export Results endpoint, passing the `id` that you got in step 1 as the `action_notification_export_id` parameter. Check the `X-Files-Cursor-Next` header to see if there are more records available, and resubmit the same request with a `cursor` parameter to fetch the next page of results. Unlike most API Endpoints, this endpoint does not provide `X-Files-Cursor-Prev` cursors allowing reverse pagination through the results. This is due to limitations in Amazon Athena, the underlying data lake for these records. + + If you intend to use this API for high volume or automated use, please contact us with more information + about your use case. + + ## Example Queries + + * History for a folder: `{ "query_folder": "path/to/folder" }` + * History for a range of time: `{ "start_at": "2021-03-18 12:00:00", "end_at": "2021-03-19 12:00:00" }` + * History of all notifications that used GET or POST: `{ "query_request_method": "GET,POST" }` + securitySchemes: + api_key: + description: API Key - supports user-based or site-wide API keys + in: header + name: XFilesAPIKey + type: apiKey +x-original-swagger-version: "2.0" + diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml b/samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md new file mode 100644 index 000000000000..bae5c9ea169d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md @@ -0,0 +1,95 @@ +# Org.OpenAPITools.Api.APIKEYSApi + +All URIs are relative to *http://app.files.com/api/rest/v1* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**GetApiKeysId_1**](APIKEYSApi.md#getapikeysid_1) | **GET** /api_keys/{id} | Show API Key | + + +# **GetApiKeysId_1** +> void GetApiKeysId_1 (int id) + +Show API Key + +Show API Key + +### 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 GetApiKeysId_1Example + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://app.files.com/api/rest/v1"; + var apiInstance = new APIKEYSApi(config); + var id = 56; // int | Api Key ID. + + try + { + // Show API Key + apiInstance.GetApiKeysId_1(id); + } + catch (ApiException e) + { + Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetApiKeysId_1WithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Show API Key + apiInstance.GetApiKeysId_1WithHttpInfo(id); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1WithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **id** | **int** | Api Key ID. | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md new file mode 100644 index 000000000000..c0520bd8d8d0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md @@ -0,0 +1,95 @@ +# Org.OpenAPITools.Api.APIKeysApi + +All URIs are relative to *http://app.files.com/api/rest/v1* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**GetApiKeysId_0**](APIKeysApi.md#getapikeysid_0) | **GET** /api_keys/{id} | Show API Key | + + +# **GetApiKeysId_0** +> void GetApiKeysId_0 (int id) + +Show API Key + +Show API Key + +### 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 GetApiKeysId_0Example + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://app.files.com/api/rest/v1"; + var apiInstance = new APIKeysApi(config); + var id = 56; // int | Api Key ID. + + try + { + // Show API Key + apiInstance.GetApiKeysId_0(id); + } + catch (ApiException e) + { + Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetApiKeysId_0WithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Show API Key + apiInstance.GetApiKeysId_0WithHttpInfo(id); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0WithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **id** | **int** | Api Key ID. | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md new file mode 100644 index 000000000000..c87fce89ca00 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md @@ -0,0 +1,95 @@ +# Org.OpenAPITools.Api.ApiKeysApi + +All URIs are relative to *http://app.files.com/api/rest/v1* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**GetApiKeysId**](ApiKeysApi.md#getapikeysid) | **GET** /api_keys/{id} | Show API Key | + + +# **GetApiKeysId** +> void GetApiKeysId (int id) + +Show API Key + +Show API Key + +### 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 GetApiKeysIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://app.files.com/api/rest/v1"; + var apiInstance = new ApiKeysApi(config); + var id = 56; // int | Api Key ID. + + try + { + // Show API Key + apiInstance.GetApiKeysId(id); + } + catch (ApiException e) + { + Debug.Print("Exception when calling ApiKeysApi.GetApiKeysId: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetApiKeysIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Show API Key + apiInstance.GetApiKeysIdWithHttpInfo(id); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling ApiKeysApi.GetApiKeysIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **id** | **int** | Api Key ID. | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md new file mode 100644 index 000000000000..c6730728c411 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md @@ -0,0 +1,23 @@ +# Org.OpenAPITools.Model.ActionNotificationExportEntity +ActionNotificationExportEntity model + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EndAt** | **DateTime** | End date/time of export range. | [optional] +**ExportVersion** | **string** | Version of the underlying records for the export. | [optional] +**Id** | **int** | History Export ID | [optional] +**QueryFolder** | **string** | Return notifications that were triggered by actions in this folder. | [optional] +**QueryMessage** | **string** | Error message associated with the request, if any. | [optional] +**QueryPath** | **string** | Return notifications that were triggered by actions on this specific path. | [optional] +**QueryRequestMethod** | **string** | The HTTP request method used by the webhook. | [optional] +**QueryRequestUrl** | **string** | The target webhook URL. | [optional] +**QueryStatus** | **string** | The HTTP status returned from the server in response to the webhook request. | [optional] +**QuerySuccess** | **bool** | true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. | [optional] +**ResultsUrl** | **string** | If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. | [optional] +**StartAt** | **DateTime** | Start date/time of export range. | [optional] +**Status** | **string** | Status of export. Valid values: `building`, `ready`, or `failed` | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=${1:-GIT_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +git_remote=$(git remote) + +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs new file mode 100644 index 000000000000..75525420b629 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs @@ -0,0 +1,63 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing APIKEYSApi + /// + public sealed class APIKEYSApiTests : ApiTestsBase + { + private readonly IAPIKEYSApi _instance; + + public APIKEYSApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test GetApiKeysId_1 + /// + [Fact (Skip = "not implemented")] + public async Task GetApiKeysId_1AsyncTest() + { + int id = default!; + await _instance.GetApiKeysId_1Async(id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs new file mode 100644 index 000000000000..b05a814880fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs @@ -0,0 +1,63 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing APIKeysApi + /// + public sealed class APIKeysApiTests : ApiTestsBase + { + private readonly IAPIKeysApi _instance; + + public APIKeysApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test GetApiKeysId_0 + /// + [Fact (Skip = "not implemented")] + public async Task GetApiKeysId_0AsyncTest() + { + int id = default!; + await _instance.GetApiKeysId_0Async(id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs new file mode 100644 index 000000000000..c98aa9c063b0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs @@ -0,0 +1,63 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing ApiKeysApi + /// + public sealed class ApiKeysApiTests : ApiTestsBase + { + private readonly IApiKeysApi _instance; + + public ApiKeysApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test GetApiKeysId + /// + [Fact (Skip = "not implemented")] + public async Task GetApiKeysIdAsyncTest() + { + int id = default!; + await _instance.GetApiKeysIdAsync(id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..fb1f2134be48 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,61 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..cc1119a79f4d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,132 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var aPIKEYSApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var aPIKEYSApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var aPIKEYSApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var aPIKEYSApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs new file mode 100644 index 000000000000..f78ea44cd286 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs @@ -0,0 +1,174 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ActionNotificationExportEntity + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActionNotificationExportEntityTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ActionNotificationExportEntity + //private ActionNotificationExportEntity instance; + + public ActionNotificationExportEntityTests() + { + // TODO uncomment below to create an instance of ActionNotificationExportEntity + //instance = new ActionNotificationExportEntity(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ActionNotificationExportEntity + /// + [Fact] + public void ActionNotificationExportEntityInstanceTest() + { + // TODO uncomment below to test "IsType" ActionNotificationExportEntity + //Assert.IsType(instance); + } + + /// + /// Test the property 'EndAt' + /// + [Fact] + public void EndAtTest() + { + // TODO unit test for the property 'EndAt' + } + + /// + /// Test the property 'ExportVersion' + /// + [Fact] + public void ExportVersionTest() + { + // TODO unit test for the property 'ExportVersion' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'QueryFolder' + /// + [Fact] + public void QueryFolderTest() + { + // TODO unit test for the property 'QueryFolder' + } + + /// + /// Test the property 'QueryMessage' + /// + [Fact] + public void QueryMessageTest() + { + // TODO unit test for the property 'QueryMessage' + } + + /// + /// Test the property 'QueryPath' + /// + [Fact] + public void QueryPathTest() + { + // TODO unit test for the property 'QueryPath' + } + + /// + /// Test the property 'QueryRequestMethod' + /// + [Fact] + public void QueryRequestMethodTest() + { + // TODO unit test for the property 'QueryRequestMethod' + } + + /// + /// Test the property 'QueryRequestUrl' + /// + [Fact] + public void QueryRequestUrlTest() + { + // TODO unit test for the property 'QueryRequestUrl' + } + + /// + /// Test the property 'QueryStatus' + /// + [Fact] + public void QueryStatusTest() + { + // TODO unit test for the property 'QueryStatus' + } + + /// + /// Test the property 'QuerySuccess' + /// + [Fact] + public void QuerySuccessTest() + { + // TODO unit test for the property 'QuerySuccess' + } + + /// + /// Test the property 'ResultsUrl' + /// + [Fact] + public void ResultsUrlTest() + { + // TODO unit test for the property 'ResultsUrl' + } + + /// + /// Test the property 'StartAt' + /// + [Fact] + public void StartAtTest() + { + // TODO unit test for the property 'StartAt' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..05ce7e5830d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net8.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs new file mode 100644 index 000000000000..01bfb94ecedb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs @@ -0,0 +1,311 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAPIKEYSApi : IApi + { + /// + /// The class containing the events + /// + APIKEYSApiEvents Events { get; } + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <?> + Task GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IGetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class APIKEYSApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetApiKeysId_1; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetApiKeysId_1; + + internal void ExecuteOnGetApiKeysId_1(APIKEYSApi.GetApiKeysId_1ApiResponse apiResponse) + { + OnGetApiKeysId_1?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetApiKeysId_1(Exception exception) + { + OnErrorGetApiKeysId_1?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class APIKEYSApi : IAPIKEYSApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public APIKEYSApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public APIKEYSApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, APIKEYSApiEvents aPIKEYSApiEvents, + TokenProvider apiKeyProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = aPIKEYSApiEvents; + ApiKeyProvider = apiKeyProvider; + } + + partial void FormatGetApiKeysId_1(ref int id); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetApiKeysId_1DefaultImplementation(IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id) + { + bool suppressDefaultLog = false; + AfterGetApiKeysId_1(ref suppressDefaultLog, apiResponseLocalVar, id); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetApiKeysId_1(ref bool suppressDefaultLog, IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetApiKeysId_1DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetApiKeysId_1(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetApiKeysId_1(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); + + /// + /// Show API Key Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetApiKeysId_1Async(id, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Show API Key Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetApiKeysId_1(ref id); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetApiKeysId_1ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetApiKeysId_1DefaultImplementation(apiResponseLocalVar, id); + + Events.ExecuteOnGetApiKeysId_1(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetApiKeysId_1DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); + Events.ExecuteOnErrorGetApiKeysId_1(e); + throw; + } + } + + /// + /// The + /// + public partial class GetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_1ApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetApiKeysId_1ApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + 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); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs new file mode 100644 index 000000000000..01f8b7046396 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs @@ -0,0 +1,311 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAPIKeysApi : IApi + { + /// + /// The class containing the events + /// + APIKeysApiEvents Events { get; } + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <?> + Task GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IGetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class APIKeysApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetApiKeysId_0; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetApiKeysId_0; + + internal void ExecuteOnGetApiKeysId_0(APIKeysApi.GetApiKeysId_0ApiResponse apiResponse) + { + OnGetApiKeysId_0?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetApiKeysId_0(Exception exception) + { + OnErrorGetApiKeysId_0?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class APIKeysApi : IAPIKeysApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public APIKeysApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public APIKeysApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, APIKeysApiEvents aPIKeysApiEvents, + TokenProvider apiKeyProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = aPIKeysApiEvents; + ApiKeyProvider = apiKeyProvider; + } + + partial void FormatGetApiKeysId_0(ref int id); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetApiKeysId_0DefaultImplementation(IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id) + { + bool suppressDefaultLog = false; + AfterGetApiKeysId_0(ref suppressDefaultLog, apiResponseLocalVar, id); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetApiKeysId_0(ref bool suppressDefaultLog, IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetApiKeysId_0DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetApiKeysId_0(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetApiKeysId_0(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); + + /// + /// Show API Key Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetApiKeysId_0Async(id, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Show API Key Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetApiKeysId_0(ref id); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetApiKeysId_0ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetApiKeysId_0DefaultImplementation(apiResponseLocalVar, id); + + Events.ExecuteOnGetApiKeysId_0(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetApiKeysId_0DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); + Events.ExecuteOnErrorGetApiKeysId_0(e); + throw; + } + } + + /// + /// The + /// + public partial class GetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_0ApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetApiKeysId_0ApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + 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); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs new file mode 100644 index 000000000000..be13fa923c79 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs @@ -0,0 +1,311 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IApiKeysApi : IApi + { + /// + /// The class containing the events + /// + ApiKeysApiEvents Events { get; } + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <?> + Task GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IGetApiKeysIdApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class ApiKeysApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetApiKeysId; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetApiKeysId; + + internal void ExecuteOnGetApiKeysId(ApiKeysApi.GetApiKeysIdApiResponse apiResponse) + { + OnGetApiKeysId?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetApiKeysId(Exception exception) + { + OnErrorGetApiKeysId?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class ApiKeysApi : IApiKeysApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public ApiKeysApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiKeysApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, ApiKeysApiEvents apiKeysApiEvents, + TokenProvider apiKeyProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = apiKeysApiEvents; + ApiKeyProvider = apiKeyProvider; + } + + partial void FormatGetApiKeysId(ref int id); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetApiKeysIdDefaultImplementation(IGetApiKeysIdApiResponse apiResponseLocalVar, int id) + { + bool suppressDefaultLog = false; + AfterGetApiKeysId(ref suppressDefaultLog, apiResponseLocalVar, id); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetApiKeysId(ref bool suppressDefaultLog, IGetApiKeysIdApiResponse apiResponseLocalVar, int id); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetApiKeysIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetApiKeysId(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetApiKeysId(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); + + /// + /// Show API Key Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetApiKeysIdAsync(id, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Show API Key Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetApiKeysId(ref id); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); + + Events.ExecuteOnGetApiKeysId(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetApiKeysIdDefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); + Events.ExecuteOnErrorGetApiKeysId(e); + throw; + } + } + + /// + /// The + /// + public partial class GetApiKeysIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetApiKeysIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + 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); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..2e24a58ea04e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,53 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs new file mode 100644 index 000000000000..d0b10f69b91e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -0,0 +1,54 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an apiKey. + /// + public class ApiKeyToken : TokenBase + { + private string _raw; + + /// + /// The header that this token will be used with. + /// + public ClientUtils.ApiKeyHeader Header { get; } + + /// + /// Constructs an ApiKeyToken object. + /// + /// + /// + /// + /// + public ApiKeyToken(string value, ClientUtils.ApiKeyHeader header, string prefix = "Bearer ", TimeSpan? timeout = null) : base(timeout) + { + Header = header; + _raw = $"{ prefix }{ value }"; + } + + /// + /// Places the token in the header. + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request) + { + request.Headers.Add(ClientUtils.ApiKeyHeaderToString(Header), _raw); + } + + /// + /// Places the token in the query. + /// + /// + /// + /// + public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage request, UriBuilder uriBuilder, System.Collections.Specialized.NameValueCollection parseQueryString) + { + parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..faa5d765bedd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,153 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..adf46fb12a6e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,343 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// An enum of headers + /// + public enum ApiKeyHeader + { + /// + /// The XFilesAPIKey header + /// + XFilesAPIKey + } + + /// + /// Converte an ApiKeyHeader to a string + /// + /// + /// + /// + public static string ApiKeyHeaderToString(ApiKeyHeader value) + { + return value switch + { + ApiKeyHeader.XFilesAPIKey => "XFilesAPIKey", + _ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)), + }; + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://app.files.com/api/rest/v1"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = "/api/rest/v1"; + + /// + /// The host of the API + /// + public const string HOST = "app.files.com"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..2e5bda82ea8f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -0,0 +1,62 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..0ced717f3e38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -0,0 +1,67 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..fb959c7d7cc9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,76 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..454404eb8863 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,81 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..dcfab6678233 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExcepetionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..f8fa10ad1eff --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,140 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new ActionNotificationExportEntityJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..70193a99d42b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,54 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..7537f0872a27 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -0,0 +1,75 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + if (container is TokenContainer apiKeyTokenContainer) + { + string[] headers = apiKeyTokenContainer.Tokens.Select(t => ClientUtils.ApiKeyHeaderToString(t.Header)).Distinct().ToArray(); + + foreach (string header in headers) + { + BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(header, Channel.CreateBounded(options)); + } + } + else + { + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + } + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..19ecb6691081 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,45 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..b8dc385fbc5e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,44 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..63436ad65789 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,80 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..1366427b2e23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,64 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs new file mode 100644 index 000000000000..ab22c4749bcb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs @@ -0,0 +1,545 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ActionNotificationExportEntity model + /// + public partial class ActionNotificationExportEntity : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// End date/time of export range. + /// Version of the underlying records for the export. + /// History Export ID + /// Return notifications that were triggered by actions in this folder. + /// Error message associated with the request, if any. + /// Return notifications that were triggered by actions on this specific path. + /// The HTTP request method used by the webhook. + /// The target webhook URL. + /// The HTTP status returned from the server in response to the webhook request. + /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. + /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. + /// Start date/time of export range. + /// Status of export. Valid values: `building`, `ready`, or `failed` + [JsonConstructor] + public ActionNotificationExportEntity(Option endAt = default, Option exportVersion = default, Option id = default, Option queryFolder = default, Option queryMessage = default, Option queryPath = default, Option queryRequestMethod = default, Option queryRequestUrl = default, Option queryStatus = default, Option querySuccess = default, Option resultsUrl = default, Option startAt = default, Option status = default) + { + EndAtOption = endAt; + ExportVersionOption = exportVersion; + IdOption = id; + QueryFolderOption = queryFolder; + QueryMessageOption = queryMessage; + QueryPathOption = queryPath; + QueryRequestMethodOption = queryRequestMethod; + QueryRequestUrlOption = queryRequestUrl; + QueryStatusOption = queryStatus; + QuerySuccessOption = querySuccess; + ResultsUrlOption = resultsUrl; + StartAtOption = startAt; + StatusOption = status; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of EndAt + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EndAtOption { get; private set; } + + /// + /// End date/time of export range. + /// + /// End date/time of export range. + /* 2000-01-01T01:00Z */ + [JsonPropertyName("end_at")] + public DateTime? EndAt { get { return this.EndAtOption; } set { this.EndAtOption = new(value); } } + + /// + /// Used to track the state of ExportVersion + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ExportVersionOption { get; private set; } + + /// + /// Version of the underlying records for the export. + /// + /// Version of the underlying records for the export. + /* example */ + [JsonPropertyName("export_version")] + public string? ExportVersion { get { return this.ExportVersionOption; } set { this.ExportVersionOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// History Export ID + /// + /// History Export ID + /* 1 */ + [JsonPropertyName("id")] + public int? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of QueryFolder + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryFolderOption { get; private set; } + + /// + /// Return notifications that were triggered by actions in this folder. + /// + /// Return notifications that were triggered by actions in this folder. + /* MyFolder */ + [JsonPropertyName("query_folder")] + public string? QueryFolder { get { return this.QueryFolderOption; } set { this.QueryFolderOption = new(value); } } + + /// + /// Used to track the state of QueryMessage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryMessageOption { get; private set; } + + /// + /// Error message associated with the request, if any. + /// + /// Error message associated with the request, if any. + /* Connection Refused */ + [JsonPropertyName("query_message")] + public string? QueryMessage { get { return this.QueryMessageOption; } set { this.QueryMessageOption = new(value); } } + + /// + /// Used to track the state of QueryPath + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryPathOption { get; private set; } + + /// + /// Return notifications that were triggered by actions on this specific path. + /// + /// Return notifications that were triggered by actions on this specific path. + /* MyFile.txt */ + [JsonPropertyName("query_path")] + public string? QueryPath { get { return this.QueryPathOption; } set { this.QueryPathOption = new(value); } } + + /// + /// Used to track the state of QueryRequestMethod + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryRequestMethodOption { get; private set; } + + /// + /// The HTTP request method used by the webhook. + /// + /// The HTTP request method used by the webhook. + /* GET */ + [JsonPropertyName("query_request_method")] + public string? QueryRequestMethod { get { return this.QueryRequestMethodOption; } set { this.QueryRequestMethodOption = new(value); } } + + /// + /// Used to track the state of QueryRequestUrl + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryRequestUrlOption { get; private set; } + + /// + /// The target webhook URL. + /// + /// The target webhook URL. + /* http://example.com/webhook */ + [JsonPropertyName("query_request_url")] + public string? QueryRequestUrl { get { return this.QueryRequestUrlOption; } set { this.QueryRequestUrlOption = new(value); } } + + /// + /// Used to track the state of QueryStatus + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryStatusOption { get; private set; } + + /// + /// The HTTP status returned from the server in response to the webhook request. + /// + /// The HTTP status returned from the server in response to the webhook request. + /* 200 */ + [JsonPropertyName("query_status")] + public string? QueryStatus { get { return this.QueryStatusOption; } set { this.QueryStatusOption = new(value); } } + + /// + /// Used to track the state of QuerySuccess + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QuerySuccessOption { get; private set; } + + /// + /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. + /// + /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. + /* true */ + [JsonPropertyName("query_success")] + public bool? QuerySuccess { get { return this.QuerySuccessOption; } set { this.QuerySuccessOption = new(value); } } + + /// + /// Used to track the state of ResultsUrl + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ResultsUrlOption { get; private set; } + + /// + /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. + /// + /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. + /* https://files.com/action_notification_results.csv */ + [JsonPropertyName("results_url")] + public string? ResultsUrl { get { return this.ResultsUrlOption; } set { this.ResultsUrlOption = new(value); } } + + /// + /// Used to track the state of StartAt + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StartAtOption { get; private set; } + + /// + /// Start date/time of export range. + /// + /// Start date/time of export range. + /* 2000-01-01T01:00Z */ + [JsonPropertyName("start_at")] + public DateTime? StartAt { get { return this.StartAtOption; } set { this.StartAtOption = new(value); } } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// Status of export. Valid values: `building`, `ready`, or `failed` + /// + /// Status of export. Valid values: `building`, `ready`, or `failed` + /* ready */ + [JsonPropertyName("status")] + public string? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ActionNotificationExportEntity {\n"); + sb.Append(" EndAt: ").Append(EndAt).Append("\n"); + sb.Append(" ExportVersion: ").Append(ExportVersion).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" QueryFolder: ").Append(QueryFolder).Append("\n"); + sb.Append(" QueryMessage: ").Append(QueryMessage).Append("\n"); + sb.Append(" QueryPath: ").Append(QueryPath).Append("\n"); + sb.Append(" QueryRequestMethod: ").Append(QueryRequestMethod).Append("\n"); + sb.Append(" QueryRequestUrl: ").Append(QueryRequestUrl).Append("\n"); + sb.Append(" QueryStatus: ").Append(QueryStatus).Append("\n"); + sb.Append(" QuerySuccess: ").Append(QuerySuccess).Append("\n"); + sb.Append(" ResultsUrl: ").Append(ResultsUrl).Append("\n"); + sb.Append(" StartAt: ").Append(StartAt).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActionNotificationExportEntityJsonConverter : JsonConverter + { + /// + /// The format to use to serialize EndAt + /// + public static string EndAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize StartAt + /// + public static string StartAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ActionNotificationExportEntity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option endAt = default; + Option exportVersion = default; + Option id = default; + Option queryFolder = default; + Option queryMessage = default; + Option queryPath = default; + Option queryRequestMethod = default; + Option queryRequestUrl = default; + Option queryStatus = default; + Option querySuccess = default; + Option resultsUrl = default; + Option startAt = default; + Option status = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "end_at": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + endAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "export_version": + exportVersion = new Option(utf8JsonReader.GetString()!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt32()); + break; + case "query_folder": + queryFolder = new Option(utf8JsonReader.GetString()!); + break; + case "query_message": + queryMessage = new Option(utf8JsonReader.GetString()!); + break; + case "query_path": + queryPath = new Option(utf8JsonReader.GetString()!); + break; + case "query_request_method": + queryRequestMethod = new Option(utf8JsonReader.GetString()!); + break; + case "query_request_url": + queryRequestUrl = new Option(utf8JsonReader.GetString()!); + break; + case "query_status": + queryStatus = new Option(utf8JsonReader.GetString()!); + break; + case "query_success": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + querySuccess = new Option(utf8JsonReader.GetBoolean()); + break; + case "results_url": + resultsUrl = new Option(utf8JsonReader.GetString()!); + break; + case "start_at": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + startAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "status": + status = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (endAt.IsSet && endAt.Value == null) + throw new ArgumentNullException(nameof(endAt), "Property is not nullable for class ActionNotificationExportEntity."); + + if (exportVersion.IsSet && exportVersion.Value == null) + throw new ArgumentNullException(nameof(exportVersion), "Property is not nullable for class ActionNotificationExportEntity."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryFolder.IsSet && queryFolder.Value == null) + throw new ArgumentNullException(nameof(queryFolder), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryMessage.IsSet && queryMessage.Value == null) + throw new ArgumentNullException(nameof(queryMessage), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryPath.IsSet && queryPath.Value == null) + throw new ArgumentNullException(nameof(queryPath), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryRequestMethod.IsSet && queryRequestMethod.Value == null) + throw new ArgumentNullException(nameof(queryRequestMethod), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryRequestUrl.IsSet && queryRequestUrl.Value == null) + throw new ArgumentNullException(nameof(queryRequestUrl), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryStatus.IsSet && queryStatus.Value == null) + throw new ArgumentNullException(nameof(queryStatus), "Property is not nullable for class ActionNotificationExportEntity."); + + if (querySuccess.IsSet && querySuccess.Value == null) + throw new ArgumentNullException(nameof(querySuccess), "Property is not nullable for class ActionNotificationExportEntity."); + + if (resultsUrl.IsSet && resultsUrl.Value == null) + throw new ArgumentNullException(nameof(resultsUrl), "Property is not nullable for class ActionNotificationExportEntity."); + + if (startAt.IsSet && startAt.Value == null) + throw new ArgumentNullException(nameof(startAt), "Property is not nullable for class ActionNotificationExportEntity."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class ActionNotificationExportEntity."); + + return new ActionNotificationExportEntity(endAt, exportVersion, id, queryFolder, queryMessage, queryPath, queryRequestMethod, queryRequestUrl, queryStatus, querySuccess, resultsUrl, startAt, status); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, actionNotificationExportEntity, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) + { + if (actionNotificationExportEntity.ExportVersionOption.IsSet && actionNotificationExportEntity.ExportVersion == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.ExportVersion), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryFolderOption.IsSet && actionNotificationExportEntity.QueryFolder == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryFolder), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryMessageOption.IsSet && actionNotificationExportEntity.QueryMessage == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryMessage), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryPathOption.IsSet && actionNotificationExportEntity.QueryPath == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryPath), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet && actionNotificationExportEntity.QueryRequestMethod == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestMethod), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet && actionNotificationExportEntity.QueryRequestUrl == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestUrl), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryStatusOption.IsSet && actionNotificationExportEntity.QueryStatus == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryStatus), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.ResultsUrlOption.IsSet && actionNotificationExportEntity.ResultsUrl == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.ResultsUrl), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.StatusOption.IsSet && actionNotificationExportEntity.Status == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.Status), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.EndAtOption.IsSet) + writer.WriteString("end_at", actionNotificationExportEntity.EndAtOption.Value!.Value.ToString(EndAtFormat)); + + if (actionNotificationExportEntity.ExportVersionOption.IsSet) + writer.WriteString("export_version", actionNotificationExportEntity.ExportVersion); + + if (actionNotificationExportEntity.IdOption.IsSet) + writer.WriteNumber("id", actionNotificationExportEntity.IdOption.Value!.Value); + + if (actionNotificationExportEntity.QueryFolderOption.IsSet) + writer.WriteString("query_folder", actionNotificationExportEntity.QueryFolder); + + if (actionNotificationExportEntity.QueryMessageOption.IsSet) + writer.WriteString("query_message", actionNotificationExportEntity.QueryMessage); + + if (actionNotificationExportEntity.QueryPathOption.IsSet) + writer.WriteString("query_path", actionNotificationExportEntity.QueryPath); + + if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet) + writer.WriteString("query_request_method", actionNotificationExportEntity.QueryRequestMethod); + + if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet) + writer.WriteString("query_request_url", actionNotificationExportEntity.QueryRequestUrl); + + if (actionNotificationExportEntity.QueryStatusOption.IsSet) + writer.WriteString("query_status", actionNotificationExportEntity.QueryStatus); + + if (actionNotificationExportEntity.QuerySuccessOption.IsSet) + writer.WriteBoolean("query_success", actionNotificationExportEntity.QuerySuccessOption.Value!.Value); + + if (actionNotificationExportEntity.ResultsUrlOption.IsSet) + writer.WriteString("results_url", actionNotificationExportEntity.ResultsUrl); + + if (actionNotificationExportEntity.StartAtOption.IsSet) + writer.WriteString("start_at", actionNotificationExportEntity.StartAtOption.Value!.Value.ToString(StartAtFormat)); + + if (actionNotificationExportEntity.StatusOption.IsSet) + writer.WriteString("status", actionNotificationExportEntity.Status); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..9f99b6957b6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,31 @@ + + + + true + net8.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..1b9f504a56ef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md @@ -0,0 +1,190 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net8.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + GetApiKeysId_1ApiResponse apiResponse = await api.GetApiKeysId_1Async("todo"); + object model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + // the type of token here depends on the api security specifications + ApiKeyToken token = new("", ClientUtils.ApiKeyHeader.Authorization); + options.AddTokens(token); + + // optionally choose the method the tokens will be provided with, default is RateLimitProvider + options.UseProvider, ApiKeyToken>(); + + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### api_key + +- **Type**: API key +- **API key parameter name**: XFilesAPIKey +- **Location**: HTTP header + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.9.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: Files.com API +- appVersion: 0.0.1 +- appDescription: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net8.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. From 7f09d25875080f1eff8b7c220e7cedb4e500d812 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 29 Sep 2024 22:42:37 -0400 Subject: [PATCH 4/8] build samples again --- .../csharp/generichost/net8/Tags/.openapi-generator/FILES | 6 ------ 1 file changed, 6 deletions(-) diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES index ff9b2e64c1d0..2ef51ce0d61c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -10,12 +9,7 @@ docs/apis/ApiKeys1Api.md docs/models/ActionNotificationExportEntity.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh -src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs -src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs -src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs -src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs -src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/APIKEYSApi.cs From c2e3253e772c8c0abd8c7c0ea5dc614deef9e405 Mon Sep 17 00:00:00 2001 From: devhl Date: Fri, 4 Oct 2024 20:26:23 -0400 Subject: [PATCH 5/8] delete sample --- .../csharp/generichost/net8/Tags/.gitignore | 362 ------------ .../net8/Tags/.openapi-generator-ignore | 23 - .../net8/Tags/.openapi-generator/FILES | 43 -- .../net8/Tags/.openapi-generator/VERSION | 1 - .../net8/Tags/Org.OpenAPITools.sln | 27 - .../csharp/generichost/net8/Tags/README.md | 1 - .../generichost/net8/Tags/api/openapi.yaml | 141 ----- .../csharp/generichost/net8/Tags/appveyor.yml | 9 - .../net8/Tags/docs/apis/APIKEYSApi.md | 95 --- .../net8/Tags/docs/apis/APIKeys0Api.md | 95 --- .../net8/Tags/docs/apis/ApiKeys1Api.md | 95 --- .../models/ActionNotificationExportEntity.md | 23 - .../net8/Tags/docs/scripts/git_push.ps1 | 75 --- .../net8/Tags/docs/scripts/git_push.sh | 49 -- .../Api/APIKEYSApiTests.cs | 63 -- .../Api/APIKeys0ApiTests.cs | 63 -- .../Api/ApiKeys1ApiTests.cs | 63 -- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 61 -- .../Api/DependencyInjectionTests.cs | 132 ----- .../ActionNotificationExportEntityTests.cs | 174 ------ .../Org.OpenAPITools.Test.csproj | 20 - .../Tags/src/Org.OpenAPITools.Test/README.md | 0 .../src/Org.OpenAPITools/Api/APIKEYSApi.cs | 311 ---------- .../src/Org.OpenAPITools/Api/APIKeys0Api.cs | 311 ---------- .../src/Org.OpenAPITools/Api/ApiKeys1Api.cs | 311 ---------- .../Tags/src/Org.OpenAPITools/Api/IApi.cs | 15 - .../Org.OpenAPITools/Client/ApiException.cs | 53 -- .../src/Org.OpenAPITools/Client/ApiFactory.cs | 49 -- .../Org.OpenAPITools/Client/ApiKeyToken.cs | 54 -- .../Client/ApiResponseEventArgs.cs | 24 - .../Org.OpenAPITools/Client/ApiResponse`1.cs | 153 ----- .../Org.OpenAPITools/Client/ClientUtils.cs | 343 ----------- .../Client/CookieContainer.cs | 20 - .../Client/DateOnlyJsonConverter.cs | 62 -- .../Client/DateOnlyNullableJsonConverter.cs | 67 --- .../Client/DateTimeJsonConverter.cs | 76 --- .../Client/DateTimeNullableJsonConverter.cs | 81 --- .../Client/ExceptionEventArgs.cs | 24 - .../Client/HostConfiguration.cs | 140 ----- .../Client/JsonSerializerOptionsProvider.cs | 27 - .../src/Org.OpenAPITools/Client/Option.cs | 54 -- .../Client/RateLimitProvider`1.cs | 75 --- .../src/Org.OpenAPITools/Client/TokenBase.cs | 71 --- .../Client/TokenContainer`1.cs | 37 -- .../Client/TokenProvider`1.cs | 45 -- .../Extensions/IHostBuilderExtensions.cs | 44 -- .../IHttpClientBuilderExtensions.cs | 80 --- .../IServiceCollectionExtensions.cs | 64 -- .../Model/ActionNotificationExportEntity.cs | 545 ------------------ .../Org.OpenAPITools/Org.OpenAPITools.csproj | 31 - .../net8/Tags/src/Org.OpenAPITools/README.md | 190 ------ 51 files changed, 4972 deletions(-) delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.gitignore delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/README.md delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/README.md delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj delete mode 100644 samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.gitignore b/samples/client/petstore/csharp/generichost/net8/Tags/.gitignore deleted file mode 100644 index 1ee53850b84c..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/.gitignore +++ /dev/null @@ -1,362 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore deleted file mode 100644 index 7484ee590a38..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES deleted file mode 100644 index 2ef51ce0d61c..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/FILES +++ /dev/null @@ -1,43 +0,0 @@ -.gitignore -Org.OpenAPITools.sln -README.md -api/openapi.yaml -appveyor.yml -docs/apis/APIKEYSApi.md -docs/apis/APIKeys0Api.md -docs/apis/ApiKeys1Api.md -docs/models/ActionNotificationExportEntity.md -docs/scripts/git_push.ps1 -docs/scripts/git_push.sh -src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs -src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj -src/Org.OpenAPITools.Test/README.md -src/Org.OpenAPITools/Api/APIKEYSApi.cs -src/Org.OpenAPITools/Api/APIKeys0Api.cs -src/Org.OpenAPITools/Api/ApiKeys1Api.cs -src/Org.OpenAPITools/Api/IApi.cs -src/Org.OpenAPITools/Client/ApiException.cs -src/Org.OpenAPITools/Client/ApiFactory.cs -src/Org.OpenAPITools/Client/ApiKeyToken.cs -src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs -src/Org.OpenAPITools/Client/ApiResponse`1.cs -src/Org.OpenAPITools/Client/ClientUtils.cs -src/Org.OpenAPITools/Client/CookieContainer.cs -src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs -src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs -src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs -src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs -src/Org.OpenAPITools/Client/ExceptionEventArgs.cs -src/Org.OpenAPITools/Client/HostConfiguration.cs -src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs -src/Org.OpenAPITools/Client/Option.cs -src/Org.OpenAPITools/Client/RateLimitProvider`1.cs -src/Org.OpenAPITools/Client/TokenBase.cs -src/Org.OpenAPITools/Client/TokenContainer`1.cs -src/Org.OpenAPITools/Client/TokenProvider`1.cs -src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs -src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs -src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs -src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs -src/Org.OpenAPITools/Org.OpenAPITools.csproj -src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION deleted file mode 100644 index 17f2442ff3bc..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.9.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln deleted file mode 100644 index 5b15451c9dcf..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/Org.OpenAPITools.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -VisualStudioVersion = 12.0.0.0 -MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/README.md b/samples/client/petstore/csharp/generichost/net8/Tags/README.md deleted file mode 100644 index f9c1c7f74621..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/README.md +++ /dev/null @@ -1 +0,0 @@ -# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml deleted file mode 100644 index c943de9c72c0..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/api/openapi.yaml +++ /dev/null @@ -1,141 +0,0 @@ -openapi: 3.0.1 -info: - contact: - email: support@files.com - name: Files.com Customer Success Team - title: Files.com API - version: 0.0.1 -servers: -- url: //app.files.com/api/rest/v1 -tags: -- description: Operations about api_keys - name: api_key -- description: Operations about API Keys - name: API Keys -- description: Operations about API keys - name: a_p_i_k_e_y_s -paths: - /api_keys/{id}: - get: - description: Show API Key - operationId: GetApiKeysId - parameters: - - description: Api Key ID. - in: path - name: id - required: true - schema: - format: int32 - type: integer - x-ms-summary: Api Key ID. - x-ms-summary: Api Key ID. - responses: - "400": - content: {} - description: Bad Request - x-ms-summary: Bad Request - summary: Show API Key - tags: - - api_keys - - API Keys - - a_p_i_k_e_y_s - x-authentication: - - self_managed - x-category: - - developers -components: - schemas: - ActionNotificationExportEntity: - description: ActionNotificationExportEntity model - properties: - id: - description: History Export ID - example: 1 - format: int32 - type: integer - export_version: - description: Version of the underlying records for the export. - example: example - type: string - start_at: - description: Start date/time of export range. - example: 2000-01-01T01:00:00Z - format: date-time - type: string - end_at: - description: End date/time of export range. - example: 2000-01-01T01:00:00Z - format: date-time - type: string - status: - description: "Status of export. Valid values: `building`, `ready`, or `failed`" - example: ready - type: string - query_path: - description: Return notifications that were triggered by actions on this - specific path. - example: MyFile.txt - type: string - query_folder: - description: Return notifications that were triggered by actions in this - folder. - example: MyFolder - type: string - query_message: - description: "Error message associated with the request, if any." - example: Connection Refused - type: string - query_request_method: - description: The HTTP request method used by the webhook. - example: GET - type: string - query_request_url: - description: The target webhook URL. - example: http://example.com/webhook - type: string - query_status: - description: The HTTP status returned from the server in response to the - webhook request. - example: "200" - type: string - query_success: - description: true if the webhook request succeeded (i.e. returned a 200 - or 204 response status). false otherwise. - example: true - type: boolean - results_url: - description: "If `status` is `ready`, this will be a URL where all the results\ - \ can be downloaded at once as a CSV." - example: https://files.com/action_notification_results.csv - type: string - type: object - x-docs: | - An ActionNotificationExport is an operation that provides access to outgoing webhook logs. Querying webhook logs is a little different than other APIs. - - All queries against the archive must be submitted as Exports. (Even our Web UI creates an Export behind the scenes.) - - In any query field in this API, you may specify multiple values separated by commas. That means that commas - cannot be searched for themselves, and neither can single quotation marks. - - Use the following steps to complete an export: - - 1. Initiate the export by using the Create Action Notification Export endpoint. Non Site Admins must query by folder or path. - 2. Using the `id` from the response to step 1, poll the Show Action Notification Export endpoint. Check the `status` field until it is `ready`. - 3. You can download the results of the export as a CSV file using the `results_url` field in the response from step 2. If you want to page through the records in JSON format, use the List Action Notification Export Results endpoint, passing the `id` that you got in step 1 as the `action_notification_export_id` parameter. Check the `X-Files-Cursor-Next` header to see if there are more records available, and resubmit the same request with a `cursor` parameter to fetch the next page of results. Unlike most API Endpoints, this endpoint does not provide `X-Files-Cursor-Prev` cursors allowing reverse pagination through the results. This is due to limitations in Amazon Athena, the underlying data lake for these records. - - If you intend to use this API for high volume or automated use, please contact us with more information - about your use case. - - ## Example Queries - - * History for a folder: `{ "query_folder": "path/to/folder" }` - * History for a range of time: `{ "start_at": "2021-03-18 12:00:00", "end_at": "2021-03-19 12:00:00" }` - * History of all notifications that used GET or POST: `{ "query_request_method": "GET,POST" }` - securitySchemes: - api_key: - description: API Key - supports user-based or site-wide API keys - in: header - name: XFilesAPIKey - type: apiKey -x-original-swagger-version: "2.0" - diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml b/samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml deleted file mode 100644 index f76f63cee506..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/appveyor.yml +++ /dev/null @@ -1,9 +0,0 @@ -# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) -# -image: Visual Studio 2019 -clone_depth: 1 -build_script: -- dotnet build -c Release -- dotnet test -c Release -after_build: -- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md deleted file mode 100644 index bae5c9ea169d..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKEYSApi.md +++ /dev/null @@ -1,95 +0,0 @@ -# Org.OpenAPITools.Api.APIKEYSApi - -All URIs are relative to *http://app.files.com/api/rest/v1* - -| Method | HTTP request | Description | -|--------|--------------|-------------| -| [**GetApiKeysId_1**](APIKEYSApi.md#getapikeysid_1) | **GET** /api_keys/{id} | Show API Key | - - -# **GetApiKeysId_1** -> void GetApiKeysId_1 (int id) - -Show API Key - -Show API Key - -### 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 GetApiKeysId_1Example - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://app.files.com/api/rest/v1"; - var apiInstance = new APIKEYSApi(config); - var id = 56; // int | Api Key ID. - - try - { - // Show API Key - apiInstance.GetApiKeysId_1(id); - } - catch (ApiException e) - { - Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the GetApiKeysId_1WithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - // Show API Key - apiInstance.GetApiKeysId_1WithHttpInfo(id); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1WithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **id** | **int** | Api Key ID. | | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **400** | Bad Request | - | - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md deleted file mode 100644 index c0520bd8d8d0..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/APIKeys0Api.md +++ /dev/null @@ -1,95 +0,0 @@ -# Org.OpenAPITools.Api.APIKeysApi - -All URIs are relative to *http://app.files.com/api/rest/v1* - -| Method | HTTP request | Description | -|--------|--------------|-------------| -| [**GetApiKeysId_0**](APIKeysApi.md#getapikeysid_0) | **GET** /api_keys/{id} | Show API Key | - - -# **GetApiKeysId_0** -> void GetApiKeysId_0 (int id) - -Show API Key - -Show API Key - -### 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 GetApiKeysId_0Example - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://app.files.com/api/rest/v1"; - var apiInstance = new APIKeysApi(config); - var id = 56; // int | Api Key ID. - - try - { - // Show API Key - apiInstance.GetApiKeysId_0(id); - } - catch (ApiException e) - { - Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the GetApiKeysId_0WithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - // Show API Key - apiInstance.GetApiKeysId_0WithHttpInfo(id); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0WithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **id** | **int** | Api Key ID. | | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **400** | Bad Request | - | - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md deleted file mode 100644 index c87fce89ca00..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/docs/apis/ApiKeys1Api.md +++ /dev/null @@ -1,95 +0,0 @@ -# Org.OpenAPITools.Api.ApiKeysApi - -All URIs are relative to *http://app.files.com/api/rest/v1* - -| Method | HTTP request | Description | -|--------|--------------|-------------| -| [**GetApiKeysId**](ApiKeysApi.md#getapikeysid) | **GET** /api_keys/{id} | Show API Key | - - -# **GetApiKeysId** -> void GetApiKeysId (int id) - -Show API Key - -Show API Key - -### 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 GetApiKeysIdExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://app.files.com/api/rest/v1"; - var apiInstance = new ApiKeysApi(config); - var id = 56; // int | Api Key ID. - - try - { - // Show API Key - apiInstance.GetApiKeysId(id); - } - catch (ApiException e) - { - Debug.Print("Exception when calling ApiKeysApi.GetApiKeysId: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the GetApiKeysIdWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - // Show API Key - apiInstance.GetApiKeysIdWithHttpInfo(id); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling ApiKeysApi.GetApiKeysIdWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **id** | **int** | Api Key ID. | | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **400** | Bad Request | - | - -[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md b/samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md deleted file mode 100644 index c6730728c411..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/docs/models/ActionNotificationExportEntity.md +++ /dev/null @@ -1,23 +0,0 @@ -# Org.OpenAPITools.Model.ActionNotificationExportEntity -ActionNotificationExportEntity model - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**EndAt** | **DateTime** | End date/time of export range. | [optional] -**ExportVersion** | **string** | Version of the underlying records for the export. | [optional] -**Id** | **int** | History Export ID | [optional] -**QueryFolder** | **string** | Return notifications that were triggered by actions in this folder. | [optional] -**QueryMessage** | **string** | Error message associated with the request, if any. | [optional] -**QueryPath** | **string** | Return notifications that were triggered by actions on this specific path. | [optional] -**QueryRequestMethod** | **string** | The HTTP request method used by the webhook. | [optional] -**QueryRequestUrl** | **string** | The target webhook URL. | [optional] -**QueryStatus** | **string** | The HTTP status returned from the server in response to the webhook request. | [optional] -**QuerySuccess** | **bool** | true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. | [optional] -**ResultsUrl** | **string** | If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. | [optional] -**StartAt** | **DateTime** | Start date/time of export range. | [optional] -**Status** | **string** | Status of export. Valid values: `building`, `ready`, or `failed` | [optional] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 deleted file mode 100644 index 73ed35c2bb10..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.ps1 +++ /dev/null @@ -1,75 +0,0 @@ -param( - [Parameter()][Alias("g")][String]$GitHost = "github.com", - [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", - [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", - [Parameter()][Alias("m")][string]$Message = "Minor update", - [Parameter()][Alias("h")][switch]$Help -) - -function Publish-ToGitHost{ - if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ - # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user - $Message = Read-Host -Prompt "Please provide a commit message or press enter" - $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } - } - - git init - git add . - git commit -am "${Message}" - $branchName=$(git rev-parse --abbrev-ref HEAD) - $gitRemote=$(git remote) - - if([string]::IsNullOrWhiteSpace($gitRemote)){ - git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git - } - - Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" - git pull origin $branchName --ff-only - - if ($LastExitCode -ne 0){ - if (${GitHost} -eq "github.com"){ - Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." - gh auth login --hostname github.com --web - gh repo create $GitRepoId --private - # sleep 2 seconds to ensure git finishes creation of the repo - Start-Sleep -Seconds 2 - } - else{ - throw "There was an issue pulling the origin branch. The remote repository may not exist yet." - } - } - - Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" - git push origin $branchName -} - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 3.0 - -if ($Help){ - Write-Output " - This script will initialize a git repository, then add and commit all files. - The local repository will then be pushed to your preferred git provider. - If the remote repository does not exist yet and you are using GitHub, - the repository will be created for you provided you have the GitHub CLI installed. - - Parameters: - -g | -GitHost -> ex: github.com - -m | -Message -> the git commit message - -r | -GitRepoId -> the name of the repository - -u | -GitUserId -> your user id - " - - return -} - -$rootPath=Resolve-Path -Path $PSScriptRoot/../.. - -Push-Location $rootPath - -try { - Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message -} -finally{ - Pop-Location -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh deleted file mode 100644 index 882104922184..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/docs/scripts/git_push.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=${1:-GIT_USER_ID} -git_repo_id=${2:-GIT_REPO_ID} -release_note=${3:-Minor update} -git_host=${4:-github.com} - -starting_directory=$(pwd) -script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -cd $script_root -cd ../.. - -if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then - # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user - echo "Please provide a commit message or press enter" - read user_input - release_note=$user_input - if [ "$release_note" = "" ]; then - release_note="no message provided" - fi -fi - -git init -git add . -git commit -am "$release_note" -branch_name=$(git rev-parse --abbrev-ref HEAD) -git_remote=$(git remote) - -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" -git pull origin $branch_name --ff-only - -echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin $branch_name - -cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs deleted file mode 100644 index 75525420b629..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Xunit; -using Microsoft.Extensions.DependencyInjection; -using Org.OpenAPITools.Api; - - -/* ********************************************************************************* -* Follow these manual steps to construct tests. -* This file will not be overwritten. -* ********************************************************************************* -* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. -* Take care not to commit credentials to any repository. -* -* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. -* To mock the client, use the generic AddApiHttpClients. -* To mock the server, change the client's BaseAddress. -* -* 3. Locate the test you want below -* - remove the skip property from the Fact attribute -* - set the value of any variables if necessary -* -* 4. Run the tests and ensure they work. -* -*/ - - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Class for testing APIKEYSApi - /// - public sealed class APIKEYSApiTests : ApiTestsBase - { - private readonly IAPIKEYSApi _instance; - - public APIKEYSApiTests(): base(Array.Empty()) - { - _instance = _host.Services.GetRequiredService(); - } - - /// - /// Test GetApiKeysId_1 - /// - [Fact (Skip = "not implemented")] - public async Task GetApiKeysId_1AsyncTest() - { - int id = default!; - await _instance.GetApiKeysId_1Async(id); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs deleted file mode 100644 index b05a814880fb..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Xunit; -using Microsoft.Extensions.DependencyInjection; -using Org.OpenAPITools.Api; - - -/* ********************************************************************************* -* Follow these manual steps to construct tests. -* This file will not be overwritten. -* ********************************************************************************* -* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. -* Take care not to commit credentials to any repository. -* -* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. -* To mock the client, use the generic AddApiHttpClients. -* To mock the server, change the client's BaseAddress. -* -* 3. Locate the test you want below -* - remove the skip property from the Fact attribute -* - set the value of any variables if necessary -* -* 4. Run the tests and ensure they work. -* -*/ - - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Class for testing APIKeysApi - /// - public sealed class APIKeysApiTests : ApiTestsBase - { - private readonly IAPIKeysApi _instance; - - public APIKeysApiTests(): base(Array.Empty()) - { - _instance = _host.Services.GetRequiredService(); - } - - /// - /// Test GetApiKeysId_0 - /// - [Fact (Skip = "not implemented")] - public async Task GetApiKeysId_0AsyncTest() - { - int id = default!; - await _instance.GetApiKeysId_0Async(id); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs deleted file mode 100644 index c98aa9c063b0..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Xunit; -using Microsoft.Extensions.DependencyInjection; -using Org.OpenAPITools.Api; - - -/* ********************************************************************************* -* Follow these manual steps to construct tests. -* This file will not be overwritten. -* ********************************************************************************* -* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. -* Take care not to commit credentials to any repository. -* -* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. -* To mock the client, use the generic AddApiHttpClients. -* To mock the server, change the client's BaseAddress. -* -* 3. Locate the test you want below -* - remove the skip property from the Fact attribute -* - set the value of any variables if necessary -* -* 4. Run the tests and ensure they work. -* -*/ - - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Class for testing ApiKeysApi - /// - public sealed class ApiKeysApiTests : ApiTestsBase - { - private readonly IApiKeysApi _instance; - - public ApiKeysApiTests(): base(Array.Empty()) - { - _instance = _host.Services.GetRequiredService(); - } - - /// - /// Test GetApiKeysId - /// - [Fact (Skip = "not implemented")] - public async Task GetApiKeysIdAsyncTest() - { - int id = default!; - await _instance.GetApiKeysIdAsync(id); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs deleted file mode 100644 index fb1f2134be48..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Collections.Generic; -using System.Security.Cryptography; -using Microsoft.Extensions.Hosting; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Extensions; - - -/* ********************************************************************************* -* Follow these manual steps to construct tests. -* This file will not be overwritten. -* ********************************************************************************* -* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. -* Take care not to commit credentials to any repository. -* -* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. -* To mock the client, use the generic AddApiHttpClients. -* To mock the server, change the client's BaseAddress. -* -* 3. Locate the test you want below -* - remove the skip property from the Fact attribute -* - set the value of any variables if necessary -* -* 4. Run the tests and ensure they work. -* -*/ - - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Base class for API tests - /// - public class ApiTestsBase - { - protected readonly IHost _host; - - public ApiTestsBase(string[] args) - { - _host = CreateHostBuilder(args).Build(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) - .ConfigureApi((context, services, options) => - { - string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); - ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken1); - }); - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs deleted file mode 100644 index cc1119a79f4d..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System.Collections.Generic; -using System.Security.Cryptography; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Extensions; -using Xunit; - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Tests the dependency injection. - /// - public class DependencyInjectionTest - { - private readonly IHost _hostUsingConfigureWithoutAClient = - Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => - { - ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken1); - }) - .Build(); - - private readonly IHost _hostUsingConfigureWithAClient = - Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => - { - ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken1); - options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); - }) - .Build(); - - private readonly IHost _hostUsingAddWithoutAClient = - Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => - { - services.AddApi(options => - { - ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken1); - }); - }) - .Build(); - - private readonly IHost _hostUsingAddWithAClient = - Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => - { - services.AddApi(options => - { - ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(apiKeyToken1); - options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); - }); - }) - .Build(); - - /// - /// Test dependency injection when using the configure method - /// - [Fact] - public void ConfigureApiWithAClientTest() - { - var aPIKEYSApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); - Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); - - var aPIKeysApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); - Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); - - var apiKeysApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); - Assert.True(apiKeysApi.HttpClient.BaseAddress != null); - } - - /// - /// Test dependency injection when using the configure method - /// - [Fact] - public void ConfigureApiWithoutAClientTest() - { - var aPIKEYSApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); - Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); - - var aPIKeysApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); - Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); - - var apiKeysApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); - Assert.True(apiKeysApi.HttpClient.BaseAddress != null); - } - - /// - /// Test dependency injection when using the add method - /// - [Fact] - public void AddApiWithAClientTest() - { - var aPIKEYSApi = _hostUsingAddWithAClient.Services.GetRequiredService(); - Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); - - var aPIKeysApi = _hostUsingAddWithAClient.Services.GetRequiredService(); - Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); - - var apiKeysApi = _hostUsingAddWithAClient.Services.GetRequiredService(); - Assert.True(apiKeysApi.HttpClient.BaseAddress != null); - } - - /// - /// Test dependency injection when using the add method - /// - [Fact] - public void AddApiWithoutAClientTest() - { - var aPIKEYSApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); - Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); - - var aPIKeysApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); - Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); - - var apiKeysApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); - Assert.True(apiKeysApi.HttpClient.BaseAddress != null); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs deleted file mode 100644 index f78ea44cd286..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing ActionNotificationExportEntity - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class ActionNotificationExportEntityTests : IDisposable - { - // TODO uncomment below to declare an instance variable for ActionNotificationExportEntity - //private ActionNotificationExportEntity instance; - - public ActionNotificationExportEntityTests() - { - // TODO uncomment below to create an instance of ActionNotificationExportEntity - //instance = new ActionNotificationExportEntity(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of ActionNotificationExportEntity - /// - [Fact] - public void ActionNotificationExportEntityInstanceTest() - { - // TODO uncomment below to test "IsType" ActionNotificationExportEntity - //Assert.IsType(instance); - } - - /// - /// Test the property 'EndAt' - /// - [Fact] - public void EndAtTest() - { - // TODO unit test for the property 'EndAt' - } - - /// - /// Test the property 'ExportVersion' - /// - [Fact] - public void ExportVersionTest() - { - // TODO unit test for the property 'ExportVersion' - } - - /// - /// Test the property 'Id' - /// - [Fact] - public void IdTest() - { - // TODO unit test for the property 'Id' - } - - /// - /// Test the property 'QueryFolder' - /// - [Fact] - public void QueryFolderTest() - { - // TODO unit test for the property 'QueryFolder' - } - - /// - /// Test the property 'QueryMessage' - /// - [Fact] - public void QueryMessageTest() - { - // TODO unit test for the property 'QueryMessage' - } - - /// - /// Test the property 'QueryPath' - /// - [Fact] - public void QueryPathTest() - { - // TODO unit test for the property 'QueryPath' - } - - /// - /// Test the property 'QueryRequestMethod' - /// - [Fact] - public void QueryRequestMethodTest() - { - // TODO unit test for the property 'QueryRequestMethod' - } - - /// - /// Test the property 'QueryRequestUrl' - /// - [Fact] - public void QueryRequestUrlTest() - { - // TODO unit test for the property 'QueryRequestUrl' - } - - /// - /// Test the property 'QueryStatus' - /// - [Fact] - public void QueryStatusTest() - { - // TODO unit test for the property 'QueryStatus' - } - - /// - /// Test the property 'QuerySuccess' - /// - [Fact] - public void QuerySuccessTest() - { - // TODO unit test for the property 'QuerySuccess' - } - - /// - /// Test the property 'ResultsUrl' - /// - [Fact] - public void ResultsUrlTest() - { - // TODO unit test for the property 'ResultsUrl' - } - - /// - /// Test the property 'StartAt' - /// - [Fact] - public void StartAtTest() - { - // TODO unit test for the property 'StartAt' - } - - /// - /// Test the property 'Status' - /// - [Fact] - public void StatusTest() - { - // TODO unit test for the property 'Status' - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj deleted file mode 100644 index 05ce7e5830d8..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - Org.OpenAPITools.Test - Org.OpenAPITools.Test - net8.0 - false - enable - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools.Test/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs deleted file mode 100644 index 01bfb94ecedb..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs +++ /dev/null @@ -1,311 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections.Generic; -using System.Net; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text.Json; -using Org.OpenAPITools.Client; -using System.Diagnostics.CodeAnalysis; - -namespace Org.OpenAPITools.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// This class is registered as transient. - /// - public interface IAPIKEYSApi : IApi - { - /// - /// The class containing the events - /// - APIKEYSApiEvents Events { get; } - - /// - /// Show API Key - /// - /// - /// Show API Key - /// - /// Thrown when fails to make API call - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - Task GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Show API Key - /// - /// - /// Show API Key - /// - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <?> - Task GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); - } - - /// - /// The - /// - public interface IGetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.IApiResponse - { - /// - /// Returns true if the response is 400 BadRequest - /// - /// - bool IsBadRequest { get; } - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public class APIKEYSApiEvents - { - /// - /// The event raised after the server response - /// - public event EventHandler? OnGetApiKeysId_1; - - /// - /// The event raised after an error querying the server - /// - public event EventHandler? OnErrorGetApiKeysId_1; - - internal void ExecuteOnGetApiKeysId_1(APIKEYSApi.GetApiKeysId_1ApiResponse apiResponse) - { - OnGetApiKeysId_1?.Invoke(this, new ApiResponseEventArgs(apiResponse)); - } - - internal void ExecuteOnErrorGetApiKeysId_1(Exception exception) - { - OnErrorGetApiKeysId_1?.Invoke(this, new ExceptionEventArgs(exception)); - } - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public sealed partial class APIKEYSApi : IAPIKEYSApi - { - private JsonSerializerOptions _jsonSerializerOptions; - - /// - /// The logger factory - /// - public ILoggerFactory LoggerFactory { get; } - - /// - /// The logger - /// - public ILogger Logger { get; } - - /// - /// The HttpClient - /// - public HttpClient HttpClient { get; } - - /// - /// The class containing the events - /// - public APIKEYSApiEvents Events { get; } - - /// - /// A token provider of type - /// - public TokenProvider ApiKeyProvider { get; } - - /// - /// Initializes a new instance of the class. - /// - /// - public APIKEYSApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, APIKEYSApiEvents aPIKEYSApiEvents, - TokenProvider apiKeyProvider) - { - _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; - LoggerFactory = loggerFactory; - Logger = LoggerFactory.CreateLogger(); - HttpClient = httpClient; - Events = aPIKEYSApiEvents; - ApiKeyProvider = apiKeyProvider; - } - - partial void FormatGetApiKeysId_1(ref int id); - - /// - /// Processes the server response - /// - /// - /// - private void AfterGetApiKeysId_1DefaultImplementation(IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id) - { - bool suppressDefaultLog = false; - AfterGetApiKeysId_1(ref suppressDefaultLog, apiResponseLocalVar, id); - if (!suppressDefaultLog) - Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); - } - - /// - /// Processes the server response - /// - /// - /// - /// - partial void AfterGetApiKeysId_1(ref bool suppressDefaultLog, IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id); - - /// - /// Logs exceptions that occur while retrieving the server response - /// - /// - /// - /// - /// - private void OnErrorGetApiKeysId_1DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) - { - bool suppressDefaultLogLocalVar = false; - OnErrorGetApiKeysId_1(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); - if (!suppressDefaultLogLocalVar) - Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); - } - - /// - /// A partial method that gives developers a way to provide customized exception handling - /// - /// - /// - /// - /// - /// - partial void OnErrorGetApiKeysId_1(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); - - /// - /// Show API Key Show API Key - /// - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - public async Task GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) - { - try - { - return await GetApiKeysId_1Async(id, cancellationToken).ConfigureAwait(false); - } - catch (Exception) - { - return null; - } - } - - /// - /// Show API Key Show API Key - /// - /// Thrown when fails to make API call - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - public async Task GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default) - { - UriBuilder uriBuilderLocalVar = new UriBuilder(); - - try - { - FormatGetApiKeysId_1(ref id); - - using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) - { - uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; - uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; - uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; - uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; - uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); - - httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - - httpRequestMessageLocalVar.Method = HttpMethod.Get; - - DateTime requestedAtLocalVar = DateTime.UtcNow; - - using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) - { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - - GetApiKeysId_1ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); - - AfterGetApiKeysId_1DefaultImplementation(apiResponseLocalVar, id); - - Events.ExecuteOnGetApiKeysId_1(apiResponseLocalVar); - - return apiResponseLocalVar; - } - } - } - catch(Exception e) - { - OnErrorGetApiKeysId_1DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); - Events.ExecuteOnErrorGetApiKeysId_1(e); - throw; - } - } - - /// - /// The - /// - public partial class GetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_1ApiResponse - { - /// - /// The logger - /// - public ILogger Logger { get; } - - /// - /// The - /// - /// - /// - /// - /// - /// - /// - /// - public GetApiKeysId_1ApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) - { - Logger = logger; - OnCreated(httpRequestMessage, httpResponseMessage); - } - - partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); - - /// - /// Returns true if the response is 400 BadRequest - /// - /// - 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); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs deleted file mode 100644 index 01f8b7046396..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs +++ /dev/null @@ -1,311 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections.Generic; -using System.Net; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text.Json; -using Org.OpenAPITools.Client; -using System.Diagnostics.CodeAnalysis; - -namespace Org.OpenAPITools.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// This class is registered as transient. - /// - public interface IAPIKeysApi : IApi - { - /// - /// The class containing the events - /// - APIKeysApiEvents Events { get; } - - /// - /// Show API Key - /// - /// - /// Show API Key - /// - /// Thrown when fails to make API call - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - Task GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Show API Key - /// - /// - /// Show API Key - /// - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <?> - Task GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); - } - - /// - /// The - /// - public interface IGetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.IApiResponse - { - /// - /// Returns true if the response is 400 BadRequest - /// - /// - bool IsBadRequest { get; } - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public class APIKeysApiEvents - { - /// - /// The event raised after the server response - /// - public event EventHandler? OnGetApiKeysId_0; - - /// - /// The event raised after an error querying the server - /// - public event EventHandler? OnErrorGetApiKeysId_0; - - internal void ExecuteOnGetApiKeysId_0(APIKeysApi.GetApiKeysId_0ApiResponse apiResponse) - { - OnGetApiKeysId_0?.Invoke(this, new ApiResponseEventArgs(apiResponse)); - } - - internal void ExecuteOnErrorGetApiKeysId_0(Exception exception) - { - OnErrorGetApiKeysId_0?.Invoke(this, new ExceptionEventArgs(exception)); - } - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public sealed partial class APIKeysApi : IAPIKeysApi - { - private JsonSerializerOptions _jsonSerializerOptions; - - /// - /// The logger factory - /// - public ILoggerFactory LoggerFactory { get; } - - /// - /// The logger - /// - public ILogger Logger { get; } - - /// - /// The HttpClient - /// - public HttpClient HttpClient { get; } - - /// - /// The class containing the events - /// - public APIKeysApiEvents Events { get; } - - /// - /// A token provider of type - /// - public TokenProvider ApiKeyProvider { get; } - - /// - /// Initializes a new instance of the class. - /// - /// - public APIKeysApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, APIKeysApiEvents aPIKeysApiEvents, - TokenProvider apiKeyProvider) - { - _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; - LoggerFactory = loggerFactory; - Logger = LoggerFactory.CreateLogger(); - HttpClient = httpClient; - Events = aPIKeysApiEvents; - ApiKeyProvider = apiKeyProvider; - } - - partial void FormatGetApiKeysId_0(ref int id); - - /// - /// Processes the server response - /// - /// - /// - private void AfterGetApiKeysId_0DefaultImplementation(IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id) - { - bool suppressDefaultLog = false; - AfterGetApiKeysId_0(ref suppressDefaultLog, apiResponseLocalVar, id); - if (!suppressDefaultLog) - Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); - } - - /// - /// Processes the server response - /// - /// - /// - /// - partial void AfterGetApiKeysId_0(ref bool suppressDefaultLog, IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id); - - /// - /// Logs exceptions that occur while retrieving the server response - /// - /// - /// - /// - /// - private void OnErrorGetApiKeysId_0DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) - { - bool suppressDefaultLogLocalVar = false; - OnErrorGetApiKeysId_0(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); - if (!suppressDefaultLogLocalVar) - Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); - } - - /// - /// A partial method that gives developers a way to provide customized exception handling - /// - /// - /// - /// - /// - /// - partial void OnErrorGetApiKeysId_0(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); - - /// - /// Show API Key Show API Key - /// - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - public async Task GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) - { - try - { - return await GetApiKeysId_0Async(id, cancellationToken).ConfigureAwait(false); - } - catch (Exception) - { - return null; - } - } - - /// - /// Show API Key Show API Key - /// - /// Thrown when fails to make API call - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - public async Task GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default) - { - UriBuilder uriBuilderLocalVar = new UriBuilder(); - - try - { - FormatGetApiKeysId_0(ref id); - - using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) - { - uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; - uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; - uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; - uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; - uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); - - httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - - httpRequestMessageLocalVar.Method = HttpMethod.Get; - - DateTime requestedAtLocalVar = DateTime.UtcNow; - - using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) - { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - - GetApiKeysId_0ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); - - AfterGetApiKeysId_0DefaultImplementation(apiResponseLocalVar, id); - - Events.ExecuteOnGetApiKeysId_0(apiResponseLocalVar); - - return apiResponseLocalVar; - } - } - } - catch(Exception e) - { - OnErrorGetApiKeysId_0DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); - Events.ExecuteOnErrorGetApiKeysId_0(e); - throw; - } - } - - /// - /// The - /// - public partial class GetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_0ApiResponse - { - /// - /// The logger - /// - public ILogger Logger { get; } - - /// - /// The - /// - /// - /// - /// - /// - /// - /// - /// - public GetApiKeysId_0ApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) - { - Logger = logger; - OnCreated(httpRequestMessage, httpResponseMessage); - } - - partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); - - /// - /// Returns true if the response is 400 BadRequest - /// - /// - 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); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs deleted file mode 100644 index be13fa923c79..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs +++ /dev/null @@ -1,311 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections.Generic; -using System.Net; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Text.Json; -using Org.OpenAPITools.Client; -using System.Diagnostics.CodeAnalysis; - -namespace Org.OpenAPITools.Api -{ - /// - /// Represents a collection of functions to interact with the API endpoints - /// This class is registered as transient. - /// - public interface IApiKeysApi : IApi - { - /// - /// The class containing the events - /// - ApiKeysApiEvents Events { get; } - - /// - /// Show API Key - /// - /// - /// Show API Key - /// - /// Thrown when fails to make API call - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - Task GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Show API Key - /// - /// - /// Show API Key - /// - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <?> - Task GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); - } - - /// - /// The - /// - public interface IGetApiKeysIdApiResponse : Org.OpenAPITools.Client.IApiResponse - { - /// - /// Returns true if the response is 400 BadRequest - /// - /// - bool IsBadRequest { get; } - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public class ApiKeysApiEvents - { - /// - /// The event raised after the server response - /// - public event EventHandler? OnGetApiKeysId; - - /// - /// The event raised after an error querying the server - /// - public event EventHandler? OnErrorGetApiKeysId; - - internal void ExecuteOnGetApiKeysId(ApiKeysApi.GetApiKeysIdApiResponse apiResponse) - { - OnGetApiKeysId?.Invoke(this, new ApiResponseEventArgs(apiResponse)); - } - - internal void ExecuteOnErrorGetApiKeysId(Exception exception) - { - OnErrorGetApiKeysId?.Invoke(this, new ExceptionEventArgs(exception)); - } - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public sealed partial class ApiKeysApi : IApiKeysApi - { - private JsonSerializerOptions _jsonSerializerOptions; - - /// - /// The logger factory - /// - public ILoggerFactory LoggerFactory { get; } - - /// - /// The logger - /// - public ILogger Logger { get; } - - /// - /// The HttpClient - /// - public HttpClient HttpClient { get; } - - /// - /// The class containing the events - /// - public ApiKeysApiEvents Events { get; } - - /// - /// A token provider of type - /// - public TokenProvider ApiKeyProvider { get; } - - /// - /// Initializes a new instance of the class. - /// - /// - public ApiKeysApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, ApiKeysApiEvents apiKeysApiEvents, - TokenProvider apiKeyProvider) - { - _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; - LoggerFactory = loggerFactory; - Logger = LoggerFactory.CreateLogger(); - HttpClient = httpClient; - Events = apiKeysApiEvents; - ApiKeyProvider = apiKeyProvider; - } - - partial void FormatGetApiKeysId(ref int id); - - /// - /// Processes the server response - /// - /// - /// - private void AfterGetApiKeysIdDefaultImplementation(IGetApiKeysIdApiResponse apiResponseLocalVar, int id) - { - bool suppressDefaultLog = false; - AfterGetApiKeysId(ref suppressDefaultLog, apiResponseLocalVar, id); - if (!suppressDefaultLog) - Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); - } - - /// - /// Processes the server response - /// - /// - /// - /// - partial void AfterGetApiKeysId(ref bool suppressDefaultLog, IGetApiKeysIdApiResponse apiResponseLocalVar, int id); - - /// - /// Logs exceptions that occur while retrieving the server response - /// - /// - /// - /// - /// - private void OnErrorGetApiKeysIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) - { - bool suppressDefaultLogLocalVar = false; - OnErrorGetApiKeysId(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); - if (!suppressDefaultLogLocalVar) - Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); - } - - /// - /// A partial method that gives developers a way to provide customized exception handling - /// - /// - /// - /// - /// - /// - partial void OnErrorGetApiKeysId(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); - - /// - /// Show API Key Show API Key - /// - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - public async Task GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) - { - try - { - return await GetApiKeysIdAsync(id, cancellationToken).ConfigureAwait(false); - } - catch (Exception) - { - return null; - } - } - - /// - /// Show API Key Show API Key - /// - /// Thrown when fails to make API call - /// Api Key ID. - /// Cancellation Token to cancel the request. - /// <> - public async Task GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default) - { - UriBuilder uriBuilderLocalVar = new UriBuilder(); - - try - { - FormatGetApiKeysId(ref id); - - using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) - { - uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; - uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; - uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; - uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; - uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); - - httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - - httpRequestMessageLocalVar.Method = HttpMethod.Get; - - DateTime requestedAtLocalVar = DateTime.UtcNow; - - using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) - { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - - ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - - GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); - - AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); - - Events.ExecuteOnGetApiKeysId(apiResponseLocalVar); - - return apiResponseLocalVar; - } - } - } - catch(Exception e) - { - OnErrorGetApiKeysIdDefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); - Events.ExecuteOnErrorGetApiKeysId(e); - throw; - } - } - - /// - /// The - /// - public partial class GetApiKeysIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysIdApiResponse - { - /// - /// The logger - /// - public ILogger Logger { get; } - - /// - /// The - /// - /// - /// - /// - /// - /// - /// - /// - public GetApiKeysIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) - { - Logger = logger; - OnCreated(httpRequestMessage, httpResponseMessage); - } - - partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); - - /// - /// Returns true if the response is 400 BadRequest - /// - /// - 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); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs deleted file mode 100644 index 28520f043f2d..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Api/IApi.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Net.Http; - -namespace Org.OpenAPITools.Api -{ - /// - /// Any Api client - /// - public interface IApi - { - /// - /// The HttpClient - /// - HttpClient HttpClient { get; } - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs deleted file mode 100644 index 2e24a58ea04e..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiException.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; - -namespace Org.OpenAPITools.Client -{ - /// - /// API Exception - /// - public class ApiException : Exception - { - /// - /// The reason the api request failed - /// - public string? ReasonPhrase { get; } - - /// - /// The HttpStatusCode - /// - public System.Net.HttpStatusCode StatusCode { get; } - - /// - /// The raw data returned by the api - /// - public string RawContent { get; } - - /// - /// Construct the ApiException from parts of the response - /// - /// - /// - /// - public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) - { - ReasonPhrase = reasonPhrase; - - StatusCode = statusCode; - - RawContent = rawContent; - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs deleted file mode 100644 index b9b27c613f86..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using Microsoft.Extensions.DependencyInjection; -using Org.OpenAPITools.Api; - -namespace Org.OpenAPITools.Client -{ - /// - /// An IApiFactory interface - /// - public interface IApiFactory - { - /// - /// A method to create an IApi of type IResult - /// - /// - /// - IResult Create() where IResult : IApi; - } - - /// - /// An ApiFactory - /// - public class ApiFactory : IApiFactory - { - /// - /// The service provider - /// - public IServiceProvider Services { get; } - - /// - /// Initializes a new instance of the class. - /// - /// - public ApiFactory(IServiceProvider services) - { - Services = services; - } - - /// - /// A method to create an IApi of type IResult - /// - /// - /// - public IResult Create() where IResult : IApi - { - return Services.GetRequiredService(); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs deleted file mode 100644 index d0b10f69b91e..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs +++ /dev/null @@ -1,54 +0,0 @@ -// - -#nullable enable - -using System; - -namespace Org.OpenAPITools.Client -{ - /// - /// A token constructed from an apiKey. - /// - public class ApiKeyToken : TokenBase - { - private string _raw; - - /// - /// The header that this token will be used with. - /// - public ClientUtils.ApiKeyHeader Header { get; } - - /// - /// Constructs an ApiKeyToken object. - /// - /// - /// - /// - /// - public ApiKeyToken(string value, ClientUtils.ApiKeyHeader header, string prefix = "Bearer ", TimeSpan? timeout = null) : base(timeout) - { - Header = header; - _raw = $"{ prefix }{ value }"; - } - - /// - /// Places the token in the header. - /// - /// - public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request) - { - request.Headers.Add(ClientUtils.ApiKeyHeaderToString(Header), _raw); - } - - /// - /// Places the token in the query. - /// - /// - /// - /// - public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage request, UriBuilder uriBuilder, System.Collections.Specialized.NameValueCollection parseQueryString) - { - parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs deleted file mode 100644 index 3cb65e5adc0b..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Org.OpenAPITools.Client -{ - /// - /// Useful for tracking server health - /// - public class ApiResponseEventArgs : EventArgs - { - /// - /// The ApiResponse - /// - public ApiResponse ApiResponse { get; } - - /// - /// The ApiResponseEventArgs - /// - /// - public ApiResponseEventArgs(ApiResponse apiResponse) - { - ApiResponse = apiResponse; - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs deleted file mode 100644 index faa5d765bedd..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ /dev/null @@ -1,153 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Diagnostics.CodeAnalysis; -using System.Net; - -namespace Org.OpenAPITools.Client -{ - /// - /// Provides a non-generic contract for the ApiResponse wrapper. - /// - public partial interface IApiResponse - { - /// - /// The IsSuccessStatusCode from the api response - /// - bool IsSuccessStatusCode { get; } - - /// - /// Gets the status code (HTTP status code) - /// - /// The status code. - HttpStatusCode StatusCode { get; } - - /// - /// The raw content of this response. - /// - string RawContent { get; } - - /// - /// The DateTime when the request was retrieved. - /// - DateTime DownloadedAt { get; } - - /// - /// The headers contained in the api response - /// - System.Net.Http.Headers.HttpResponseHeaders Headers { get; } - - /// - /// The path used when making the request. - /// - string Path { get; } - - /// - /// The reason phrase contained in the api response - /// - string? ReasonPhrase { get; } - - /// - /// The DateTime when the request was sent. - /// - DateTime RequestedAt { get; } - - /// - /// The Uri used when making the request. - /// - Uri? RequestUri { get; } - } - - /// - /// API Response - /// - public partial class ApiResponse : IApiResponse - { - /// - /// Gets the status code (HTTP status code) - /// - /// The status code. - public HttpStatusCode StatusCode { get; } - - /// - /// The raw data - /// - public string RawContent { get; protected set; } - - /// - /// The IsSuccessStatusCode from the api response - /// - public bool IsSuccessStatusCode { get; } - - /// - /// The reason phrase contained in the api response - /// - public string? ReasonPhrase { get; } - - /// - /// The headers contained in the api response - /// - public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } - - /// - /// The DateTime when the request was retrieved. - /// - public DateTime DownloadedAt { get; } = DateTime.UtcNow; - - /// - /// The DateTime when the request was sent. - /// - public DateTime RequestedAt { get; } - - /// - /// The path used when making the request. - /// - public string Path { get; } - - /// - /// The Uri used when making the request. - /// - public Uri? RequestUri { get; } - - /// - /// The - /// - protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; - - /// - /// Construct the response using an HttpResponseMessage - /// - /// - /// - /// - /// - /// - /// - public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) - { - StatusCode = httpResponseMessage.StatusCode; - Headers = httpResponseMessage.Headers; - IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; - ReasonPhrase = httpResponseMessage.ReasonPhrase; - RawContent = rawContent; - Path = path; - RequestUri = httpRequestMessage.RequestUri; - RequestedAt = requestedAt; - _jsonSerializerOptions = jsonSerializerOptions; - OnCreated(httpRequestMessage, httpResponseMessage); - } - - partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs deleted file mode 100644 index adf46fb12a6e..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.IO; -using System.Linq; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using System.Text.RegularExpressions; -using Org.OpenAPITools.Model; -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] - -namespace Org.OpenAPITools.Client -{ - /// - /// Utility functions providing some benefit to API client consumers. - /// - public static class ClientUtils - { - - /// - /// A delegate for events. - /// - /// - /// - /// - /// - public delegate void EventHandler(object sender, T e) where T : EventArgs; - - /// - /// An enum of headers - /// - public enum ApiKeyHeader - { - /// - /// The XFilesAPIKey header - /// - XFilesAPIKey - } - - /// - /// Converte an ApiKeyHeader to a string - /// - /// - /// - /// - public static string ApiKeyHeaderToString(ApiKeyHeader value) - { - return value switch - { - ApiKeyHeader.XFilesAPIKey => "XFilesAPIKey", - _ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)), - }; - } - - /// - /// Returns true when deserialization succeeds. - /// - /// - /// - /// - /// - /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) - { - try - { - result = JsonSerializer.Deserialize(json, options); - return result != null; - } - catch (Exception) - { - result = default; - return false; - } - } - - /// - /// Returns true when deserialization succeeds. - /// - /// - /// - /// - /// - /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) - { - try - { - result = JsonSerializer.Deserialize(ref reader, options); - return result != null; - } - catch (Exception) - { - result = default; - return false; - } - } - - /// - /// Sanitize filename by removing the path - /// - /// Filename - /// Filename - public static string SanitizeFilename(string filename) - { - Match match = Regex.Match(filename, @".*[/\\](.*)$"); - return match.Success ? match.Groups[1].Value : filename; - } - - /// - /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. - /// If parameter is a list, join the list with ",". - /// Otherwise just return the string. - /// - /// The parameter (header, path, query, form). - /// The DateTime serialization format. - /// Formatted string. - public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) - { - if (obj is DateTime dateTime) - // Return a formatted date string - Can be customized with Configuration.DateTimeFormat - // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") - // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 - // For example: 2009-06-15T13:45:30.0000000 - return dateTime.ToString(format); - if (obj is DateTimeOffset dateTimeOffset) - // Return a formatted date string - Can be customized with Configuration.DateTimeFormat - // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") - // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 - // For example: 2009-06-15T13:45:30.0000000 - return dateTimeOffset.ToString(format); - if (obj is bool boolean) - return boolean - ? "true" - : "false"; - if (obj is ICollection collection) - { - List entries = new(); - foreach (var entry in collection) - entries.Add(ParameterToString(entry)); - return string.Join(",", entries); - } - - return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); - } - - /// - /// URL encode a string - /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 - /// - /// string to be URL encoded - /// Byte array - public static string UrlEncode(string input) - { - const int maxLength = 32766; - - if (input == null) - { - throw new ArgumentNullException("input"); - } - - if (input.Length <= maxLength) - { - return Uri.EscapeDataString(input); - } - - StringBuilder sb = new StringBuilder(input.Length * 2); - int index = 0; - - while (index < input.Length) - { - int length = Math.Min(input.Length - index, maxLength); - string subString = input.Substring(index, length); - - sb.Append(Uri.EscapeDataString(subString)); - index += subString.Length; - } - - return sb.ToString(); - } - - /// - /// Encode string in base64 format. - /// - /// string to be encoded. - /// Encoded string. - public static string Base64Encode(string text) - { - return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); - } - - /// - /// Convert stream to byte array - /// - /// Input stream to be converted - /// Byte array - public static byte[] ReadAsBytes(Stream inputStream) - { - using (var ms = new MemoryStream()) - { - inputStream.CopyTo(ms); - return ms.ToArray(); - } - } - - /// - /// Select the Content-Type header's value from the given content-type array: - /// if JSON type exists in the given array, use it; - /// otherwise use the first one defined in 'consumes' - /// - /// The Content-Type array to select from. - /// The Content-Type header to use. - public static string? SelectHeaderContentType(string[] contentTypes) - { - if (contentTypes.Length == 0) - return null; - - foreach (var contentType in contentTypes) - { - if (IsJsonMime(contentType)) - return contentType; - } - - return contentTypes[0]; // use the first content type specified in 'consumes' - } - - /// - /// Select the Accept header's value from the given accepts array: - /// if JSON exists in the given array, use it; - /// otherwise use all of them (joining into a string) - /// - /// The accepts array to select from. - /// The Accept header to use. - public static string? SelectHeaderAccept(string[] accepts) - { - if (accepts.Length == 0) - return null; - - if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) - return "application/json"; - - return string.Join(",", accepts); - } - - /// - /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. - /// - public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); - - /// - /// Check if the given MIME is a JSON MIME. - /// JSON MIME examples: - /// application/json - /// application/json; charset=UTF8 - /// APPLICATION/JSON - /// application/vnd.company+json - /// - /// MIME - /// Returns True if MIME type is json. - public static bool IsJsonMime(string mime) - { - if (string.IsNullOrWhiteSpace(mime)) return false; - - return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); - } - - /// - /// Get the discriminator - /// - /// - /// - /// - /// - public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) - { - int currentDepth = utf8JsonReader.CurrentDepth; - - if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) - throw new JsonException(); - - JsonTokenType startingTokenType = utf8JsonReader.TokenType; - - while (utf8JsonReader.Read()) - { - if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) - { - string? localVarJsonPropertyName = utf8JsonReader.GetString(); - utf8JsonReader.Read(); - - if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) - return utf8JsonReader.GetString(); - } - } - - throw new JsonException("The specified discriminator was not found."); - } - - /// - /// The base path of the API - /// - public const string BASE_ADDRESS = "http://app.files.com/api/rest/v1"; - - /// - /// The scheme of the API - /// - public const string SCHEME = "http"; - - /// - /// The context path of the API - /// - public const string CONTEXT_PATH = "/api/rest/v1"; - - /// - /// The host of the API - /// - public const string HOST = "app.files.com"; - - /// - /// The format to use for DateTime serialization - /// - public const string ISO8601_DATETIME_FORMAT = "o"; - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs deleted file mode 100644 index 85093b0c1fee..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs +++ /dev/null @@ -1,20 +0,0 @@ -// - -#nullable enable - -using System.Linq; -using System.Collections.Generic; - -namespace Org.OpenAPITools.Client -{ - /// - /// A class containing a CookieContainer - /// - public sealed class CookieContainer - { - /// - /// The collection of tokens - /// - public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs deleted file mode 100644 index 2e5bda82ea8f..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Globalization; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Org.OpenAPITools.Client -{ - /// - /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 - /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types - /// - public class DateOnlyJsonConverter : JsonConverter - { - /// - /// The formats used to deserialize the date - /// - public static string[] Formats { get; } = { - "yyyy'-'MM'-'dd", - "yyyyMMdd" - - }; - - /// - /// Returns a DateOnly from the Json object - /// - /// - /// - /// - /// - public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType == JsonTokenType.Null) - throw new NotSupportedException(); - - string value = reader.GetString()!; - - foreach(string format in Formats) - if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) - return result; - - throw new NotSupportedException(); - } - - /// - /// Writes the DateOnly to the json writer - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => - writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs deleted file mode 100644 index 0ced717f3e38..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Globalization; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Org.OpenAPITools.Client -{ - /// - /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 - /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types - /// - public class DateOnlyNullableJsonConverter : JsonConverter - { - /// - /// The formats used to deserialize the date - /// - public static string[] Formats { get; } = { - "yyyy'-'MM'-'dd", - "yyyyMMdd" - - }; - - /// - /// Returns a DateOnly from the Json object - /// - /// - /// - /// - /// - public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType == JsonTokenType.Null) - return null; - - string value = reader.GetString()!; - - foreach(string format in Formats) - if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) - return result; - - throw new NotSupportedException(); - } - - /// - /// Writes the DateOnly to the json writer - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) - { - if (dateOnlyValue == null) - writer.WriteNullValue(); - else - writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs deleted file mode 100644 index fb959c7d7cc9..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Globalization; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Org.OpenAPITools.Client -{ - /// - /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 - /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types - /// - public class DateTimeJsonConverter : JsonConverter - { - /// - /// The formats used to deserialize the date - /// - public static string[] Formats { get; } = { - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", - "yyyyMMddTHHmmss.fffffffK", - "yyyyMMddTHHmmss.ffffffK", - "yyyyMMddTHHmmss.fffffK", - "yyyyMMddTHHmmss.ffffK", - "yyyyMMddTHHmmss.fffK", - "yyyyMMddTHHmmss.ffK", - "yyyyMMddTHHmmss.fK", - "yyyyMMddTHHmmssK", - - }; - - /// - /// Returns a DateTime from the Json object - /// - /// - /// - /// - /// - public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType == JsonTokenType.Null) - throw new NotSupportedException(); - - string value = reader.GetString()!; - - foreach(string format in Formats) - if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) - return result; - - throw new NotSupportedException(); - } - - /// - /// Writes the DateTime to the json writer - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => - writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs deleted file mode 100644 index 454404eb8863..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Globalization; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Org.OpenAPITools.Client -{ - /// - /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 - /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types - /// - public class DateTimeNullableJsonConverter : JsonConverter - { - /// - /// The formats used to deserialize the date - /// - public static string[] Formats { get; } = { - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", - "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", - "yyyyMMddTHHmmss.fffffffK", - "yyyyMMddTHHmmss.ffffffK", - "yyyyMMddTHHmmss.fffffK", - "yyyyMMddTHHmmss.ffffK", - "yyyyMMddTHHmmss.fffK", - "yyyyMMddTHHmmss.ffK", - "yyyyMMddTHHmmss.fK", - "yyyyMMddTHHmmssK", - - }; - - /// - /// Returns a DateTime from the Json object - /// - /// - /// - /// - /// - public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - if (reader.TokenType == JsonTokenType.Null) - return null; - - string value = reader.GetString()!; - - foreach(string format in Formats) - if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) - return result; - - return null; - } - - /// - /// Writes the DateTime to the json writer - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) - { - if (dateTimeValue == null) - writer.WriteNullValue(); - else - writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs deleted file mode 100644 index dcfab6678233..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace Org.OpenAPITools.Client -{ - /// - /// Useful for tracking server health - /// - public class ExceptionEventArgs : EventArgs - { - /// - /// The ApiResponse - /// - public Exception Exception { get; } - - /// - /// The ExcepetionEventArgs - /// - /// - public ExceptionEventArgs(Exception exception) - { - Exception = exception; - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs deleted file mode 100644 index f8fa10ad1eff..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Net.Http; -using Microsoft.Extensions.DependencyInjection; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Client -{ - /// - /// Provides hosting configuration for Org.OpenAPITools - /// - public class HostConfiguration - { - private readonly IServiceCollection _services; - private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); - - internal bool HttpClientsAdded { get; private set; } - - /// - /// Instantiates the class - /// - /// - public HostConfiguration(IServiceCollection services) - { - _services = services; - _jsonOptions.Converters.Add(new JsonStringEnumConverter()); - _jsonOptions.Converters.Add(new DateTimeJsonConverter()); - _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); - _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); - _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); - _jsonOptions.Converters.Add(new ActionNotificationExportEntityJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); - _services.AddSingleton(jsonSerializerOptionsProvider); - _services.AddSingleton(); - _services.AddSingleton(); - _services.AddTransient(); - _services.AddSingleton(); - _services.AddTransient(); - _services.AddSingleton(); - _services.AddTransient(); - } - - /// - /// Configures the HttpClients. - /// - /// - /// - /// - public HostConfiguration AddApiHttpClients - ( - Action? client = null, Action? builder = null) - { - if (client == null) - client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); - - List builders = new List(); - - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - builders.Add(_services.AddHttpClient(client)); - - if (builder != null) - foreach (IHttpClientBuilder instance in builders) - builder(instance); - - HttpClientsAdded = true; - - return this; - } - - /// - /// Configures the JsonSerializerSettings - /// - /// - /// - public HostConfiguration ConfigureJsonOptions(Action options) - { - options(_jsonOptions); - - return this; - } - - /// - /// Adds tokens to your IServiceCollection - /// - /// - /// - /// - public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase - { - return AddTokens(new TTokenBase[]{ token }); - } - - /// - /// Adds tokens to your IServiceCollection - /// - /// - /// - /// - public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase - { - TokenContainer container = new TokenContainer(tokens); - _services.AddSingleton(services => container); - - return this; - } - - /// - /// Adds a token provider to your IServiceCollection - /// - /// - /// - /// - public HostConfiguration UseProvider() - where TTokenProvider : TokenProvider - where TTokenBase : TokenBase - { - _services.AddSingleton(); - _services.AddSingleton>(services => services.GetRequiredService()); - - return this; - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs deleted file mode 100644 index 0184d9ad9446..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +++ /dev/null @@ -1,27 +0,0 @@ -// - -#nullable enable - -using System.Text.Json; - -namespace Org.OpenAPITools.Client -{ - /// - /// Provides the JsonSerializerOptions - /// - public class JsonSerializerOptionsProvider - { - /// - /// the JsonSerializerOptions - /// - public JsonSerializerOptions Options { get; } - - /// - /// Instantiates a JsonSerializerOptionsProvider - /// - public JsonSerializerOptionsProvider(JsonSerializerOptions options) - { - Options = options; - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs deleted file mode 100644 index 70193a99d42b..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/Option.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - - -namespace Org.OpenAPITools.Client -{ - /// - /// A wrapper for operation parameters which are not required - /// - public struct Option - { - /// - /// The value to send to the server - /// - public TType Value { get; } - - /// - /// When true the value will be sent to the server - /// - internal bool IsSet { get; } - - /// - /// A wrapper for operation parameters which are not required - /// - /// - public Option(TType value) - { - IsSet = true; - Value = value; - } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option option) => option.Value; - - /// - /// Implicitly converts the provided value to an Option - /// - /// - public static implicit operator Option(TType value) => new Option(value); - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs deleted file mode 100644 index 7537f0872a27..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Channels; - -namespace Org.OpenAPITools.Client -{ - /// - /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. - /// - /// - public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase - { - internal Dictionary> AvailableTokens { get; } = new(); - - /// - /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. - /// - /// - public RateLimitProvider(TokenContainer container) : base(container.Tokens) - { - foreach(TTokenBase token in _tokens) - token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); - - if (container is TokenContainer apiKeyTokenContainer) - { - string[] headers = apiKeyTokenContainer.Tokens.Select(t => ClientUtils.ApiKeyHeaderToString(t.Header)).Distinct().ToArray(); - - foreach (string header in headers) - { - BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) - { - FullMode = BoundedChannelFullMode.DropWrite - }; - - AvailableTokens.Add(header, Channel.CreateBounded(options)); - } - } - else - { - BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) - { - FullMode = BoundedChannelFullMode.DropWrite - }; - - AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); - } - - foreach(Channel tokens in AvailableTokens.Values) - for (int i = 0; i < _tokens.Length; i++) - _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); - } - - internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) - { - if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) - throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); - - return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs deleted file mode 100644 index 3f713a2ef4bb..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenBase.cs +++ /dev/null @@ -1,71 +0,0 @@ -// - -#nullable enable - -using System; - -namespace Org.OpenAPITools.Client -{ - /// - /// The base for all tokens. - /// - public abstract class TokenBase - { - private DateTime _nextAvailable = DateTime.UtcNow; - private object _nextAvailableLock = new object(); - private readonly System.Timers.Timer _timer = new System.Timers.Timer(); - - - internal TimeSpan? Timeout { get; set; } - internal delegate void TokenBecameAvailableEventHandler(object sender); - internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; - - - /// - /// Initialize a TokenBase object. - /// - /// - internal TokenBase(TimeSpan? timeout = null) - { - Timeout = timeout; - - if (Timeout != null) - StartTimer(Timeout.Value); - } - - - /// - /// Starts the token's timer - /// - /// - internal void StartTimer(TimeSpan timeout) - { - Timeout = timeout; - _timer.Interval = Timeout.Value.TotalMilliseconds; - _timer.Elapsed += OnTimer; - _timer.AutoReset = true; - _timer.Start(); - } - - /// - /// Returns true while the token is rate limited. - /// - public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; - - /// - /// Triggered when the server returns status code TooManyRequests - /// Once triggered the local timeout will be extended an arbitrary length of time. - /// - public void BeginRateLimit() - { - lock(_nextAvailableLock) - _nextAvailable = DateTime.UtcNow.AddSeconds(5); - } - - private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) - { - if (TokenBecameAvailable != null && !IsRateLimited) - TokenBecameAvailable.Invoke(this); - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs deleted file mode 100644 index 7b0f23d28a4e..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs +++ /dev/null @@ -1,37 +0,0 @@ -// - -#nullable enable - -using System.Linq; -using System.Collections.Generic; - -namespace Org.OpenAPITools.Client -{ - /// - /// A container for a collection of tokens. - /// - /// - public sealed class TokenContainer where TTokenBase : TokenBase - { - /// - /// The collection of tokens - /// - public List Tokens { get; } = new List(); - - /// - /// Instantiates a TokenContainer - /// - public TokenContainer() - { - } - - /// - /// Instantiates a TokenContainer - /// - /// - public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) - { - Tokens = tokens.ToList(); - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs deleted file mode 100644 index 19ecb6691081..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Linq; -using System.Collections.Generic; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools -{ - /// - /// A class which will provide tokens. - /// - public abstract class TokenProvider where TTokenBase : TokenBase - { - /// - /// The array of tokens. - /// - protected TTokenBase[] _tokens; - - internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); - - /// - /// Instantiates a TokenProvider. - /// - /// - public TokenProvider(IEnumerable tokens) - { - _tokens = tokens.ToArray(); - - if (_tokens.Length == 0) - throw new ArgumentException("You did not provide any tokens."); - } - } -} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs deleted file mode 100644 index b8dc385fbc5e..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools.Extensions -{ - /// - /// Extension methods for IHostBuilder - /// - public static class IHostBuilderExtensions - { - /// - /// Add the api to your host builder. - /// - /// - /// - public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) - { - builder.ConfigureServices((context, services) => - { - HostConfiguration config = new HostConfiguration(services); - - options(context, services, config); - - IServiceCollectionExtensions.AddApi(services, config); - }); - - return builder; - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs deleted file mode 100644 index 63436ad65789..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Net.Http; -using Microsoft.Extensions.DependencyInjection; -using Polly.Timeout; -using Polly.Extensions.Http; -using Polly; - -namespace Org.OpenAPITools.Extensions -{ - /// - /// Extension methods for IHttpClientBuilder - /// - public static class IHttpClientBuilderExtensions - { - /// - /// Adds a Polly retry policy to your clients. - /// - /// - /// - /// - public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) - { - client.AddPolicyHandler(RetryPolicy(retries)); - - return client; - } - - /// - /// Adds a Polly timeout policy to your clients. - /// - /// - /// - /// - public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) - { - client.AddPolicyHandler(TimeoutPolicy(timeout)); - - return client; - } - - /// - /// Adds a Polly circuit breaker to your clients. - /// - /// - /// - /// - /// - public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) - { - client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); - - return client; - } - - private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) - => HttpPolicyExtensions - .HandleTransientHttpError() - .Or() - .RetryAsync(retries); - - private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) - => Policy.TimeoutAsync(timeout); - - private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( - PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) - => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs deleted file mode 100644 index 1366427b2e23..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Linq; -using Microsoft.Extensions.DependencyInjection; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools.Extensions -{ - /// - /// Extension methods for IServiceCollection - /// - public static class IServiceCollectionExtensions - { - /// - /// Add the api to your host builder. - /// - /// - /// - public static void AddApi(this IServiceCollection services, Action options) - { - HostConfiguration config = new(services); - options(config); - AddApi(services, config); - } - - internal static void AddApi(IServiceCollection services, HostConfiguration host) - { - if (!host.HttpClientsAdded) - host.AddApiHttpClients(); - - services.AddSingleton(); - - // ensure that a token provider was provided for this token type - // if not, default to RateLimitProvider - var containerServices = services.Where(s => s.ServiceType.IsGenericType && - s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); - - foreach(var containerService in containerServices) - { - var tokenType = containerService.ServiceType.GenericTypeArguments[0]; - - var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); - - if (provider == null) - { - services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); - services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), - s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); - } - } - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs deleted file mode 100644 index ab22c4749bcb..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs +++ /dev/null @@ -1,545 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.ComponentModel.DataAnnotations; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools.Model -{ - /// - /// ActionNotificationExportEntity model - /// - public partial class ActionNotificationExportEntity : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// End date/time of export range. - /// Version of the underlying records for the export. - /// History Export ID - /// Return notifications that were triggered by actions in this folder. - /// Error message associated with the request, if any. - /// Return notifications that were triggered by actions on this specific path. - /// The HTTP request method used by the webhook. - /// The target webhook URL. - /// The HTTP status returned from the server in response to the webhook request. - /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. - /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. - /// Start date/time of export range. - /// Status of export. Valid values: `building`, `ready`, or `failed` - [JsonConstructor] - public ActionNotificationExportEntity(Option endAt = default, Option exportVersion = default, Option id = default, Option queryFolder = default, Option queryMessage = default, Option queryPath = default, Option queryRequestMethod = default, Option queryRequestUrl = default, Option queryStatus = default, Option querySuccess = default, Option resultsUrl = default, Option startAt = default, Option status = default) - { - EndAtOption = endAt; - ExportVersionOption = exportVersion; - IdOption = id; - QueryFolderOption = queryFolder; - QueryMessageOption = queryMessage; - QueryPathOption = queryPath; - QueryRequestMethodOption = queryRequestMethod; - QueryRequestUrlOption = queryRequestUrl; - QueryStatusOption = queryStatus; - QuerySuccessOption = querySuccess; - ResultsUrlOption = resultsUrl; - StartAtOption = startAt; - StatusOption = status; - OnCreated(); - } - - partial void OnCreated(); - - /// - /// Used to track the state of EndAt - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option EndAtOption { get; private set; } - - /// - /// End date/time of export range. - /// - /// End date/time of export range. - /* 2000-01-01T01:00Z */ - [JsonPropertyName("end_at")] - public DateTime? EndAt { get { return this.EndAtOption; } set { this.EndAtOption = new(value); } } - - /// - /// Used to track the state of ExportVersion - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option ExportVersionOption { get; private set; } - - /// - /// Version of the underlying records for the export. - /// - /// Version of the underlying records for the export. - /* example */ - [JsonPropertyName("export_version")] - public string? ExportVersion { get { return this.ExportVersionOption; } set { this.ExportVersionOption = new(value); } } - - /// - /// Used to track the state of Id - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option IdOption { get; private set; } - - /// - /// History Export ID - /// - /// History Export ID - /* 1 */ - [JsonPropertyName("id")] - public int? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } - - /// - /// Used to track the state of QueryFolder - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryFolderOption { get; private set; } - - /// - /// Return notifications that were triggered by actions in this folder. - /// - /// Return notifications that were triggered by actions in this folder. - /* MyFolder */ - [JsonPropertyName("query_folder")] - public string? QueryFolder { get { return this.QueryFolderOption; } set { this.QueryFolderOption = new(value); } } - - /// - /// Used to track the state of QueryMessage - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryMessageOption { get; private set; } - - /// - /// Error message associated with the request, if any. - /// - /// Error message associated with the request, if any. - /* Connection Refused */ - [JsonPropertyName("query_message")] - public string? QueryMessage { get { return this.QueryMessageOption; } set { this.QueryMessageOption = new(value); } } - - /// - /// Used to track the state of QueryPath - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryPathOption { get; private set; } - - /// - /// Return notifications that were triggered by actions on this specific path. - /// - /// Return notifications that were triggered by actions on this specific path. - /* MyFile.txt */ - [JsonPropertyName("query_path")] - public string? QueryPath { get { return this.QueryPathOption; } set { this.QueryPathOption = new(value); } } - - /// - /// Used to track the state of QueryRequestMethod - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryRequestMethodOption { get; private set; } - - /// - /// The HTTP request method used by the webhook. - /// - /// The HTTP request method used by the webhook. - /* GET */ - [JsonPropertyName("query_request_method")] - public string? QueryRequestMethod { get { return this.QueryRequestMethodOption; } set { this.QueryRequestMethodOption = new(value); } } - - /// - /// Used to track the state of QueryRequestUrl - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryRequestUrlOption { get; private set; } - - /// - /// The target webhook URL. - /// - /// The target webhook URL. - /* http://example.com/webhook */ - [JsonPropertyName("query_request_url")] - public string? QueryRequestUrl { get { return this.QueryRequestUrlOption; } set { this.QueryRequestUrlOption = new(value); } } - - /// - /// Used to track the state of QueryStatus - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryStatusOption { get; private set; } - - /// - /// The HTTP status returned from the server in response to the webhook request. - /// - /// The HTTP status returned from the server in response to the webhook request. - /* 200 */ - [JsonPropertyName("query_status")] - public string? QueryStatus { get { return this.QueryStatusOption; } set { this.QueryStatusOption = new(value); } } - - /// - /// Used to track the state of QuerySuccess - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QuerySuccessOption { get; private set; } - - /// - /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. - /// - /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. - /* true */ - [JsonPropertyName("query_success")] - public bool? QuerySuccess { get { return this.QuerySuccessOption; } set { this.QuerySuccessOption = new(value); } } - - /// - /// Used to track the state of ResultsUrl - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option ResultsUrlOption { get; private set; } - - /// - /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. - /// - /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. - /* https://files.com/action_notification_results.csv */ - [JsonPropertyName("results_url")] - public string? ResultsUrl { get { return this.ResultsUrlOption; } set { this.ResultsUrlOption = new(value); } } - - /// - /// Used to track the state of StartAt - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option StartAtOption { get; private set; } - - /// - /// Start date/time of export range. - /// - /// Start date/time of export range. - /* 2000-01-01T01:00Z */ - [JsonPropertyName("start_at")] - public DateTime? StartAt { get { return this.StartAtOption; } set { this.StartAtOption = new(value); } } - - /// - /// Used to track the state of Status - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option StatusOption { get; private set; } - - /// - /// Status of export. Valid values: `building`, `ready`, or `failed` - /// - /// Status of export. Valid values: `building`, `ready`, or `failed` - /* ready */ - [JsonPropertyName("status")] - public string? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ActionNotificationExportEntity {\n"); - sb.Append(" EndAt: ").Append(EndAt).Append("\n"); - sb.Append(" ExportVersion: ").Append(ExportVersion).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" QueryFolder: ").Append(QueryFolder).Append("\n"); - sb.Append(" QueryMessage: ").Append(QueryMessage).Append("\n"); - sb.Append(" QueryPath: ").Append(QueryPath).Append("\n"); - sb.Append(" QueryRequestMethod: ").Append(QueryRequestMethod).Append("\n"); - sb.Append(" QueryRequestUrl: ").Append(QueryRequestUrl).Append("\n"); - sb.Append(" QueryStatus: ").Append(QueryStatus).Append("\n"); - sb.Append(" QuerySuccess: ").Append(QuerySuccess).Append("\n"); - sb.Append(" ResultsUrl: ").Append(ResultsUrl).Append("\n"); - sb.Append(" StartAt: ").Append(StartAt).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - - /// - /// A Json converter for type - /// - public class ActionNotificationExportEntityJsonConverter : JsonConverter - { - /// - /// The format to use to serialize EndAt - /// - public static string EndAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize StartAt - /// - public static string StartAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// Deserializes json to - /// - /// - /// - /// - /// - /// - public override ActionNotificationExportEntity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) - { - int currentDepth = utf8JsonReader.CurrentDepth; - - if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) - throw new JsonException(); - - JsonTokenType startingTokenType = utf8JsonReader.TokenType; - - Option endAt = default; - Option exportVersion = default; - Option id = default; - Option queryFolder = default; - Option queryMessage = default; - Option queryPath = default; - Option queryRequestMethod = default; - Option queryRequestUrl = default; - Option queryStatus = default; - Option querySuccess = default; - Option resultsUrl = default; - Option startAt = default; - Option status = default; - - while (utf8JsonReader.Read()) - { - if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) - { - string? localVarJsonPropertyName = utf8JsonReader.GetString(); - utf8JsonReader.Read(); - - switch (localVarJsonPropertyName) - { - case "end_at": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - endAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "export_version": - exportVersion = new Option(utf8JsonReader.GetString()!); - break; - case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt32()); - break; - case "query_folder": - queryFolder = new Option(utf8JsonReader.GetString()!); - break; - case "query_message": - queryMessage = new Option(utf8JsonReader.GetString()!); - break; - case "query_path": - queryPath = new Option(utf8JsonReader.GetString()!); - break; - case "query_request_method": - queryRequestMethod = new Option(utf8JsonReader.GetString()!); - break; - case "query_request_url": - queryRequestUrl = new Option(utf8JsonReader.GetString()!); - break; - case "query_status": - queryStatus = new Option(utf8JsonReader.GetString()!); - break; - case "query_success": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - querySuccess = new Option(utf8JsonReader.GetBoolean()); - break; - case "results_url": - resultsUrl = new Option(utf8JsonReader.GetString()!); - break; - case "start_at": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - startAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "status": - status = new Option(utf8JsonReader.GetString()!); - break; - default: - break; - } - } - } - - if (endAt.IsSet && endAt.Value == null) - throw new ArgumentNullException(nameof(endAt), "Property is not nullable for class ActionNotificationExportEntity."); - - if (exportVersion.IsSet && exportVersion.Value == null) - throw new ArgumentNullException(nameof(exportVersion), "Property is not nullable for class ActionNotificationExportEntity."); - - if (id.IsSet && id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryFolder.IsSet && queryFolder.Value == null) - throw new ArgumentNullException(nameof(queryFolder), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryMessage.IsSet && queryMessage.Value == null) - throw new ArgumentNullException(nameof(queryMessage), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryPath.IsSet && queryPath.Value == null) - throw new ArgumentNullException(nameof(queryPath), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryRequestMethod.IsSet && queryRequestMethod.Value == null) - throw new ArgumentNullException(nameof(queryRequestMethod), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryRequestUrl.IsSet && queryRequestUrl.Value == null) - throw new ArgumentNullException(nameof(queryRequestUrl), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryStatus.IsSet && queryStatus.Value == null) - throw new ArgumentNullException(nameof(queryStatus), "Property is not nullable for class ActionNotificationExportEntity."); - - if (querySuccess.IsSet && querySuccess.Value == null) - throw new ArgumentNullException(nameof(querySuccess), "Property is not nullable for class ActionNotificationExportEntity."); - - if (resultsUrl.IsSet && resultsUrl.Value == null) - throw new ArgumentNullException(nameof(resultsUrl), "Property is not nullable for class ActionNotificationExportEntity."); - - if (startAt.IsSet && startAt.Value == null) - throw new ArgumentNullException(nameof(startAt), "Property is not nullable for class ActionNotificationExportEntity."); - - if (status.IsSet && status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class ActionNotificationExportEntity."); - - return new ActionNotificationExportEntity(endAt, exportVersion, id, queryFolder, queryMessage, queryPath, queryRequestMethod, queryRequestUrl, queryStatus, querySuccess, resultsUrl, startAt, status); - } - - /// - /// Serializes a - /// - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) - { - writer.WriteStartObject(); - - WriteProperties(writer, actionNotificationExportEntity, jsonSerializerOptions); - writer.WriteEndObject(); - } - - /// - /// Serializes the properties of - /// - /// - /// - /// - /// - public void WriteProperties(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) - { - if (actionNotificationExportEntity.ExportVersionOption.IsSet && actionNotificationExportEntity.ExportVersion == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.ExportVersion), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryFolderOption.IsSet && actionNotificationExportEntity.QueryFolder == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryFolder), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryMessageOption.IsSet && actionNotificationExportEntity.QueryMessage == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryMessage), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryPathOption.IsSet && actionNotificationExportEntity.QueryPath == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryPath), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet && actionNotificationExportEntity.QueryRequestMethod == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestMethod), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet && actionNotificationExportEntity.QueryRequestUrl == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestUrl), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryStatusOption.IsSet && actionNotificationExportEntity.QueryStatus == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryStatus), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.ResultsUrlOption.IsSet && actionNotificationExportEntity.ResultsUrl == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.ResultsUrl), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.StatusOption.IsSet && actionNotificationExportEntity.Status == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.Status), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.EndAtOption.IsSet) - writer.WriteString("end_at", actionNotificationExportEntity.EndAtOption.Value!.Value.ToString(EndAtFormat)); - - if (actionNotificationExportEntity.ExportVersionOption.IsSet) - writer.WriteString("export_version", actionNotificationExportEntity.ExportVersion); - - if (actionNotificationExportEntity.IdOption.IsSet) - writer.WriteNumber("id", actionNotificationExportEntity.IdOption.Value!.Value); - - if (actionNotificationExportEntity.QueryFolderOption.IsSet) - writer.WriteString("query_folder", actionNotificationExportEntity.QueryFolder); - - if (actionNotificationExportEntity.QueryMessageOption.IsSet) - writer.WriteString("query_message", actionNotificationExportEntity.QueryMessage); - - if (actionNotificationExportEntity.QueryPathOption.IsSet) - writer.WriteString("query_path", actionNotificationExportEntity.QueryPath); - - if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet) - writer.WriteString("query_request_method", actionNotificationExportEntity.QueryRequestMethod); - - if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet) - writer.WriteString("query_request_url", actionNotificationExportEntity.QueryRequestUrl); - - if (actionNotificationExportEntity.QueryStatusOption.IsSet) - writer.WriteString("query_status", actionNotificationExportEntity.QueryStatus); - - if (actionNotificationExportEntity.QuerySuccessOption.IsSet) - writer.WriteBoolean("query_success", actionNotificationExportEntity.QuerySuccessOption.Value!.Value); - - if (actionNotificationExportEntity.ResultsUrlOption.IsSet) - writer.WriteString("results_url", actionNotificationExportEntity.ResultsUrl); - - if (actionNotificationExportEntity.StartAtOption.IsSet) - writer.WriteString("start_at", actionNotificationExportEntity.StartAtOption.Value!.Value.ToString(StartAtFormat)); - - if (actionNotificationExportEntity.StatusOption.IsSet) - writer.WriteString("status", actionNotificationExportEntity.Status); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj deleted file mode 100644 index 9f99b6957b6d..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - true - net8.0 - Org.OpenAPITools - Org.OpenAPITools - Library - OpenAPI - OpenAPI - OpenAPI Library - A library generated from a OpenAPI doc - No Copyright - Org.OpenAPITools - 1.0.0 - bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml - https://github.com/GIT_USER_ID/GIT_REPO_ID.git - git - Minor update - enable - false - - - - - - - - - - diff --git a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md deleted file mode 100644 index 1b9f504a56ef..000000000000 --- a/samples/client/petstore/csharp/generichost/net8/Tags/src/Org.OpenAPITools/README.md +++ /dev/null @@ -1,190 +0,0 @@ -# Created with Openapi Generator - - -## Run the following powershell command to generate the library - -```ps1 -$properties = @( - 'apiName=Api', - 'targetFramework=net8.0', - 'validatable=true', - 'nullableReferenceTypes=true', - 'hideGenerationTimestamp=true', - 'packageVersion=1.0.0', - 'packageAuthors=OpenAPI', - 'packageCompany=OpenAPI', - 'packageCopyright=No Copyright', - 'packageDescription=A library generated from a OpenAPI doc', - 'packageName=Org.OpenAPITools', - 'packageTags=', - 'packageTitle=OpenAPI Library' -) -join "," - -$global = @( - 'apiDocs=true', - 'modelDocs=true', - 'apiTests=true', - 'modelTests=true' -) -join "," - -java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` - -g csharp-netcore ` - -i .yaml ` - -o ` - --library generichost ` - --additional-properties $properties ` - --global-property $global ` - --git-host "github.com" ` - --git-repo-id "GIT_REPO_ID" ` - --git-user-id "GIT_USER_ID" ` - --release-note "Minor update" - # -t templates -``` - - -## Using the library in your project - -```cs -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Model; - -namespace YourProject -{ - public class Program - { - public static async Task Main(string[] args) - { - var host = CreateHostBuilder(args).Build(); - var api = host.Services.GetRequiredService(); - GetApiKeysId_1ApiResponse apiResponse = await api.GetApiKeysId_1Async("todo"); - object model = apiResponse.Ok(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) - .ConfigureApi((context, options) => - { - // the type of token here depends on the api security specifications - ApiKeyToken token = new("", ClientUtils.ApiKeyHeader.Authorization); - options.AddTokens(token); - - // optionally choose the method the tokens will be provided with, default is RateLimitProvider - options.UseProvider, ApiKeyToken>(); - - options.ConfigureJsonOptions((jsonOptions) => - { - // your custom converters if any - }); - - options.AddApiHttpClients(builder: builder => builder - .AddRetryPolicy(2) - .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) - .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) - // add whatever middleware you prefer - ); - }); - } -} -``` - -## Questions - -- What about HttpRequest failures and retries? - If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. -- How are tokens used? - Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. - Other providers can be used with the UseProvider method. -- Does an HttpRequest throw an error when the server response is not Ok? - It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. - StatusCode and ReasonPhrase will contain information about the error. - If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. -- How do I validate requests and process responses? - Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. - Or provide your own class by using the generic ConfigureApi method. - - -## Dependencies - -- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later -- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later -- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later -- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later - - -## Documentation for Authorization - - -Authentication schemes defined for the API: - -### api_key - -- **Type**: API key -- **API key parameter name**: XFilesAPIKey -- **Location**: HTTP header - - -## Build -- SDK version: 1.0.0 -- Generator version: 7.9.0-SNAPSHOT -- Build package: org.openapitools.codegen.languages.CSharpClientCodegen - -## Api Information -- appName: Files.com API -- appVersion: 0.0.1 -- appDescription: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - -## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) -- generateAliasAsModel: -- supportingFiles: -- models: omitted for brevity -- apis: omitted for brevity -- apiDocs: true -- modelDocs: true -- apiTests: true -- modelTests: true - -## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) -- allowUnicodeIdentifiers: -- apiName: Api -- caseInsensitiveResponseHeaders: -- conditionalSerialization: false -- disallowAdditionalPropertiesIfNotPresent: -- gitHost: github.com -- gitRepoId: GIT_REPO_ID -- gitUserId: GIT_USER_ID -- hideGenerationTimestamp: true -- interfacePrefix: I -- library: generichost -- licenseId: -- modelPropertyNaming: -- netCoreProjectFile: false -- nonPublicApi: false -- nullableReferenceTypes: true -- optionalAssemblyInfo: -- optionalEmitDefaultValues: false -- optionalMethodArgument: true -- optionalProjectFile: -- packageAuthors: OpenAPI -- packageCompany: OpenAPI -- packageCopyright: No Copyright -- packageDescription: A library generated from a OpenAPI doc -- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} -- packageName: Org.OpenAPITools -- packageTags: -- packageTitle: OpenAPI Library -- packageVersion: 1.0.0 -- releaseNote: Minor update -- returnICollection: false -- sortParamsByRequiredFlag: -- sourceFolder: src -- targetFramework: net8.0 -- useCollection: false -- useDateTimeOffset: false -- useOneOfDiscriminatorLookup: false -- validatable: true - -This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. From dc56b827044ae84da4c14bce944b80ce4086460b Mon Sep 17 00:00:00 2001 From: devhl Date: Fri, 4 Oct 2024 20:43:03 -0400 Subject: [PATCH 6/8] move the sample and add to github workflow --- .github/workflows/openapi-generator.yaml | 2 + .github/workflows/samples-dotnet.yaml | 3 + .../csharp-generichost-tags-latest.yaml | 2 +- .../csharp/generichost/latest/Tags/.gitignore | 362 ++++++++++++ .../latest/Tags/.openapi-generator-ignore | 23 + .../latest/Tags/.openapi-generator/FILES | 43 ++ .../latest/Tags/.openapi-generator/VERSION | 1 + .../latest/Tags/Org.OpenAPITools.sln | 27 + .../csharp/generichost/latest/Tags/README.md | 1 + .../generichost/latest/Tags/api/openapi.yaml | 141 +++++ .../generichost/latest/Tags/appveyor.yml | 9 + .../latest/Tags/docs/apis/APIKEYSApi.md | 95 +++ .../latest/Tags/docs/apis/APIKeys0Api.md | 95 +++ .../latest/Tags/docs/apis/ApiKeys1Api.md | 95 +++ .../models/ActionNotificationExportEntity.md | 23 + .../latest/Tags/docs/scripts/git_push.ps1 | 75 +++ .../latest/Tags/docs/scripts/git_push.sh | 49 ++ .../Api/APIKEYSApiTests.cs | 63 ++ .../Api/APIKeys0ApiTests.cs | 63 ++ .../Api/ApiKeys1ApiTests.cs | 63 ++ .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 61 ++ .../Api/DependencyInjectionTests.cs | 132 +++++ .../ActionNotificationExportEntityTests.cs | 174 ++++++ .../Org.OpenAPITools.Test.csproj | 20 + .../Tags/src/Org.OpenAPITools.Test/README.md | 0 .../src/Org.OpenAPITools/Api/APIKEYSApi.cs | 311 ++++++++++ .../src/Org.OpenAPITools/Api/APIKeys0Api.cs | 311 ++++++++++ .../src/Org.OpenAPITools/Api/ApiKeys1Api.cs | 311 ++++++++++ .../Tags/src/Org.OpenAPITools/Api/IApi.cs | 15 + .../Org.OpenAPITools/Client/ApiException.cs | 53 ++ .../src/Org.OpenAPITools/Client/ApiFactory.cs | 49 ++ .../Org.OpenAPITools/Client/ApiKeyToken.cs | 54 ++ .../Client/ApiResponseEventArgs.cs | 24 + .../Org.OpenAPITools/Client/ApiResponse`1.cs | 153 +++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 343 +++++++++++ .../Client/CookieContainer.cs | 20 + .../Client/DateOnlyJsonConverter.cs | 62 ++ .../Client/DateOnlyNullableJsonConverter.cs | 67 +++ .../Client/DateTimeJsonConverter.cs | 76 +++ .../Client/DateTimeNullableJsonConverter.cs | 81 +++ .../Client/ExceptionEventArgs.cs | 24 + .../Client/HostConfiguration.cs | 140 +++++ .../Client/JsonSerializerOptionsProvider.cs | 27 + .../src/Org.OpenAPITools/Client/Option.cs | 54 ++ .../Client/RateLimitProvider`1.cs | 75 +++ .../src/Org.OpenAPITools/Client/TokenBase.cs | 71 +++ .../Client/TokenContainer`1.cs | 37 ++ .../Client/TokenProvider`1.cs | 45 ++ .../Extensions/IHostBuilderExtensions.cs | 44 ++ .../IHttpClientBuilderExtensions.cs | 80 +++ .../IServiceCollectionExtensions.cs | 64 ++ .../Model/ActionNotificationExportEntity.cs | 545 ++++++++++++++++++ .../Org.OpenAPITools/Org.OpenAPITools.csproj | 31 + .../Tags/src/Org.OpenAPITools/README.md | 190 ++++++ 54 files changed, 4978 insertions(+), 1 deletion(-) create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/.gitignore create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator-ignore create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/VERSION create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/Org.OpenAPITools.sln create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/README.md create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/appveyor.yml create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKEYSApi.md create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKeys0Api.md create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/ApiKeys1Api.md create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.ps1 create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.sh create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/README.md create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiException.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/Option.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj create mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md diff --git a/.github/workflows/openapi-generator.yaml b/.github/workflows/openapi-generator.yaml index 45baea95da77..a48c4c4db470 100644 --- a/.github/workflows/openapi-generator.yaml +++ b/.github/workflows/openapi-generator.yaml @@ -142,6 +142,8 @@ jobs: path: modules/openapi-generator-cli/target - name: Delete samples that are entirely generated run: | + rm -rf samples/client/petstore/csharp/generichost/latest/Tags + rm -rf samples/client/petstore/csharp/generichost/net8/AllOf rm -rf samples/client/petstore/csharp/generichost/net8/AnyOf rm -rf samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare diff --git a/.github/workflows/samples-dotnet.yaml b/.github/workflows/samples-dotnet.yaml index 24b44c7d92a8..89740bcbca26 100644 --- a/.github/workflows/samples-dotnet.yaml +++ b/.github/workflows/samples-dotnet.yaml @@ -3,12 +3,14 @@ name: Samples C# .Net 8 Clients on: push: paths: + - samples/client/petstore/csharp/generichost/latest/** - samples/client/petstore/csharp/generichost/net8/** - samples/client/petstore/csharp/httpclient/net8/** - samples/client/petstore/csharp/restsharp/net8/** - samples/client/petstore/csharp/unityWebRequest/net8/** pull_request: paths: + - samples/client/petstore/csharp/generichost/latest/** - samples/client/petstore/csharp/generichost/net8/** - samples/client/petstore/csharp/httpclient/net8/** - samples/client/petstore/csharp/restsharp/net8/** @@ -21,6 +23,7 @@ jobs: fail-fast: false matrix: sample: + - samples/client/petstore/csharp/generichost/latest/Tags - samples/client/petstore/csharp/generichost/net8/AllOf - samples/client/petstore/csharp/generichost/net8/AnyOf - samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare diff --git a/bin/configs/csharp-generichost-tags-latest.yaml b/bin/configs/csharp-generichost-tags-latest.yaml index 32f9e6fca2a2..61675ec7c021 100644 --- a/bin/configs/csharp-generichost-tags-latest.yaml +++ b/bin/configs/csharp-generichost-tags-latest.yaml @@ -1,6 +1,6 @@ # for csharp generichost generatorName: csharp -outputDir: samples/client/petstore/csharp/generichost/net8/Tags +outputDir: samples/client/petstore/csharp/generichost/latest/Tags inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/tags.json library: generichost templateDir: modules/openapi-generator/src/main/resources/csharp diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/.gitignore b/samples/client/petstore/csharp/generichost/latest/Tags/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES new file mode 100644 index 000000000000..2ef51ce0d61c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES @@ -0,0 +1,43 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/APIKEYSApi.md +docs/apis/APIKeys0Api.md +docs/apis/ApiKeys1Api.md +docs/models/ActionNotificationExportEntity.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/APIKEYSApi.cs +src/Org.OpenAPITools/Api/APIKeys0Api.cs +src/Org.OpenAPITools/Api/ApiKeys1Api.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiKeyToken.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/VERSION new file mode 100644 index 000000000000..17f2442ff3bc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.9.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/latest/Tags/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/README.md b/samples/client/petstore/csharp/generichost/latest/Tags/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml b/samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml new file mode 100644 index 000000000000..c943de9c72c0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml @@ -0,0 +1,141 @@ +openapi: 3.0.1 +info: + contact: + email: support@files.com + name: Files.com Customer Success Team + title: Files.com API + version: 0.0.1 +servers: +- url: //app.files.com/api/rest/v1 +tags: +- description: Operations about api_keys + name: api_key +- description: Operations about API Keys + name: API Keys +- description: Operations about API keys + name: a_p_i_k_e_y_s +paths: + /api_keys/{id}: + get: + description: Show API Key + operationId: GetApiKeysId + parameters: + - description: Api Key ID. + in: path + name: id + required: true + schema: + format: int32 + type: integer + x-ms-summary: Api Key ID. + x-ms-summary: Api Key ID. + responses: + "400": + content: {} + description: Bad Request + x-ms-summary: Bad Request + summary: Show API Key + tags: + - api_keys + - API Keys + - a_p_i_k_e_y_s + x-authentication: + - self_managed + x-category: + - developers +components: + schemas: + ActionNotificationExportEntity: + description: ActionNotificationExportEntity model + properties: + id: + description: History Export ID + example: 1 + format: int32 + type: integer + export_version: + description: Version of the underlying records for the export. + example: example + type: string + start_at: + description: Start date/time of export range. + example: 2000-01-01T01:00:00Z + format: date-time + type: string + end_at: + description: End date/time of export range. + example: 2000-01-01T01:00:00Z + format: date-time + type: string + status: + description: "Status of export. Valid values: `building`, `ready`, or `failed`" + example: ready + type: string + query_path: + description: Return notifications that were triggered by actions on this + specific path. + example: MyFile.txt + type: string + query_folder: + description: Return notifications that were triggered by actions in this + folder. + example: MyFolder + type: string + query_message: + description: "Error message associated with the request, if any." + example: Connection Refused + type: string + query_request_method: + description: The HTTP request method used by the webhook. + example: GET + type: string + query_request_url: + description: The target webhook URL. + example: http://example.com/webhook + type: string + query_status: + description: The HTTP status returned from the server in response to the + webhook request. + example: "200" + type: string + query_success: + description: true if the webhook request succeeded (i.e. returned a 200 + or 204 response status). false otherwise. + example: true + type: boolean + results_url: + description: "If `status` is `ready`, this will be a URL where all the results\ + \ can be downloaded at once as a CSV." + example: https://files.com/action_notification_results.csv + type: string + type: object + x-docs: | + An ActionNotificationExport is an operation that provides access to outgoing webhook logs. Querying webhook logs is a little different than other APIs. + + All queries against the archive must be submitted as Exports. (Even our Web UI creates an Export behind the scenes.) + + In any query field in this API, you may specify multiple values separated by commas. That means that commas + cannot be searched for themselves, and neither can single quotation marks. + + Use the following steps to complete an export: + + 1. Initiate the export by using the Create Action Notification Export endpoint. Non Site Admins must query by folder or path. + 2. Using the `id` from the response to step 1, poll the Show Action Notification Export endpoint. Check the `status` field until it is `ready`. + 3. You can download the results of the export as a CSV file using the `results_url` field in the response from step 2. If you want to page through the records in JSON format, use the List Action Notification Export Results endpoint, passing the `id` that you got in step 1 as the `action_notification_export_id` parameter. Check the `X-Files-Cursor-Next` header to see if there are more records available, and resubmit the same request with a `cursor` parameter to fetch the next page of results. Unlike most API Endpoints, this endpoint does not provide `X-Files-Cursor-Prev` cursors allowing reverse pagination through the results. This is due to limitations in Amazon Athena, the underlying data lake for these records. + + If you intend to use this API for high volume or automated use, please contact us with more information + about your use case. + + ## Example Queries + + * History for a folder: `{ "query_folder": "path/to/folder" }` + * History for a range of time: `{ "start_at": "2021-03-18 12:00:00", "end_at": "2021-03-19 12:00:00" }` + * History of all notifications that used GET or POST: `{ "query_request_method": "GET,POST" }` + securitySchemes: + api_key: + description: API Key - supports user-based or site-wide API keys + in: header + name: XFilesAPIKey + type: apiKey +x-original-swagger-version: "2.0" + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/appveyor.yml b/samples/client/petstore/csharp/generichost/latest/Tags/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKEYSApi.md b/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKEYSApi.md new file mode 100644 index 000000000000..bae5c9ea169d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKEYSApi.md @@ -0,0 +1,95 @@ +# Org.OpenAPITools.Api.APIKEYSApi + +All URIs are relative to *http://app.files.com/api/rest/v1* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**GetApiKeysId_1**](APIKEYSApi.md#getapikeysid_1) | **GET** /api_keys/{id} | Show API Key | + + +# **GetApiKeysId_1** +> void GetApiKeysId_1 (int id) + +Show API Key + +Show API Key + +### 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 GetApiKeysId_1Example + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://app.files.com/api/rest/v1"; + var apiInstance = new APIKEYSApi(config); + var id = 56; // int | Api Key ID. + + try + { + // Show API Key + apiInstance.GetApiKeysId_1(id); + } + catch (ApiException e) + { + Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetApiKeysId_1WithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Show API Key + apiInstance.GetApiKeysId_1WithHttpInfo(id); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId_1WithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **id** | **int** | Api Key ID. | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKeys0Api.md b/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKeys0Api.md new file mode 100644 index 000000000000..c0520bd8d8d0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/APIKeys0Api.md @@ -0,0 +1,95 @@ +# Org.OpenAPITools.Api.APIKeysApi + +All URIs are relative to *http://app.files.com/api/rest/v1* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**GetApiKeysId_0**](APIKeysApi.md#getapikeysid_0) | **GET** /api_keys/{id} | Show API Key | + + +# **GetApiKeysId_0** +> void GetApiKeysId_0 (int id) + +Show API Key + +Show API Key + +### 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 GetApiKeysId_0Example + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://app.files.com/api/rest/v1"; + var apiInstance = new APIKeysApi(config); + var id = 56; // int | Api Key ID. + + try + { + // Show API Key + apiInstance.GetApiKeysId_0(id); + } + catch (ApiException e) + { + Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetApiKeysId_0WithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Show API Key + apiInstance.GetApiKeysId_0WithHttpInfo(id); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling APIKeysApi.GetApiKeysId_0WithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **id** | **int** | Api Key ID. | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/ApiKeys1Api.md b/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/ApiKeys1Api.md new file mode 100644 index 000000000000..c87fce89ca00 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/docs/apis/ApiKeys1Api.md @@ -0,0 +1,95 @@ +# Org.OpenAPITools.Api.ApiKeysApi + +All URIs are relative to *http://app.files.com/api/rest/v1* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**GetApiKeysId**](ApiKeysApi.md#getapikeysid) | **GET** /api_keys/{id} | Show API Key | + + +# **GetApiKeysId** +> void GetApiKeysId (int id) + +Show API Key + +Show API Key + +### 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 GetApiKeysIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://app.files.com/api/rest/v1"; + var apiInstance = new ApiKeysApi(config); + var id = 56; // int | Api Key ID. + + try + { + // Show API Key + apiInstance.GetApiKeysId(id); + } + catch (ApiException e) + { + Debug.Print("Exception when calling ApiKeysApi.GetApiKeysId: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetApiKeysIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Show API Key + apiInstance.GetApiKeysIdWithHttpInfo(id); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling ApiKeysApi.GetApiKeysIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **id** | **int** | Api Key ID. | | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Bad Request | - | + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md b/samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md new file mode 100644 index 000000000000..c6730728c411 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md @@ -0,0 +1,23 @@ +# Org.OpenAPITools.Model.ActionNotificationExportEntity +ActionNotificationExportEntity model + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EndAt** | **DateTime** | End date/time of export range. | [optional] +**ExportVersion** | **string** | Version of the underlying records for the export. | [optional] +**Id** | **int** | History Export ID | [optional] +**QueryFolder** | **string** | Return notifications that were triggered by actions in this folder. | [optional] +**QueryMessage** | **string** | Error message associated with the request, if any. | [optional] +**QueryPath** | **string** | Return notifications that were triggered by actions on this specific path. | [optional] +**QueryRequestMethod** | **string** | The HTTP request method used by the webhook. | [optional] +**QueryRequestUrl** | **string** | The target webhook URL. | [optional] +**QueryStatus** | **string** | The HTTP status returned from the server in response to the webhook request. | [optional] +**QuerySuccess** | **bool** | true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. | [optional] +**ResultsUrl** | **string** | If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. | [optional] +**StartAt** | **DateTime** | Start date/time of export range. | [optional] +**Status** | **string** | Status of export. Valid values: `building`, `ready`, or `failed` | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=${1:-GIT_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +git_remote=$(git remote) + +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs new file mode 100644 index 000000000000..75525420b629 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs @@ -0,0 +1,63 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing APIKEYSApi + /// + public sealed class APIKEYSApiTests : ApiTestsBase + { + private readonly IAPIKEYSApi _instance; + + public APIKEYSApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test GetApiKeysId_1 + /// + [Fact (Skip = "not implemented")] + public async Task GetApiKeysId_1AsyncTest() + { + int id = default!; + await _instance.GetApiKeysId_1Async(id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs new file mode 100644 index 000000000000..b05a814880fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs @@ -0,0 +1,63 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing APIKeysApi + /// + public sealed class APIKeysApiTests : ApiTestsBase + { + private readonly IAPIKeysApi _instance; + + public APIKeysApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test GetApiKeysId_0 + /// + [Fact (Skip = "not implemented")] + public async Task GetApiKeysId_0AsyncTest() + { + int id = default!; + await _instance.GetApiKeysId_0Async(id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs new file mode 100644 index 000000000000..c98aa9c063b0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs @@ -0,0 +1,63 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing ApiKeysApi + /// + public sealed class ApiKeysApiTests : ApiTestsBase + { + private readonly IApiKeysApi _instance; + + public ApiKeysApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test GetApiKeysId + /// + [Fact (Skip = "not implemented")] + public async Task GetApiKeysIdAsyncTest() + { + int id = default!; + await _instance.GetApiKeysIdAsync(id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..fb1f2134be48 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,61 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..cc1119a79f4d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,132 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.XFilesAPIKey, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var aPIKEYSApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var aPIKEYSApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var aPIKEYSApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var aPIKEYSApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKEYSApi.HttpClient.BaseAddress != null); + + var aPIKeysApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(aPIKeysApi.HttpClient.BaseAddress != null); + + var apiKeysApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(apiKeysApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs new file mode 100644 index 000000000000..f78ea44cd286 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs @@ -0,0 +1,174 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ActionNotificationExportEntity + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActionNotificationExportEntityTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ActionNotificationExportEntity + //private ActionNotificationExportEntity instance; + + public ActionNotificationExportEntityTests() + { + // TODO uncomment below to create an instance of ActionNotificationExportEntity + //instance = new ActionNotificationExportEntity(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ActionNotificationExportEntity + /// + [Fact] + public void ActionNotificationExportEntityInstanceTest() + { + // TODO uncomment below to test "IsType" ActionNotificationExportEntity + //Assert.IsType(instance); + } + + /// + /// Test the property 'EndAt' + /// + [Fact] + public void EndAtTest() + { + // TODO unit test for the property 'EndAt' + } + + /// + /// Test the property 'ExportVersion' + /// + [Fact] + public void ExportVersionTest() + { + // TODO unit test for the property 'ExportVersion' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'QueryFolder' + /// + [Fact] + public void QueryFolderTest() + { + // TODO unit test for the property 'QueryFolder' + } + + /// + /// Test the property 'QueryMessage' + /// + [Fact] + public void QueryMessageTest() + { + // TODO unit test for the property 'QueryMessage' + } + + /// + /// Test the property 'QueryPath' + /// + [Fact] + public void QueryPathTest() + { + // TODO unit test for the property 'QueryPath' + } + + /// + /// Test the property 'QueryRequestMethod' + /// + [Fact] + public void QueryRequestMethodTest() + { + // TODO unit test for the property 'QueryRequestMethod' + } + + /// + /// Test the property 'QueryRequestUrl' + /// + [Fact] + public void QueryRequestUrlTest() + { + // TODO unit test for the property 'QueryRequestUrl' + } + + /// + /// Test the property 'QueryStatus' + /// + [Fact] + public void QueryStatusTest() + { + // TODO unit test for the property 'QueryStatus' + } + + /// + /// Test the property 'QuerySuccess' + /// + [Fact] + public void QuerySuccessTest() + { + // TODO unit test for the property 'QuerySuccess' + } + + /// + /// Test the property 'ResultsUrl' + /// + [Fact] + public void ResultsUrlTest() + { + // TODO unit test for the property 'ResultsUrl' + } + + /// + /// Test the property 'StartAt' + /// + [Fact] + public void StartAtTest() + { + // TODO unit test for the property 'StartAt' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..05ce7e5830d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net8.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs new file mode 100644 index 000000000000..01bfb94ecedb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs @@ -0,0 +1,311 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAPIKEYSApi : IApi + { + /// + /// The class containing the events + /// + APIKEYSApiEvents Events { get; } + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <?> + Task GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IGetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class APIKEYSApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetApiKeysId_1; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetApiKeysId_1; + + internal void ExecuteOnGetApiKeysId_1(APIKEYSApi.GetApiKeysId_1ApiResponse apiResponse) + { + OnGetApiKeysId_1?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetApiKeysId_1(Exception exception) + { + OnErrorGetApiKeysId_1?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class APIKEYSApi : IAPIKEYSApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public APIKEYSApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public APIKEYSApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, APIKEYSApiEvents aPIKEYSApiEvents, + TokenProvider apiKeyProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = aPIKEYSApiEvents; + ApiKeyProvider = apiKeyProvider; + } + + partial void FormatGetApiKeysId_1(ref int id); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetApiKeysId_1DefaultImplementation(IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id) + { + bool suppressDefaultLog = false; + AfterGetApiKeysId_1(ref suppressDefaultLog, apiResponseLocalVar, id); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetApiKeysId_1(ref bool suppressDefaultLog, IGetApiKeysId_1ApiResponse apiResponseLocalVar, int id); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetApiKeysId_1DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetApiKeysId_1(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetApiKeysId_1(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); + + /// + /// Show API Key Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_1OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetApiKeysId_1Async(id, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Show API Key Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_1Async(int id, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetApiKeysId_1(ref id); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetApiKeysId_1ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetApiKeysId_1DefaultImplementation(apiResponseLocalVar, id); + + Events.ExecuteOnGetApiKeysId_1(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetApiKeysId_1DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); + Events.ExecuteOnErrorGetApiKeysId_1(e); + throw; + } + } + + /// + /// The + /// + public partial class GetApiKeysId_1ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_1ApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetApiKeysId_1ApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + 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); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs new file mode 100644 index 000000000000..01f8b7046396 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs @@ -0,0 +1,311 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAPIKeysApi : IApi + { + /// + /// The class containing the events + /// + APIKeysApiEvents Events { get; } + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <?> + Task GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IGetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class APIKeysApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetApiKeysId_0; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetApiKeysId_0; + + internal void ExecuteOnGetApiKeysId_0(APIKeysApi.GetApiKeysId_0ApiResponse apiResponse) + { + OnGetApiKeysId_0?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetApiKeysId_0(Exception exception) + { + OnErrorGetApiKeysId_0?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class APIKeysApi : IAPIKeysApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public APIKeysApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public APIKeysApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, APIKeysApiEvents aPIKeysApiEvents, + TokenProvider apiKeyProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = aPIKeysApiEvents; + ApiKeyProvider = apiKeyProvider; + } + + partial void FormatGetApiKeysId_0(ref int id); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetApiKeysId_0DefaultImplementation(IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id) + { + bool suppressDefaultLog = false; + AfterGetApiKeysId_0(ref suppressDefaultLog, apiResponseLocalVar, id); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetApiKeysId_0(ref bool suppressDefaultLog, IGetApiKeysId_0ApiResponse apiResponseLocalVar, int id); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetApiKeysId_0DefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetApiKeysId_0(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetApiKeysId_0(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); + + /// + /// Show API Key Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_0OrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetApiKeysId_0Async(id, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Show API Key Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysId_0Async(int id, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetApiKeysId_0(ref id); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetApiKeysId_0ApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetApiKeysId_0DefaultImplementation(apiResponseLocalVar, id); + + Events.ExecuteOnGetApiKeysId_0(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetApiKeysId_0DefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); + Events.ExecuteOnErrorGetApiKeysId_0(e); + throw; + } + } + + /// + /// The + /// + public partial class GetApiKeysId_0ApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysId_0ApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetApiKeysId_0ApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + 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); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs new file mode 100644 index 000000000000..be13fa923c79 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs @@ -0,0 +1,311 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IApiKeysApi : IApi + { + /// + /// The class containing the events + /// + ApiKeysApiEvents Events { get; } + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + Task GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Show API Key + /// + /// + /// Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <?> + Task GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IGetApiKeysIdApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class ApiKeysApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetApiKeysId; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetApiKeysId; + + internal void ExecuteOnGetApiKeysId(ApiKeysApi.GetApiKeysIdApiResponse apiResponse) + { + OnGetApiKeysId?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetApiKeysId(Exception exception) + { + OnErrorGetApiKeysId?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class ApiKeysApi : IApiKeysApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public ApiKeysApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiKeysApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, ApiKeysApiEvents apiKeysApiEvents, + TokenProvider apiKeyProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = apiKeysApiEvents; + ApiKeyProvider = apiKeyProvider; + } + + partial void FormatGetApiKeysId(ref int id); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetApiKeysIdDefaultImplementation(IGetApiKeysIdApiResponse apiResponseLocalVar, int id) + { + bool suppressDefaultLog = false; + AfterGetApiKeysId(ref suppressDefaultLog, apiResponseLocalVar, id); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetApiKeysId(ref bool suppressDefaultLog, IGetApiKeysIdApiResponse apiResponseLocalVar, int id); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetApiKeysIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetApiKeysId(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, id); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetApiKeysId(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, int id); + + /// + /// Show API Key Show API Key + /// + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysIdOrDefaultAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetApiKeysIdAsync(id, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Show API Key Show API Key + /// + /// Thrown when fails to make API call + /// Api Key ID. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetApiKeysIdAsync(int id, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetApiKeysId(ref id); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/api_keys/{id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); + + Events.ExecuteOnGetApiKeysId(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetApiKeysIdDefaultImplementation(e, "/api_keys/{id}", uriBuilderLocalVar.Path, id); + Events.ExecuteOnErrorGetApiKeysId(e); + throw; + } + } + + /// + /// The + /// + public partial class GetApiKeysIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetApiKeysIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetApiKeysIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + 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); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..2e24a58ea04e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,53 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs new file mode 100644 index 000000000000..d0b10f69b91e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -0,0 +1,54 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an apiKey. + /// + public class ApiKeyToken : TokenBase + { + private string _raw; + + /// + /// The header that this token will be used with. + /// + public ClientUtils.ApiKeyHeader Header { get; } + + /// + /// Constructs an ApiKeyToken object. + /// + /// + /// + /// + /// + public ApiKeyToken(string value, ClientUtils.ApiKeyHeader header, string prefix = "Bearer ", TimeSpan? timeout = null) : base(timeout) + { + Header = header; + _raw = $"{ prefix }{ value }"; + } + + /// + /// Places the token in the header. + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request) + { + request.Headers.Add(ClientUtils.ApiKeyHeaderToString(Header), _raw); + } + + /// + /// Places the token in the query. + /// + /// + /// + /// + public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage request, UriBuilder uriBuilder, System.Collections.Specialized.NameValueCollection parseQueryString) + { + parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..faa5d765bedd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,153 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..adf46fb12a6e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,343 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// An enum of headers + /// + public enum ApiKeyHeader + { + /// + /// The XFilesAPIKey header + /// + XFilesAPIKey + } + + /// + /// Converte an ApiKeyHeader to a string + /// + /// + /// + /// + public static string ApiKeyHeaderToString(ApiKeyHeader value) + { + return value switch + { + ApiKeyHeader.XFilesAPIKey => "XFilesAPIKey", + _ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)), + }; + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://app.files.com/api/rest/v1"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = "/api/rest/v1"; + + /// + /// The host of the API + /// + public const string HOST = "app.files.com"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..2e5bda82ea8f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -0,0 +1,62 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..0ced717f3e38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -0,0 +1,67 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..fb959c7d7cc9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,76 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..454404eb8863 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,81 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..dcfab6678233 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExcepetionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..f8fa10ad1eff --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,140 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new ActionNotificationExportEntityJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..70193a99d42b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,54 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..7537f0872a27 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -0,0 +1,75 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + if (container is TokenContainer apiKeyTokenContainer) + { + string[] headers = apiKeyTokenContainer.Tokens.Select(t => ClientUtils.ApiKeyHeaderToString(t.Header)).Distinct().ToArray(); + + foreach (string header in headers) + { + BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(header, Channel.CreateBounded(options)); + } + } + else + { + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + } + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..19ecb6691081 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,45 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..b8dc385fbc5e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,44 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..63436ad65789 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,80 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..1366427b2e23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,64 @@ +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs new file mode 100644 index 000000000000..ab22c4749bcb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs @@ -0,0 +1,545 @@ +// +/* + * Files.com API + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Contact: support@files.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ActionNotificationExportEntity model + /// + public partial class ActionNotificationExportEntity : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// End date/time of export range. + /// Version of the underlying records for the export. + /// History Export ID + /// Return notifications that were triggered by actions in this folder. + /// Error message associated with the request, if any. + /// Return notifications that were triggered by actions on this specific path. + /// The HTTP request method used by the webhook. + /// The target webhook URL. + /// The HTTP status returned from the server in response to the webhook request. + /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. + /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. + /// Start date/time of export range. + /// Status of export. Valid values: `building`, `ready`, or `failed` + [JsonConstructor] + public ActionNotificationExportEntity(Option endAt = default, Option exportVersion = default, Option id = default, Option queryFolder = default, Option queryMessage = default, Option queryPath = default, Option queryRequestMethod = default, Option queryRequestUrl = default, Option queryStatus = default, Option querySuccess = default, Option resultsUrl = default, Option startAt = default, Option status = default) + { + EndAtOption = endAt; + ExportVersionOption = exportVersion; + IdOption = id; + QueryFolderOption = queryFolder; + QueryMessageOption = queryMessage; + QueryPathOption = queryPath; + QueryRequestMethodOption = queryRequestMethod; + QueryRequestUrlOption = queryRequestUrl; + QueryStatusOption = queryStatus; + QuerySuccessOption = querySuccess; + ResultsUrlOption = resultsUrl; + StartAtOption = startAt; + StatusOption = status; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of EndAt + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EndAtOption { get; private set; } + + /// + /// End date/time of export range. + /// + /// End date/time of export range. + /* 2000-01-01T01:00Z */ + [JsonPropertyName("end_at")] + public DateTime? EndAt { get { return this.EndAtOption; } set { this.EndAtOption = new(value); } } + + /// + /// Used to track the state of ExportVersion + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ExportVersionOption { get; private set; } + + /// + /// Version of the underlying records for the export. + /// + /// Version of the underlying records for the export. + /* example */ + [JsonPropertyName("export_version")] + public string? ExportVersion { get { return this.ExportVersionOption; } set { this.ExportVersionOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// History Export ID + /// + /// History Export ID + /* 1 */ + [JsonPropertyName("id")] + public int? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of QueryFolder + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryFolderOption { get; private set; } + + /// + /// Return notifications that were triggered by actions in this folder. + /// + /// Return notifications that were triggered by actions in this folder. + /* MyFolder */ + [JsonPropertyName("query_folder")] + public string? QueryFolder { get { return this.QueryFolderOption; } set { this.QueryFolderOption = new(value); } } + + /// + /// Used to track the state of QueryMessage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryMessageOption { get; private set; } + + /// + /// Error message associated with the request, if any. + /// + /// Error message associated with the request, if any. + /* Connection Refused */ + [JsonPropertyName("query_message")] + public string? QueryMessage { get { return this.QueryMessageOption; } set { this.QueryMessageOption = new(value); } } + + /// + /// Used to track the state of QueryPath + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryPathOption { get; private set; } + + /// + /// Return notifications that were triggered by actions on this specific path. + /// + /// Return notifications that were triggered by actions on this specific path. + /* MyFile.txt */ + [JsonPropertyName("query_path")] + public string? QueryPath { get { return this.QueryPathOption; } set { this.QueryPathOption = new(value); } } + + /// + /// Used to track the state of QueryRequestMethod + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryRequestMethodOption { get; private set; } + + /// + /// The HTTP request method used by the webhook. + /// + /// The HTTP request method used by the webhook. + /* GET */ + [JsonPropertyName("query_request_method")] + public string? QueryRequestMethod { get { return this.QueryRequestMethodOption; } set { this.QueryRequestMethodOption = new(value); } } + + /// + /// Used to track the state of QueryRequestUrl + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryRequestUrlOption { get; private set; } + + /// + /// The target webhook URL. + /// + /// The target webhook URL. + /* http://example.com/webhook */ + [JsonPropertyName("query_request_url")] + public string? QueryRequestUrl { get { return this.QueryRequestUrlOption; } set { this.QueryRequestUrlOption = new(value); } } + + /// + /// Used to track the state of QueryStatus + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QueryStatusOption { get; private set; } + + /// + /// The HTTP status returned from the server in response to the webhook request. + /// + /// The HTTP status returned from the server in response to the webhook request. + /* 200 */ + [JsonPropertyName("query_status")] + public string? QueryStatus { get { return this.QueryStatusOption; } set { this.QueryStatusOption = new(value); } } + + /// + /// Used to track the state of QuerySuccess + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QuerySuccessOption { get; private set; } + + /// + /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. + /// + /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. + /* true */ + [JsonPropertyName("query_success")] + public bool? QuerySuccess { get { return this.QuerySuccessOption; } set { this.QuerySuccessOption = new(value); } } + + /// + /// Used to track the state of ResultsUrl + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ResultsUrlOption { get; private set; } + + /// + /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. + /// + /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. + /* https://files.com/action_notification_results.csv */ + [JsonPropertyName("results_url")] + public string? ResultsUrl { get { return this.ResultsUrlOption; } set { this.ResultsUrlOption = new(value); } } + + /// + /// Used to track the state of StartAt + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StartAtOption { get; private set; } + + /// + /// Start date/time of export range. + /// + /// Start date/time of export range. + /* 2000-01-01T01:00Z */ + [JsonPropertyName("start_at")] + public DateTime? StartAt { get { return this.StartAtOption; } set { this.StartAtOption = new(value); } } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// Status of export. Valid values: `building`, `ready`, or `failed` + /// + /// Status of export. Valid values: `building`, `ready`, or `failed` + /* ready */ + [JsonPropertyName("status")] + public string? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ActionNotificationExportEntity {\n"); + sb.Append(" EndAt: ").Append(EndAt).Append("\n"); + sb.Append(" ExportVersion: ").Append(ExportVersion).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" QueryFolder: ").Append(QueryFolder).Append("\n"); + sb.Append(" QueryMessage: ").Append(QueryMessage).Append("\n"); + sb.Append(" QueryPath: ").Append(QueryPath).Append("\n"); + sb.Append(" QueryRequestMethod: ").Append(QueryRequestMethod).Append("\n"); + sb.Append(" QueryRequestUrl: ").Append(QueryRequestUrl).Append("\n"); + sb.Append(" QueryStatus: ").Append(QueryStatus).Append("\n"); + sb.Append(" QuerySuccess: ").Append(QuerySuccess).Append("\n"); + sb.Append(" ResultsUrl: ").Append(ResultsUrl).Append("\n"); + sb.Append(" StartAt: ").Append(StartAt).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActionNotificationExportEntityJsonConverter : JsonConverter + { + /// + /// The format to use to serialize EndAt + /// + public static string EndAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize StartAt + /// + public static string StartAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ActionNotificationExportEntity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option endAt = default; + Option exportVersion = default; + Option id = default; + Option queryFolder = default; + Option queryMessage = default; + Option queryPath = default; + Option queryRequestMethod = default; + Option queryRequestUrl = default; + Option queryStatus = default; + Option querySuccess = default; + Option resultsUrl = default; + Option startAt = default; + Option status = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "end_at": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + endAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "export_version": + exportVersion = new Option(utf8JsonReader.GetString()!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt32()); + break; + case "query_folder": + queryFolder = new Option(utf8JsonReader.GetString()!); + break; + case "query_message": + queryMessage = new Option(utf8JsonReader.GetString()!); + break; + case "query_path": + queryPath = new Option(utf8JsonReader.GetString()!); + break; + case "query_request_method": + queryRequestMethod = new Option(utf8JsonReader.GetString()!); + break; + case "query_request_url": + queryRequestUrl = new Option(utf8JsonReader.GetString()!); + break; + case "query_status": + queryStatus = new Option(utf8JsonReader.GetString()!); + break; + case "query_success": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + querySuccess = new Option(utf8JsonReader.GetBoolean()); + break; + case "results_url": + resultsUrl = new Option(utf8JsonReader.GetString()!); + break; + case "start_at": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + startAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "status": + status = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (endAt.IsSet && endAt.Value == null) + throw new ArgumentNullException(nameof(endAt), "Property is not nullable for class ActionNotificationExportEntity."); + + if (exportVersion.IsSet && exportVersion.Value == null) + throw new ArgumentNullException(nameof(exportVersion), "Property is not nullable for class ActionNotificationExportEntity."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryFolder.IsSet && queryFolder.Value == null) + throw new ArgumentNullException(nameof(queryFolder), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryMessage.IsSet && queryMessage.Value == null) + throw new ArgumentNullException(nameof(queryMessage), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryPath.IsSet && queryPath.Value == null) + throw new ArgumentNullException(nameof(queryPath), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryRequestMethod.IsSet && queryRequestMethod.Value == null) + throw new ArgumentNullException(nameof(queryRequestMethod), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryRequestUrl.IsSet && queryRequestUrl.Value == null) + throw new ArgumentNullException(nameof(queryRequestUrl), "Property is not nullable for class ActionNotificationExportEntity."); + + if (queryStatus.IsSet && queryStatus.Value == null) + throw new ArgumentNullException(nameof(queryStatus), "Property is not nullable for class ActionNotificationExportEntity."); + + if (querySuccess.IsSet && querySuccess.Value == null) + throw new ArgumentNullException(nameof(querySuccess), "Property is not nullable for class ActionNotificationExportEntity."); + + if (resultsUrl.IsSet && resultsUrl.Value == null) + throw new ArgumentNullException(nameof(resultsUrl), "Property is not nullable for class ActionNotificationExportEntity."); + + if (startAt.IsSet && startAt.Value == null) + throw new ArgumentNullException(nameof(startAt), "Property is not nullable for class ActionNotificationExportEntity."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class ActionNotificationExportEntity."); + + return new ActionNotificationExportEntity(endAt, exportVersion, id, queryFolder, queryMessage, queryPath, queryRequestMethod, queryRequestUrl, queryStatus, querySuccess, resultsUrl, startAt, status); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, actionNotificationExportEntity, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) + { + if (actionNotificationExportEntity.ExportVersionOption.IsSet && actionNotificationExportEntity.ExportVersion == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.ExportVersion), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryFolderOption.IsSet && actionNotificationExportEntity.QueryFolder == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryFolder), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryMessageOption.IsSet && actionNotificationExportEntity.QueryMessage == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryMessage), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryPathOption.IsSet && actionNotificationExportEntity.QueryPath == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryPath), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet && actionNotificationExportEntity.QueryRequestMethod == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestMethod), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet && actionNotificationExportEntity.QueryRequestUrl == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestUrl), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.QueryStatusOption.IsSet && actionNotificationExportEntity.QueryStatus == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryStatus), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.ResultsUrlOption.IsSet && actionNotificationExportEntity.ResultsUrl == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.ResultsUrl), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.StatusOption.IsSet && actionNotificationExportEntity.Status == null) + throw new ArgumentNullException(nameof(actionNotificationExportEntity.Status), "Property is required for class ActionNotificationExportEntity."); + + if (actionNotificationExportEntity.EndAtOption.IsSet) + writer.WriteString("end_at", actionNotificationExportEntity.EndAtOption.Value!.Value.ToString(EndAtFormat)); + + if (actionNotificationExportEntity.ExportVersionOption.IsSet) + writer.WriteString("export_version", actionNotificationExportEntity.ExportVersion); + + if (actionNotificationExportEntity.IdOption.IsSet) + writer.WriteNumber("id", actionNotificationExportEntity.IdOption.Value!.Value); + + if (actionNotificationExportEntity.QueryFolderOption.IsSet) + writer.WriteString("query_folder", actionNotificationExportEntity.QueryFolder); + + if (actionNotificationExportEntity.QueryMessageOption.IsSet) + writer.WriteString("query_message", actionNotificationExportEntity.QueryMessage); + + if (actionNotificationExportEntity.QueryPathOption.IsSet) + writer.WriteString("query_path", actionNotificationExportEntity.QueryPath); + + if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet) + writer.WriteString("query_request_method", actionNotificationExportEntity.QueryRequestMethod); + + if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet) + writer.WriteString("query_request_url", actionNotificationExportEntity.QueryRequestUrl); + + if (actionNotificationExportEntity.QueryStatusOption.IsSet) + writer.WriteString("query_status", actionNotificationExportEntity.QueryStatus); + + if (actionNotificationExportEntity.QuerySuccessOption.IsSet) + writer.WriteBoolean("query_success", actionNotificationExportEntity.QuerySuccessOption.Value!.Value); + + if (actionNotificationExportEntity.ResultsUrlOption.IsSet) + writer.WriteString("results_url", actionNotificationExportEntity.ResultsUrl); + + if (actionNotificationExportEntity.StartAtOption.IsSet) + writer.WriteString("start_at", actionNotificationExportEntity.StartAtOption.Value!.Value.ToString(StartAtFormat)); + + if (actionNotificationExportEntity.StatusOption.IsSet) + writer.WriteString("status", actionNotificationExportEntity.Status); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..9f99b6957b6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,31 @@ + + + + true + net8.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..1b9f504a56ef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md @@ -0,0 +1,190 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net8.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + GetApiKeysId_1ApiResponse apiResponse = await api.GetApiKeysId_1Async("todo"); + object model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + // the type of token here depends on the api security specifications + ApiKeyToken token = new("", ClientUtils.ApiKeyHeader.Authorization); + options.AddTokens(token); + + // optionally choose the method the tokens will be provided with, default is RateLimitProvider + options.UseProvider, ApiKeyToken>(); + + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### api_key + +- **Type**: API key +- **API key parameter name**: XFilesAPIKey +- **Location**: HTTP header + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.9.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: Files.com API +- appVersion: 0.0.1 +- appDescription: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net8.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. From 829aebed7db73c6a997020f3a50bd53cffed832f Mon Sep 17 00:00:00 2001 From: devhl Date: Fri, 4 Oct 2024 21:49:57 -0400 Subject: [PATCH 7/8] remove model not needed for this test --- .../src/test/resources/3_0/csharp/tags.json | 78 +-- .../latest/Tags/.openapi-generator/FILES | 2 - .../generichost/latest/Tags/api/openapi.yaml | 88 +-- .../models/ActionNotificationExportEntity.md | 23 - .../ActionNotificationExportEntityTests.cs | 174 ------ .../Client/HostConfiguration.cs | 1 - .../Model/ActionNotificationExportEntity.cs | 545 ------------------ 7 files changed, 2 insertions(+), 909 deletions(-) delete mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/tags.json b/modules/openapi-generator/src/test/resources/3_0/csharp/tags.json index 766f359def40..a293f015b754 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/tags.json +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/tags.json @@ -78,81 +78,5 @@ } } , - "definitions": { - "ActionNotificationExportEntity": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int32", - "example": 1, - "description": "History Export ID" - }, - "export_version": { - "type": "string", - "example": "example", - "description": "Version of the underlying records for the export." - }, - "start_at": { - "type": "string", - "format": "date-time", - "example": "2000-01-01T01:00:00Z", - "description": "Start date/time of export range." - }, - "end_at": { - "type": "string", - "format": "date-time", - "example": "2000-01-01T01:00:00Z", - "description": "End date/time of export range." - }, - "status": { - "type": "string", - "example": "ready", - "description": "Status of export. Valid values: `building`, `ready`, or `failed`" - }, - "query_path": { - "type": "string", - "example": "MyFile.txt", - "description": "Return notifications that were triggered by actions on this specific path." - }, - "query_folder": { - "type": "string", - "example": "MyFolder", - "description": "Return notifications that were triggered by actions in this folder." - }, - "query_message": { - "type": "string", - "example": "Connection Refused", - "description": "Error message associated with the request, if any." - }, - "query_request_method": { - "type": "string", - "example": "GET", - "description": "The HTTP request method used by the webhook." - }, - "query_request_url": { - "type": "string", - "example": "http://example.com/webhook", - "description": "The target webhook URL." - }, - "query_status": { - "type": "string", - "example": "200", - "description": "The HTTP status returned from the server in response to the webhook request." - }, - "query_success": { - "type": "boolean", - "example": true, - "description": "true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise." - }, - "results_url": { - "type": "string", - "example": "https://files.com/action_notification_results.csv", - "description": "If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV." - } - }, - "x-docs": "An ActionNotificationExport is an operation that provides access to outgoing webhook logs. Querying webhook logs is a little different than other APIs.\n\nAll queries against the archive must be submitted as Exports. (Even our Web UI creates an Export behind the scenes.)\n\nIn any query field in this API, you may specify multiple values separated by commas. That means that commas\ncannot be searched for themselves, and neither can single quotation marks.\n\nUse the following steps to complete an export:\n\n1. Initiate the export by using the Create Action Notification Export endpoint. Non Site Admins must query by folder or path.\n2. Using the `id` from the response to step 1, poll the Show Action Notification Export endpoint. Check the `status` field until it is `ready`.\n3. You can download the results of the export as a CSV file using the `results_url` field in the response from step 2. If you want to page through the records in JSON format, use the List Action Notification Export Results endpoint, passing the `id` that you got in step 1 as the `action_notification_export_id` parameter. Check the `X-Files-Cursor-Next` header to see if there are more records available, and resubmit the same request with a `cursor` parameter to fetch the next page of results. Unlike most API Endpoints, this endpoint does not provide `X-Files-Cursor-Prev` cursors allowing reverse pagination through the results. This is due to limitations in Amazon Athena, the underlying data lake for these records.\n\nIf you intend to use this API for high volume or automated use, please contact us with more information\nabout your use case.\n\n## Example Queries\n\n* History for a folder: `{ \"query_folder\": \"path/to/folder\" }`\n* History for a range of time: `{ \"start_at\": \"2021-03-18 12:00:00\", \"end_at\": \"2021-03-19 12:00:00\" }`\n* History of all notifications that used GET or POST: `{ \"query_request_method\": \"GET,POST\" }`\n", - "description": "ActionNotificationExportEntity model" - } - } + "definitions": {} } \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES index 2ef51ce0d61c..b08037a54926 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES @@ -6,7 +6,6 @@ appveyor.yml docs/apis/APIKEYSApi.md docs/apis/APIKeys0Api.md docs/apis/ApiKeys1Api.md -docs/models/ActionNotificationExportEntity.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -38,6 +37,5 @@ src/Org.OpenAPITools/Client/TokenProvider`1.cs src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs -src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs src/Org.OpenAPITools/Org.OpenAPITools.csproj src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml b/samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml index c943de9c72c0..f42e5890242f 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/latest/Tags/api/openapi.yaml @@ -44,93 +44,7 @@ paths: x-category: - developers components: - schemas: - ActionNotificationExportEntity: - description: ActionNotificationExportEntity model - properties: - id: - description: History Export ID - example: 1 - format: int32 - type: integer - export_version: - description: Version of the underlying records for the export. - example: example - type: string - start_at: - description: Start date/time of export range. - example: 2000-01-01T01:00:00Z - format: date-time - type: string - end_at: - description: End date/time of export range. - example: 2000-01-01T01:00:00Z - format: date-time - type: string - status: - description: "Status of export. Valid values: `building`, `ready`, or `failed`" - example: ready - type: string - query_path: - description: Return notifications that were triggered by actions on this - specific path. - example: MyFile.txt - type: string - query_folder: - description: Return notifications that were triggered by actions in this - folder. - example: MyFolder - type: string - query_message: - description: "Error message associated with the request, if any." - example: Connection Refused - type: string - query_request_method: - description: The HTTP request method used by the webhook. - example: GET - type: string - query_request_url: - description: The target webhook URL. - example: http://example.com/webhook - type: string - query_status: - description: The HTTP status returned from the server in response to the - webhook request. - example: "200" - type: string - query_success: - description: true if the webhook request succeeded (i.e. returned a 200 - or 204 response status). false otherwise. - example: true - type: boolean - results_url: - description: "If `status` is `ready`, this will be a URL where all the results\ - \ can be downloaded at once as a CSV." - example: https://files.com/action_notification_results.csv - type: string - type: object - x-docs: | - An ActionNotificationExport is an operation that provides access to outgoing webhook logs. Querying webhook logs is a little different than other APIs. - - All queries against the archive must be submitted as Exports. (Even our Web UI creates an Export behind the scenes.) - - In any query field in this API, you may specify multiple values separated by commas. That means that commas - cannot be searched for themselves, and neither can single quotation marks. - - Use the following steps to complete an export: - - 1. Initiate the export by using the Create Action Notification Export endpoint. Non Site Admins must query by folder or path. - 2. Using the `id` from the response to step 1, poll the Show Action Notification Export endpoint. Check the `status` field until it is `ready`. - 3. You can download the results of the export as a CSV file using the `results_url` field in the response from step 2. If you want to page through the records in JSON format, use the List Action Notification Export Results endpoint, passing the `id` that you got in step 1 as the `action_notification_export_id` parameter. Check the `X-Files-Cursor-Next` header to see if there are more records available, and resubmit the same request with a `cursor` parameter to fetch the next page of results. Unlike most API Endpoints, this endpoint does not provide `X-Files-Cursor-Prev` cursors allowing reverse pagination through the results. This is due to limitations in Amazon Athena, the underlying data lake for these records. - - If you intend to use this API for high volume or automated use, please contact us with more information - about your use case. - - ## Example Queries - - * History for a folder: `{ "query_folder": "path/to/folder" }` - * History for a range of time: `{ "start_at": "2021-03-18 12:00:00", "end_at": "2021-03-19 12:00:00" }` - * History of all notifications that used GET or POST: `{ "query_request_method": "GET,POST" }` + schemas: {} securitySchemes: api_key: description: API Key - supports user-based or site-wide API keys diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md b/samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md deleted file mode 100644 index c6730728c411..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/Tags/docs/models/ActionNotificationExportEntity.md +++ /dev/null @@ -1,23 +0,0 @@ -# Org.OpenAPITools.Model.ActionNotificationExportEntity -ActionNotificationExportEntity model - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**EndAt** | **DateTime** | End date/time of export range. | [optional] -**ExportVersion** | **string** | Version of the underlying records for the export. | [optional] -**Id** | **int** | History Export ID | [optional] -**QueryFolder** | **string** | Return notifications that were triggered by actions in this folder. | [optional] -**QueryMessage** | **string** | Error message associated with the request, if any. | [optional] -**QueryPath** | **string** | Return notifications that were triggered by actions on this specific path. | [optional] -**QueryRequestMethod** | **string** | The HTTP request method used by the webhook. | [optional] -**QueryRequestUrl** | **string** | The target webhook URL. | [optional] -**QueryStatus** | **string** | The HTTP status returned from the server in response to the webhook request. | [optional] -**QuerySuccess** | **bool** | true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. | [optional] -**ResultsUrl** | **string** | If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. | [optional] -**StartAt** | **DateTime** | Start date/time of export range. | [optional] -**Status** | **string** | Status of export. Valid values: `building`, `ready`, or `failed` | [optional] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs deleted file mode 100644 index f78ea44cd286..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Model/ActionNotificationExportEntityTests.cs +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing ActionNotificationExportEntity - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class ActionNotificationExportEntityTests : IDisposable - { - // TODO uncomment below to declare an instance variable for ActionNotificationExportEntity - //private ActionNotificationExportEntity instance; - - public ActionNotificationExportEntityTests() - { - // TODO uncomment below to create an instance of ActionNotificationExportEntity - //instance = new ActionNotificationExportEntity(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of ActionNotificationExportEntity - /// - [Fact] - public void ActionNotificationExportEntityInstanceTest() - { - // TODO uncomment below to test "IsType" ActionNotificationExportEntity - //Assert.IsType(instance); - } - - /// - /// Test the property 'EndAt' - /// - [Fact] - public void EndAtTest() - { - // TODO unit test for the property 'EndAt' - } - - /// - /// Test the property 'ExportVersion' - /// - [Fact] - public void ExportVersionTest() - { - // TODO unit test for the property 'ExportVersion' - } - - /// - /// Test the property 'Id' - /// - [Fact] - public void IdTest() - { - // TODO unit test for the property 'Id' - } - - /// - /// Test the property 'QueryFolder' - /// - [Fact] - public void QueryFolderTest() - { - // TODO unit test for the property 'QueryFolder' - } - - /// - /// Test the property 'QueryMessage' - /// - [Fact] - public void QueryMessageTest() - { - // TODO unit test for the property 'QueryMessage' - } - - /// - /// Test the property 'QueryPath' - /// - [Fact] - public void QueryPathTest() - { - // TODO unit test for the property 'QueryPath' - } - - /// - /// Test the property 'QueryRequestMethod' - /// - [Fact] - public void QueryRequestMethodTest() - { - // TODO unit test for the property 'QueryRequestMethod' - } - - /// - /// Test the property 'QueryRequestUrl' - /// - [Fact] - public void QueryRequestUrlTest() - { - // TODO unit test for the property 'QueryRequestUrl' - } - - /// - /// Test the property 'QueryStatus' - /// - [Fact] - public void QueryStatusTest() - { - // TODO unit test for the property 'QueryStatus' - } - - /// - /// Test the property 'QuerySuccess' - /// - [Fact] - public void QuerySuccessTest() - { - // TODO unit test for the property 'QuerySuccess' - } - - /// - /// Test the property 'ResultsUrl' - /// - [Fact] - public void ResultsUrlTest() - { - // TODO unit test for the property 'ResultsUrl' - } - - /// - /// Test the property 'StartAt' - /// - [Fact] - public void StartAtTest() - { - // TODO unit test for the property 'StartAt' - } - - /// - /// Test the property 'Status' - /// - [Fact] - public void StatusTest() - { - // TODO unit test for the property 'Status' - } - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs index f8fa10ad1eff..26ad982aba2d 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -44,7 +44,6 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); - _jsonOptions.Converters.Add(new ActionNotificationExportEntityJsonConverter()); JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs deleted file mode 100644 index ab22c4749bcb..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Model/ActionNotificationExportEntity.cs +++ /dev/null @@ -1,545 +0,0 @@ -// -/* - * Files.com API - * - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: 0.0.1 - * Contact: support@files.com - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.ComponentModel.DataAnnotations; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools.Model -{ - /// - /// ActionNotificationExportEntity model - /// - public partial class ActionNotificationExportEntity : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// End date/time of export range. - /// Version of the underlying records for the export. - /// History Export ID - /// Return notifications that were triggered by actions in this folder. - /// Error message associated with the request, if any. - /// Return notifications that were triggered by actions on this specific path. - /// The HTTP request method used by the webhook. - /// The target webhook URL. - /// The HTTP status returned from the server in response to the webhook request. - /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. - /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. - /// Start date/time of export range. - /// Status of export. Valid values: `building`, `ready`, or `failed` - [JsonConstructor] - public ActionNotificationExportEntity(Option endAt = default, Option exportVersion = default, Option id = default, Option queryFolder = default, Option queryMessage = default, Option queryPath = default, Option queryRequestMethod = default, Option queryRequestUrl = default, Option queryStatus = default, Option querySuccess = default, Option resultsUrl = default, Option startAt = default, Option status = default) - { - EndAtOption = endAt; - ExportVersionOption = exportVersion; - IdOption = id; - QueryFolderOption = queryFolder; - QueryMessageOption = queryMessage; - QueryPathOption = queryPath; - QueryRequestMethodOption = queryRequestMethod; - QueryRequestUrlOption = queryRequestUrl; - QueryStatusOption = queryStatus; - QuerySuccessOption = querySuccess; - ResultsUrlOption = resultsUrl; - StartAtOption = startAt; - StatusOption = status; - OnCreated(); - } - - partial void OnCreated(); - - /// - /// Used to track the state of EndAt - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option EndAtOption { get; private set; } - - /// - /// End date/time of export range. - /// - /// End date/time of export range. - /* 2000-01-01T01:00Z */ - [JsonPropertyName("end_at")] - public DateTime? EndAt { get { return this.EndAtOption; } set { this.EndAtOption = new(value); } } - - /// - /// Used to track the state of ExportVersion - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option ExportVersionOption { get; private set; } - - /// - /// Version of the underlying records for the export. - /// - /// Version of the underlying records for the export. - /* example */ - [JsonPropertyName("export_version")] - public string? ExportVersion { get { return this.ExportVersionOption; } set { this.ExportVersionOption = new(value); } } - - /// - /// Used to track the state of Id - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option IdOption { get; private set; } - - /// - /// History Export ID - /// - /// History Export ID - /* 1 */ - [JsonPropertyName("id")] - public int? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } - - /// - /// Used to track the state of QueryFolder - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryFolderOption { get; private set; } - - /// - /// Return notifications that were triggered by actions in this folder. - /// - /// Return notifications that were triggered by actions in this folder. - /* MyFolder */ - [JsonPropertyName("query_folder")] - public string? QueryFolder { get { return this.QueryFolderOption; } set { this.QueryFolderOption = new(value); } } - - /// - /// Used to track the state of QueryMessage - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryMessageOption { get; private set; } - - /// - /// Error message associated with the request, if any. - /// - /// Error message associated with the request, if any. - /* Connection Refused */ - [JsonPropertyName("query_message")] - public string? QueryMessage { get { return this.QueryMessageOption; } set { this.QueryMessageOption = new(value); } } - - /// - /// Used to track the state of QueryPath - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryPathOption { get; private set; } - - /// - /// Return notifications that were triggered by actions on this specific path. - /// - /// Return notifications that were triggered by actions on this specific path. - /* MyFile.txt */ - [JsonPropertyName("query_path")] - public string? QueryPath { get { return this.QueryPathOption; } set { this.QueryPathOption = new(value); } } - - /// - /// Used to track the state of QueryRequestMethod - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryRequestMethodOption { get; private set; } - - /// - /// The HTTP request method used by the webhook. - /// - /// The HTTP request method used by the webhook. - /* GET */ - [JsonPropertyName("query_request_method")] - public string? QueryRequestMethod { get { return this.QueryRequestMethodOption; } set { this.QueryRequestMethodOption = new(value); } } - - /// - /// Used to track the state of QueryRequestUrl - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryRequestUrlOption { get; private set; } - - /// - /// The target webhook URL. - /// - /// The target webhook URL. - /* http://example.com/webhook */ - [JsonPropertyName("query_request_url")] - public string? QueryRequestUrl { get { return this.QueryRequestUrlOption; } set { this.QueryRequestUrlOption = new(value); } } - - /// - /// Used to track the state of QueryStatus - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QueryStatusOption { get; private set; } - - /// - /// The HTTP status returned from the server in response to the webhook request. - /// - /// The HTTP status returned from the server in response to the webhook request. - /* 200 */ - [JsonPropertyName("query_status")] - public string? QueryStatus { get { return this.QueryStatusOption; } set { this.QueryStatusOption = new(value); } } - - /// - /// Used to track the state of QuerySuccess - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option QuerySuccessOption { get; private set; } - - /// - /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. - /// - /// true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise. - /* true */ - [JsonPropertyName("query_success")] - public bool? QuerySuccess { get { return this.QuerySuccessOption; } set { this.QuerySuccessOption = new(value); } } - - /// - /// Used to track the state of ResultsUrl - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option ResultsUrlOption { get; private set; } - - /// - /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. - /// - /// If `status` is `ready`, this will be a URL where all the results can be downloaded at once as a CSV. - /* https://files.com/action_notification_results.csv */ - [JsonPropertyName("results_url")] - public string? ResultsUrl { get { return this.ResultsUrlOption; } set { this.ResultsUrlOption = new(value); } } - - /// - /// Used to track the state of StartAt - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option StartAtOption { get; private set; } - - /// - /// Start date/time of export range. - /// - /// Start date/time of export range. - /* 2000-01-01T01:00Z */ - [JsonPropertyName("start_at")] - public DateTime? StartAt { get { return this.StartAtOption; } set { this.StartAtOption = new(value); } } - - /// - /// Used to track the state of Status - /// - [JsonIgnore] - [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] - public Option StatusOption { get; private set; } - - /// - /// Status of export. Valid values: `building`, `ready`, or `failed` - /// - /// Status of export. Valid values: `building`, `ready`, or `failed` - /* ready */ - [JsonPropertyName("status")] - public string? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ActionNotificationExportEntity {\n"); - sb.Append(" EndAt: ").Append(EndAt).Append("\n"); - sb.Append(" ExportVersion: ").Append(ExportVersion).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" QueryFolder: ").Append(QueryFolder).Append("\n"); - sb.Append(" QueryMessage: ").Append(QueryMessage).Append("\n"); - sb.Append(" QueryPath: ").Append(QueryPath).Append("\n"); - sb.Append(" QueryRequestMethod: ").Append(QueryRequestMethod).Append("\n"); - sb.Append(" QueryRequestUrl: ").Append(QueryRequestUrl).Append("\n"); - sb.Append(" QueryStatus: ").Append(QueryStatus).Append("\n"); - sb.Append(" QuerySuccess: ").Append(QuerySuccess).Append("\n"); - sb.Append(" ResultsUrl: ").Append(ResultsUrl).Append("\n"); - sb.Append(" StartAt: ").Append(StartAt).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - - /// - /// A Json converter for type - /// - public class ActionNotificationExportEntityJsonConverter : JsonConverter - { - /// - /// The format to use to serialize EndAt - /// - public static string EndAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize StartAt - /// - public static string StartAtFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// Deserializes json to - /// - /// - /// - /// - /// - /// - public override ActionNotificationExportEntity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) - { - int currentDepth = utf8JsonReader.CurrentDepth; - - if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) - throw new JsonException(); - - JsonTokenType startingTokenType = utf8JsonReader.TokenType; - - Option endAt = default; - Option exportVersion = default; - Option id = default; - Option queryFolder = default; - Option queryMessage = default; - Option queryPath = default; - Option queryRequestMethod = default; - Option queryRequestUrl = default; - Option queryStatus = default; - Option querySuccess = default; - Option resultsUrl = default; - Option startAt = default; - Option status = default; - - while (utf8JsonReader.Read()) - { - if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) - { - string? localVarJsonPropertyName = utf8JsonReader.GetString(); - utf8JsonReader.Read(); - - switch (localVarJsonPropertyName) - { - case "end_at": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - endAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "export_version": - exportVersion = new Option(utf8JsonReader.GetString()!); - break; - case "id": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt32()); - break; - case "query_folder": - queryFolder = new Option(utf8JsonReader.GetString()!); - break; - case "query_message": - queryMessage = new Option(utf8JsonReader.GetString()!); - break; - case "query_path": - queryPath = new Option(utf8JsonReader.GetString()!); - break; - case "query_request_method": - queryRequestMethod = new Option(utf8JsonReader.GetString()!); - break; - case "query_request_url": - queryRequestUrl = new Option(utf8JsonReader.GetString()!); - break; - case "query_status": - queryStatus = new Option(utf8JsonReader.GetString()!); - break; - case "query_success": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - querySuccess = new Option(utf8JsonReader.GetBoolean()); - break; - case "results_url": - resultsUrl = new Option(utf8JsonReader.GetString()!); - break; - case "start_at": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - startAt = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "status": - status = new Option(utf8JsonReader.GetString()!); - break; - default: - break; - } - } - } - - if (endAt.IsSet && endAt.Value == null) - throw new ArgumentNullException(nameof(endAt), "Property is not nullable for class ActionNotificationExportEntity."); - - if (exportVersion.IsSet && exportVersion.Value == null) - throw new ArgumentNullException(nameof(exportVersion), "Property is not nullable for class ActionNotificationExportEntity."); - - if (id.IsSet && id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryFolder.IsSet && queryFolder.Value == null) - throw new ArgumentNullException(nameof(queryFolder), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryMessage.IsSet && queryMessage.Value == null) - throw new ArgumentNullException(nameof(queryMessage), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryPath.IsSet && queryPath.Value == null) - throw new ArgumentNullException(nameof(queryPath), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryRequestMethod.IsSet && queryRequestMethod.Value == null) - throw new ArgumentNullException(nameof(queryRequestMethod), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryRequestUrl.IsSet && queryRequestUrl.Value == null) - throw new ArgumentNullException(nameof(queryRequestUrl), "Property is not nullable for class ActionNotificationExportEntity."); - - if (queryStatus.IsSet && queryStatus.Value == null) - throw new ArgumentNullException(nameof(queryStatus), "Property is not nullable for class ActionNotificationExportEntity."); - - if (querySuccess.IsSet && querySuccess.Value == null) - throw new ArgumentNullException(nameof(querySuccess), "Property is not nullable for class ActionNotificationExportEntity."); - - if (resultsUrl.IsSet && resultsUrl.Value == null) - throw new ArgumentNullException(nameof(resultsUrl), "Property is not nullable for class ActionNotificationExportEntity."); - - if (startAt.IsSet && startAt.Value == null) - throw new ArgumentNullException(nameof(startAt), "Property is not nullable for class ActionNotificationExportEntity."); - - if (status.IsSet && status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class ActionNotificationExportEntity."); - - return new ActionNotificationExportEntity(endAt, exportVersion, id, queryFolder, queryMessage, queryPath, queryRequestMethod, queryRequestUrl, queryStatus, querySuccess, resultsUrl, startAt, status); - } - - /// - /// Serializes a - /// - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) - { - writer.WriteStartObject(); - - WriteProperties(writer, actionNotificationExportEntity, jsonSerializerOptions); - writer.WriteEndObject(); - } - - /// - /// Serializes the properties of - /// - /// - /// - /// - /// - public void WriteProperties(Utf8JsonWriter writer, ActionNotificationExportEntity actionNotificationExportEntity, JsonSerializerOptions jsonSerializerOptions) - { - if (actionNotificationExportEntity.ExportVersionOption.IsSet && actionNotificationExportEntity.ExportVersion == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.ExportVersion), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryFolderOption.IsSet && actionNotificationExportEntity.QueryFolder == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryFolder), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryMessageOption.IsSet && actionNotificationExportEntity.QueryMessage == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryMessage), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryPathOption.IsSet && actionNotificationExportEntity.QueryPath == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryPath), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet && actionNotificationExportEntity.QueryRequestMethod == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestMethod), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet && actionNotificationExportEntity.QueryRequestUrl == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryRequestUrl), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.QueryStatusOption.IsSet && actionNotificationExportEntity.QueryStatus == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.QueryStatus), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.ResultsUrlOption.IsSet && actionNotificationExportEntity.ResultsUrl == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.ResultsUrl), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.StatusOption.IsSet && actionNotificationExportEntity.Status == null) - throw new ArgumentNullException(nameof(actionNotificationExportEntity.Status), "Property is required for class ActionNotificationExportEntity."); - - if (actionNotificationExportEntity.EndAtOption.IsSet) - writer.WriteString("end_at", actionNotificationExportEntity.EndAtOption.Value!.Value.ToString(EndAtFormat)); - - if (actionNotificationExportEntity.ExportVersionOption.IsSet) - writer.WriteString("export_version", actionNotificationExportEntity.ExportVersion); - - if (actionNotificationExportEntity.IdOption.IsSet) - writer.WriteNumber("id", actionNotificationExportEntity.IdOption.Value!.Value); - - if (actionNotificationExportEntity.QueryFolderOption.IsSet) - writer.WriteString("query_folder", actionNotificationExportEntity.QueryFolder); - - if (actionNotificationExportEntity.QueryMessageOption.IsSet) - writer.WriteString("query_message", actionNotificationExportEntity.QueryMessage); - - if (actionNotificationExportEntity.QueryPathOption.IsSet) - writer.WriteString("query_path", actionNotificationExportEntity.QueryPath); - - if (actionNotificationExportEntity.QueryRequestMethodOption.IsSet) - writer.WriteString("query_request_method", actionNotificationExportEntity.QueryRequestMethod); - - if (actionNotificationExportEntity.QueryRequestUrlOption.IsSet) - writer.WriteString("query_request_url", actionNotificationExportEntity.QueryRequestUrl); - - if (actionNotificationExportEntity.QueryStatusOption.IsSet) - writer.WriteString("query_status", actionNotificationExportEntity.QueryStatus); - - if (actionNotificationExportEntity.QuerySuccessOption.IsSet) - writer.WriteBoolean("query_success", actionNotificationExportEntity.QuerySuccessOption.Value!.Value); - - if (actionNotificationExportEntity.ResultsUrlOption.IsSet) - writer.WriteString("results_url", actionNotificationExportEntity.ResultsUrl); - - if (actionNotificationExportEntity.StartAtOption.IsSet) - writer.WriteString("start_at", actionNotificationExportEntity.StartAtOption.Value!.Value.ToString(StartAtFormat)); - - if (actionNotificationExportEntity.StatusOption.IsSet) - writer.WriteString("status", actionNotificationExportEntity.Status); - } - } -} From 2e578bf9c24a6eb7a284cfdb5b25c5ce7040e770 Mon Sep 17 00:00:00 2001 From: devhl Date: Fri, 4 Oct 2024 22:02:21 -0400 Subject: [PATCH 8/8] handle specs with no models --- .../csharp/libraries/generichost/ClientUtils.mustache | 4 ++++ .../csharp/libraries/generichost/HostConfiguration.mustache | 4 ++++ .../latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs | 1 - .../Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs | 1 - 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache index 65a97f9ef1b6..9348888eafe4 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache @@ -12,7 +12,11 @@ using System.Text; using System.Text.Json; using System.Text.RegularExpressions;{{#useCompareNetObjects}} using KellermanSoftware.CompareNetObjects;{{/useCompareNetObjects}} +{{#models}} +{{#-first}} using {{packageName}}.{{modelPackage}}; +{{/-first}} +{{/models}} using System.Runtime.CompilerServices; {{>Assembly}}namespace {{packageName}}.{{clientPackage}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache index d7d1e3bf3a8c..1333f0e67ea2 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache @@ -11,7 +11,11 @@ using System.Text.Json.Serialization; using System.Net.Http; using Microsoft.Extensions.DependencyInjection; using {{packageName}}.{{apiPackage}}; +{{#models}} +{{#-first}} using {{packageName}}.{{modelPackage}}; +{{/-first}} +{{/models}} namespace {{packageName}}.{{clientPackage}} { diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs index adf46fb12a6e..f14c41cebb10 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -18,7 +18,6 @@ using System.Text; using System.Text.Json; using System.Text.RegularExpressions; -using Org.OpenAPITools.Model; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs index 26ad982aba2d..c1f92ea60d77 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -18,7 +18,6 @@ using System.Net.Http; using Microsoft.Extensions.DependencyInjection; using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; namespace Org.OpenAPITools.Client {