From b335ba834f07122bdee48f2999d3c769186b31bd Mon Sep 17 00:00:00 2001 From: de1mos Date: Thu, 1 Apr 2021 08:47:11 +0700 Subject: [PATCH 01/89] fix #7325 kotlin-spring fix reactive delegate pattern combination (#8867) * #7325 kotlin-spring remove exchange field from reactive delegate pattern * #7325 remove examples from kotlin-spring reactive delegate and add missing import * #7325 add test assertions * fix swagger spec in test --- .../kotlin-spring/apiDelegate.mustache | 3 +- .../kotlin-spring/apiInterface.mustache | 2 +- .../kotlin-spring/methodBody.mustache | 5 ++ .../spring/KotlinSpringServerCodegenTest.java | 60 +++++++++++++++++-- ...325-use-delegate-reactive-tags-kotlin.yaml | 35 +++++++++++ 5 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 modules/openapi-generator/src/test/resources/3_0/kotlin/issue7325-use-delegate-reactive-tags-kotlin.yaml diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache index d45f9f79f2e..bbf57f85b7b 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiDelegate.mustache @@ -8,6 +8,7 @@ import org.springframework.http.ResponseEntity import org.springframework.web.context.request.NativeWebRequest import org.springframework.core.io.Resource {{#reactive}} +import kotlinx.coroutines.flow.Flow import org.springframework.web.server.ServerWebExchange import reactor.core.publisher.Flux import reactor.core.publisher.Mono @@ -32,7 +33,7 @@ interface {{classname}}Delegate { /** * @see {{classname}}#{{operationId}} */ - fun {{operationId}}({{#allParams}}{{paramName}}: {{^isFile}}{{>optionalDataType}}{{/isFile}}{{#isFile}}Resource?{{/isFile}}{{^-last}}, + {{#reactive}}{{^isArray}}suspend {{/isArray}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isFile}}{{>optionalDataType}}{{/isFile}}{{#isFile}}Resource?{{/isFile}}{{^-last}}, {{/-last}}{{/allParams}}): {{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} { {{>methodBody}} } diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache index bc224b50080..5e9b3888c8d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/apiInterface.mustache @@ -83,7 +83,7 @@ interface {{classname}} { return {{>returnValue}} {{/isDelegate}} {{#isDelegate}} - return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}exchange{{/reactive}}); + return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{/isDelegate}} } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache index 69a9fd42d93..3e3b63e9ab0 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/methodBody.mustache @@ -1,3 +1,4 @@ +{{^reactive}} {{#examples}} {{#-first}} {{#async}} @@ -21,3 +22,7 @@ return CompletableFuture.supplyAsync(()-> { {{^examples}} return {{#async}}CompletableFuture.completedFuture({{/async}}ResponseEntity({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}) {{/examples}} +{{/reactive}} +{{#reactive}} +return ResponseEntity({{#returnSuccessCode}}HttpStatus.OK{{/returnSuccessCode}}{{^returnSuccessCode}}HttpStatus.NOT_IMPLEMENTED{{/returnSuccessCode}}) +{{/reactive}} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index b77afc858f9..dc3bceaa435 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -1,9 +1,14 @@ package org.openapitools.codegen.kotlin.spring; import com.google.common.collect.testing.Helpers; - +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.servers.Server; import org.apache.commons.io.FileUtils; -import org.openapitools.codegen.*; +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.kotlin.KotlinTestUtils; import org.openapitools.codegen.languages.KotlinSpringServerCodegen; import org.testng.Assert; @@ -11,12 +16,12 @@ import org.testng.annotations.Test; import java.io.File; import java.nio.file.Files; +import java.nio.file.Paths; import java.util.Collections; import java.util.List; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.servers.Server; +import static org.openapitools.codegen.TestUtils.assertFileContains; +import static org.openapitools.codegen.TestUtils.assertFileNotContains; public class KotlinSpringServerCodegenTest { @@ -203,4 +208,49 @@ public class KotlinSpringServerCodegenTest { new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt") ); } + + @Test(description = "test delegate reactive with tags") + public void delegateReactiveWithTags() throws Exception { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); //may be move to /build + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(KotlinSpringServerCodegen.DELEGATE_PATTERN, true); + codegen.additionalProperties().put(KotlinSpringServerCodegen.REACTIVE, true); + codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_TAGS, true); + + List files = new DefaultGenerator() + .opts( + new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/issue7325-use-delegate-reactive-tags-kotlin.yaml")) + .config(codegen) + ) + .generate(); + + Helpers.assertContainsAllOf(files, + new File(output, "src/main/kotlin/org/openapitools/api/TestV1Api.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiController.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2Api.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiController.kt"), + new File(output, "src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt") + ); + + assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1Api.kt"), + "suspend fun"); + assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1Api.kt"), + "exchange"); + assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), + "suspend fun"); + assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV1ApiDelegate.kt"), + "ApiUtil"); + + assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2Api.kt"), + "import kotlinx.coroutines.flow.Flow", "ResponseEntity>"); + assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2Api.kt"), + "exchange"); + assertFileContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt"), + "import kotlinx.coroutines.flow.Flow"); + assertFileNotContains(Paths.get(output + "/src/main/kotlin/org/openapitools/api/TestV2ApiDelegate.kt"), + "suspend fun", "ApiUtil"); + } } diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/issue7325-use-delegate-reactive-tags-kotlin.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue7325-use-delegate-reactive-tags-kotlin.yaml new file mode 100644 index 00000000000..3a14311e1ca --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/issue7325-use-delegate-reactive-tags-kotlin.yaml @@ -0,0 +1,35 @@ +openapi: "3.0.1" +info: + title: test + version: "1.0" + +paths: + + /api/v1/test/{id}: + get: + tags: [Test v1] + operationId: test1 + parameters: + - name: id + in: path + schema: + type: string + responses: + 200: + description: OK + + /api/v2/test: + get: + tags: [Test v2] + operationId: test2 + responses: + 200: + description: OK + content: + application/json: + schema: + type: array + items: + type: string + + From 57e44e173f99c1463bfb62749c8fc14a10639ae9 Mon Sep 17 00:00:00 2001 From: cal Date: Thu, 1 Apr 2021 05:32:10 +0200 Subject: [PATCH 02/89] [cleanup] erefactor/EclipseJdt - Evaluate without null check (#9134) EclipseJdt cleanup 'EvaluateNullable' applied by erefactor. For EclipseJdt see https://www.eclipse.org/eclipse/news/4.19/jdt.php For erefactor see https://github.com/cal101/erefactor --- .../codegen/languages/PhpSymfonyServerCodegen.java | 2 +- .../org/openapitools/codegen/languages/RustServerCodegen.java | 4 ++-- .../org/openapitools/codegen/languages/Swift4Codegen.java | 4 ++-- .../openapitools/codegen/languages/Swift5ClientCodegen.java | 4 ++-- .../codegen/languages/TypeScriptAngularClientCodegen.java | 2 +- .../codegen/languages/TypeScriptInversifyClientCodegen.java | 2 +- .../codegen/languages/TypeScriptNestjsClientCodegen.java | 2 +- .../codegen/languages/TypeScriptNodeClientCodegen.java | 2 +- .../codegen/languages/TypeScriptRxjsClientCodegen.java | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java index 9d468195f85..bfc5a4593b9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java @@ -429,7 +429,7 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg // Create a variable to display the correct return type in comments for interfaces if (op.returnType != null) { op.vendorExtensions.put("x-comment-type", op.returnType); - if (op.returnContainer != null && "array".equals(op.returnContainer)) { + if ("array".equals(op.returnContainer)) { op.vendorExtensions.put("x-comment-type", op.returnType + "[]"); } } else { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index 5ff03773da1..a47e86573fb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -1560,12 +1560,12 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { LOGGER.trace("Post processing model: {}", cm); - if (cm.dataType != null && "object".equals(cm.dataType)) { + if ("object".equals(cm.dataType)) { // Object isn't a sensible default. Instead, we set it to // 'null'. This ensures that we treat this model as a struct // with multiple parameters. cm.dataType = null; - } else if (cm.dataType != null && "map".equals(cm.dataType)) { + } else if ("map".equals(cm.dataType)) { if (!cm.allVars.isEmpty() || cm.additionalPropertiesType == null) { // We don't yet support `additionalProperties` that also have // properties. If we see variables, we ignore the diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java index e5724a3c7e8..0133cfb3c17 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift4Codegen.java @@ -534,12 +534,12 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { @Override public boolean isDataTypeFile(String dataType) { - return dataType != null && "URL".equals(dataType); + return "URL".equals(dataType); } @Override public boolean isDataTypeBinary(final String dataType) { - return dataType != null && "Data".equals(dataType); + return "Data".equals(dataType); } /** diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java index a5d71b4d302..5d563656b58 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift5ClientCodegen.java @@ -546,12 +546,12 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig @Override public boolean isDataTypeFile(String dataType) { - return dataType != null && "URL".equals(dataType); + return "URL".equals(dataType); } @Override public boolean isDataTypeBinary(final String dataType) { - return dataType != null && "Data".equals(dataType); + return "Data".equals(dataType); } /** diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index 77bf353a41a..e91ddecda38 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -384,7 +384,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode @Override public boolean isDataTypeFile(final String dataType) { - return dataType != null && "Blob".equals(dataType); + return "Blob".equals(dataType); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java index 4b3daba3f85..6de4f086413 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java @@ -141,7 +141,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo @Override public boolean isDataTypeFile(final String dataType) { - return dataType != null && "Blob".equals(dataType); + return "Blob".equals(dataType); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java index 4e5e6c903ce..771e66db0a4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java @@ -216,7 +216,7 @@ public class TypeScriptNestjsClientCodegen extends AbstractTypeScriptClientCodeg @Override public boolean isDataTypeFile(final String dataType) { - return dataType != null && "Blob".equals(dataType); + return "Blob".equals(dataType); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java index 9ff6f444c57..613b9da70f2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java @@ -82,7 +82,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen @Override public boolean isDataTypeFile(final String dataType) { - return dataType != null && "RequestFile".equals(dataType); + return "RequestFile".equals(dataType); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java index a2f79f519ad..bdecf7febe1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java @@ -98,7 +98,7 @@ public class TypeScriptRxjsClientCodegen extends AbstractTypeScriptClientCodegen @Override public boolean isDataTypeFile(final String dataType) { - return dataType != null && "Blob".equals(dataType); + return "Blob".equals(dataType); } @Override From 7bf792a3485b967a2ae74f6b3bb3a337ba47e1bb Mon Sep 17 00:00:00 2001 From: sforst Date: Thu, 1 Apr 2021 10:57:36 +0200 Subject: [PATCH 03/89] [typescript-axios] handle uniqueItems in query and header parameters (#8965) * [typescript-axios] handle uniqueItems in query and header parameters add endpoint /fake/test-unique-paramters to petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml for demonstration * update samples * [typescript-axios] update samples Co-authored-by: William Cheng --- ...odels-for-testing-with-http-signature.yaml | 3 + .../typescript-axios/apiInner.mustache | 15 + ...odels-for-testing-with-http-signature.yaml | 33 + .../.gitignore | 4 + .../.npmignore | 1 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 8 + .../.openapi-generator/VERSION | 1 + .../api.ts | 4615 +++++++++++++++++ .../base.ts | 71 + .../common.ts | 138 + .../configuration.ts | 101 + .../git_push.sh | 58 + .../index.ts | 18 + .../client/petstore/go/go-petstore/README.md | 1 + .../petstore/go/go-petstore/api/openapi.yaml | 37 + .../petstore/go/go-petstore/api_fake.go | 144 + .../petstore/go/go-petstore/docs/FakeApi.md | 69 + 18 files changed, 5340 insertions(+) create mode 100644 bin/configs/typescript-axios-with-fake-endpoints-models-for-testing-with-http-signature.yaml create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.gitignore create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.npmignore create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator-ignore create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/FILES create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/VERSION create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/base.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/git_push.sh create mode 100644 samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/index.ts diff --git a/bin/configs/typescript-axios-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/bin/configs/typescript-axios-with-fake-endpoints-models-for-testing-with-http-signature.yaml new file mode 100644 index 00000000000..1cb364d79ea --- /dev/null +++ b/bin/configs/typescript-axios-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -0,0 +1,3 @@ +generatorName: typescript-axios +outputDir: samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache index 71981cf8fca..ddcbbbb86e9 100644 --- a/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache @@ -86,10 +86,20 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{#isArray}} if ({{paramName}}) { {{#isCollectionFormatMulti}} + {{#uniqueItems}} + localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}); + {{/uniqueItems}} + {{^uniqueItems}} localVarQueryParameter['{{baseName}}'] = {{paramName}}; + {{/uniqueItems}} {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} + {{#uniqueItems}} + localVarQueryParameter['{{baseName}}'] = Array.from({{paramName}}).join(COLLECTION_FORMATS.{{collectionFormat}}); + {{/uniqueItems}} + {{^uniqueItems}} localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS.{{collectionFormat}}); + {{/uniqueItems}} {{/isCollectionFormatMulti}} } {{/isArray}} @@ -117,7 +127,12 @@ export const {{classname}}AxiosParamCreator = function (configuration?: Configur {{#headerParams}} {{#isArray}} if ({{paramName}}) { + {{#uniqueItems}} + let mapped = Array.from({{paramName}}).map(value => ("{{{dataType}}}" !== "Set") ? JSON.stringify(value) : (value || "")); + {{/uniqueItems}} + {{^uniqueItems}} let mapped = {{paramName}}.map(value => ("{{{dataType}}}" !== "Array") ? JSON.stringify(value) : (value || "")); + {{/uniqueItems}} localVarHeaderParameter['{{baseName}}'] = mapped.join(COLLECTION_FORMATS["{{collectionFormat}}"]); } {{/isArray}} diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 8c5c0fffd02..b1490fa6798 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1044,6 +1044,39 @@ paths: responses: "200": description: Success + /fake/test-unique-paramters: + put: + tags: + - fake + description: To test unique items in header and query parameters + operationId: testUniqueItemsHeaderAndQueryParameterCollectionFormat + parameters: + - name: queryUnique + in: query + required: true + schema: + type: array + uniqueItems: true + items: + type: string + - name: headerUnique + in: header + required: true + schema: + type: array + uniqueItems: true + items: + type: string + responses: + "200": + description: Success + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + uniqueItems: true '/fake/{petId}/uploadImageWithRequiredFile': post: tags: diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.gitignore b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.gitignore new file mode 100644 index 00000000000..149b5765472 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.npmignore b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.npmignore new file mode 100644 index 00000000000..999d88df693 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.npmignore @@ -0,0 +1 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator-ignore b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.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/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/FILES b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/FILES new file mode 100644 index 00000000000..a80cd4f07b0 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/FILES @@ -0,0 +1,8 @@ +.gitignore +.npmignore +api.ts +base.ts +common.ts +configuration.ts +git_push.sh +index.ts diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/VERSION new file mode 100644 index 00000000000..d509cc92aa8 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.1.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts new file mode 100644 index 00000000000..44ad2dc5a0a --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/api.ts @@ -0,0 +1,4615 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from './configuration'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; + +/** + * + * @export + * @interface AdditionalPropertiesClass + */ +export interface AdditionalPropertiesClass { + /** + * + * @type {{ [key: string]: string; }} + * @memberof AdditionalPropertiesClass + */ + map_property?: { [key: string]: string; }; + /** + * + * @type {{ [key: string]: { [key: string]: string; }; }} + * @memberof AdditionalPropertiesClass + */ + map_of_map_property?: { [key: string]: { [key: string]: string; }; }; +} +/** + * + * @export + * @interface Animal + */ +export interface Animal { + /** + * + * @type {string} + * @memberof Animal + */ + className: string; + /** + * + * @type {string} + * @memberof Animal + */ + color?: string; +} +/** + * + * @export + * @interface ApiResponse + */ +export interface ApiResponse { + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; +} +/** + * + * @export + * @interface Apple + */ +export interface Apple { + /** + * + * @type {string} + * @memberof Apple + */ + cultivar?: string; +} +/** + * + * @export + * @interface AppleReq + */ +export interface AppleReq { + /** + * + * @type {string} + * @memberof AppleReq + */ + cultivar: string; + /** + * + * @type {boolean} + * @memberof AppleReq + */ + mealy?: boolean; +} +/** + * + * @export + * @interface ArrayOfArrayOfNumberOnly + */ +export interface ArrayOfArrayOfNumberOnly { + /** + * + * @type {Array>} + * @memberof ArrayOfArrayOfNumberOnly + */ + ArrayArrayNumber?: Array>; +} +/** + * + * @export + * @interface ArrayOfNumberOnly + */ +export interface ArrayOfNumberOnly { + /** + * + * @type {Array} + * @memberof ArrayOfNumberOnly + */ + ArrayNumber?: Array; +} +/** + * + * @export + * @interface ArrayTest + */ +export interface ArrayTest { + /** + * + * @type {Array} + * @memberof ArrayTest + */ + array_of_string?: Array; + /** + * + * @type {Array>} + * @memberof ArrayTest + */ + array_array_of_integer?: Array>; + /** + * + * @type {Array>} + * @memberof ArrayTest + */ + array_array_of_model?: Array>; +} +/** + * + * @export + * @interface Banana + */ +export interface Banana { + [key: string]: object | any; + + /** + * + * @type {number} + * @memberof Banana + */ + lengthCm?: number; +} +/** + * + * @export + * @interface BananaReq + */ +export interface BananaReq { + /** + * + * @type {number} + * @memberof BananaReq + */ + lengthCm: number; + /** + * + * @type {boolean} + * @memberof BananaReq + */ + sweet?: boolean; +} +/** + * + * @export + * @interface Capitalization + */ +export interface Capitalization { + /** + * + * @type {string} + * @memberof Capitalization + */ + smallCamel?: string; + /** + * + * @type {string} + * @memberof Capitalization + */ + CapitalCamel?: string; + /** + * + * @type {string} + * @memberof Capitalization + */ + small_Snake?: string; + /** + * + * @type {string} + * @memberof Capitalization + */ + Capital_Snake?: string; + /** + * + * @type {string} + * @memberof Capitalization + */ + SCA_ETH_Flow_Points?: string; + /** + * Name of the pet + * @type {string} + * @memberof Capitalization + */ + ATT_NAME?: string; +} +/** + * + * @export + * @interface Cat + */ +export interface Cat extends Animal { + /** + * + * @type {boolean} + * @memberof Cat + */ + declawed?: boolean; +} +/** + * + * @export + * @interface CatAllOf + */ +export interface CatAllOf { + /** + * + * @type {boolean} + * @memberof CatAllOf + */ + declawed?: boolean; +} +/** + * + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name: string; +} +/** + * Model for testing model with \"_class\" property + * @export + * @interface ClassModel + */ +export interface ClassModel { + /** + * + * @type {string} + * @memberof ClassModel + */ + _class?: string; +} +/** + * + * @export + * @interface Client + */ +export interface Client { + /** + * + * @type {string} + * @memberof Client + */ + client?: string; +} +/** + * + * @export + * @interface Dog + */ +export interface Dog extends Animal { + /** + * + * @type {string} + * @memberof Dog + */ + breed?: string; +} +/** + * + * @export + * @interface DogAllOf + */ +export interface DogAllOf { + /** + * + * @type {string} + * @memberof DogAllOf + */ + breed?: string; +} +/** + * + * @export + * @interface EnumArrays + */ +export interface EnumArrays { + /** + * + * @type {string} + * @memberof EnumArrays + */ + just_symbol?: EnumArraysJustSymbolEnum; + /** + * + * @type {Array} + * @memberof EnumArrays + */ + array_enum?: Array; +} + +/** + * @export + * @enum {string} + */ +export enum EnumArraysJustSymbolEnum { + GreaterThanOrEqualTo = '>=', + Dollar = '$' +} +/** + * @export + * @enum {string} + */ +export enum EnumArraysArrayEnumEnum { + Fish = 'fish', + Crab = 'crab' +} + +/** + * + * @export + * @enum {string} + */ +export enum EnumClass { + Abc = '_abc', + Efg = '-efg', + Xyz = '(xyz)' +} + +/** + * + * @export + * @interface EnumTest + */ +export interface EnumTest { + /** + * + * @type {string} + * @memberof EnumTest + */ + enum_string?: EnumTestEnumStringEnum; + /** + * + * @type {string} + * @memberof EnumTest + */ + enum_string_required: EnumTestEnumStringRequiredEnum; + /** + * + * @type {number} + * @memberof EnumTest + */ + enum_integer?: EnumTestEnumIntegerEnum; + /** + * + * @type {number} + * @memberof EnumTest + */ + enum_number?: EnumTestEnumNumberEnum; + /** + * + * @type {OuterEnum} + * @memberof EnumTest + */ + outerEnum?: OuterEnum | null; + /** + * + * @type {OuterEnumInteger} + * @memberof EnumTest + */ + outerEnumInteger?: OuterEnumInteger; + /** + * + * @type {OuterEnumDefaultValue} + * @memberof EnumTest + */ + outerEnumDefaultValue?: OuterEnumDefaultValue; + /** + * + * @type {OuterEnumIntegerDefaultValue} + * @memberof EnumTest + */ + outerEnumIntegerDefaultValue?: OuterEnumIntegerDefaultValue; +} + +/** + * @export + * @enum {string} + */ +export enum EnumTestEnumStringEnum { + Upper = 'UPPER', + Lower = 'lower', + Empty = '' +} +/** + * @export + * @enum {string} + */ +export enum EnumTestEnumStringRequiredEnum { + Upper = 'UPPER', + Lower = 'lower', + Empty = '' +} +/** + * @export + * @enum {string} + */ +export enum EnumTestEnumIntegerEnum { + NUMBER_1 = 1, + NUMBER_MINUS_1 = -1 +} +/** + * @export + * @enum {string} + */ +export enum EnumTestEnumNumberEnum { + NUMBER_1_DOT_1 = 1.1, + NUMBER_MINUS_1_DOT_2 = -1.2 +} + +/** + * + * @export + * @interface FileSchemaTestClass + */ +export interface FileSchemaTestClass { + /** + * + * @type {any} + * @memberof FileSchemaTestClass + */ + file?: any; + /** + * + * @type {Array} + * @memberof FileSchemaTestClass + */ + files?: Array; +} +/** + * + * @export + * @interface Foo + */ +export interface Foo { + /** + * + * @type {string} + * @memberof Foo + */ + bar?: string; +} +/** + * + * @export + * @interface FormatTest + */ +export interface FormatTest { + /** + * + * @type {number} + * @memberof FormatTest + */ + integer?: number; + /** + * + * @type {number} + * @memberof FormatTest + */ + int32?: number; + /** + * + * @type {number} + * @memberof FormatTest + */ + int64?: number; + /** + * + * @type {number} + * @memberof FormatTest + */ + number: number; + /** + * + * @type {number} + * @memberof FormatTest + */ + _float?: number; + /** + * + * @type {number} + * @memberof FormatTest + */ + _double?: number; + /** + * + * @type {string} + * @memberof FormatTest + */ + string?: string; + /** + * + * @type {string} + * @memberof FormatTest + */ + _byte: string; + /** + * + * @type {any} + * @memberof FormatTest + */ + binary?: any; + /** + * + * @type {string} + * @memberof FormatTest + */ + date: string; + /** + * + * @type {string} + * @memberof FormatTest + */ + dateTime?: string; + /** + * + * @type {string} + * @memberof FormatTest + */ + uuid?: string; + /** + * + * @type {string} + * @memberof FormatTest + */ + password: string; + /** + * A string that is a 10 digit number. Can have leading zeros. + * @type {string} + * @memberof FormatTest + */ + pattern_with_digits?: string; + /** + * A string starting with \'image_\' (case insensitive) and one to three digits following i.e. Image_01. + * @type {string} + * @memberof FormatTest + */ + pattern_with_digits_and_delimiter?: string; +} +/** + * @type Fruit + * @export + */ +export type Fruit = Apple | Banana; + +/** + * @type FruitReq + * @export + */ +export type FruitReq = AppleReq | BananaReq; + +/** + * + * @export + * @interface GmFruit + */ +export interface GmFruit { + /** + * + * @type {string} + * @memberof GmFruit + */ + color?: string; + /** + * + * @type {string} + * @memberof GmFruit + */ + cultivar?: string; + /** + * + * @type {number} + * @memberof GmFruit + */ + lengthCm?: number; +} +/** + * + * @export + * @interface HasOnlyReadOnly + */ +export interface HasOnlyReadOnly { + /** + * + * @type {string} + * @memberof HasOnlyReadOnly + */ + bar?: string; + /** + * + * @type {string} + * @memberof HasOnlyReadOnly + */ + foo?: string; +} +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + * @export + * @interface HealthCheckResult + */ +export interface HealthCheckResult { + /** + * + * @type {string} + * @memberof HealthCheckResult + */ + NullableMessage?: string | null; +} +/** + * + * @export + * @interface InlineResponseDefault + */ +export interface InlineResponseDefault { + /** + * + * @type {Foo} + * @memberof InlineResponseDefault + */ + string?: Foo; +} +/** + * + * @export + * @interface List + */ +export interface List { + /** + * + * @type {string} + * @memberof List + */ + _123_list?: string; +} +/** + * @type Mammal + * @export + */ +export type Mammal = Whale | Zebra; + +/** + * + * @export + * @interface MapTest + */ +export interface MapTest { + /** + * + * @type {{ [key: string]: { [key: string]: string; }; }} + * @memberof MapTest + */ + map_map_of_string?: { [key: string]: { [key: string]: string; }; }; + /** + * + * @type {{ [key: string]: string; }} + * @memberof MapTest + */ + map_of_enum_string?: { [key: string]: string; }; + /** + * + * @type {{ [key: string]: boolean; }} + * @memberof MapTest + */ + direct_map?: { [key: string]: boolean; }; + /** + * + * @type {{ [key: string]: boolean; }} + * @memberof MapTest + */ + indirect_map?: { [key: string]: boolean; }; +} + +/** + * @export + * @enum {string} + */ +export enum MapTestMapOfEnumStringEnum { + Upper = 'UPPER', + Lower = 'lower' +} + +/** + * + * @export + * @interface MixedPropertiesAndAdditionalPropertiesClass + */ +export interface MixedPropertiesAndAdditionalPropertiesClass { + /** + * + * @type {string} + * @memberof MixedPropertiesAndAdditionalPropertiesClass + */ + uuid?: string; + /** + * + * @type {string} + * @memberof MixedPropertiesAndAdditionalPropertiesClass + */ + dateTime?: string; + /** + * + * @type {{ [key: string]: Animal; }} + * @memberof MixedPropertiesAndAdditionalPropertiesClass + */ + map?: { [key: string]: Animal; }; +} +/** + * Model for testing model name starting with number + * @export + * @interface Model200Response + */ +export interface Model200Response { + /** + * + * @type {number} + * @memberof Model200Response + */ + name?: number; + /** + * + * @type {string} + * @memberof Model200Response + */ + _class?: string; +} +/** + * Must be named `File` for test. + * @export + * @interface ModelFile + */ +export interface ModelFile { + /** + * Test capitalization + * @type {string} + * @memberof ModelFile + */ + sourceURI?: string; +} +/** + * Model for testing model name same as property name + * @export + * @interface Name + */ +export interface Name { + /** + * + * @type {number} + * @memberof Name + */ + name: number; + /** + * + * @type {number} + * @memberof Name + */ + snake_case?: number; + /** + * + * @type {string} + * @memberof Name + */ + property?: string; + /** + * + * @type {number} + * @memberof Name + */ + _123Number?: number; +} +/** + * + * @export + * @interface NullableClass + */ +export interface NullableClass { + [key: string]: object | any; + + /** + * + * @type {number} + * @memberof NullableClass + */ + integer_prop?: number | null; + /** + * + * @type {number} + * @memberof NullableClass + */ + number_prop?: number | null; + /** + * + * @type {boolean} + * @memberof NullableClass + */ + boolean_prop?: boolean | null; + /** + * + * @type {string} + * @memberof NullableClass + */ + string_prop?: string | null; + /** + * + * @type {string} + * @memberof NullableClass + */ + date_prop?: string | null; + /** + * + * @type {string} + * @memberof NullableClass + */ + datetime_prop?: string | null; + /** + * + * @type {Array} + * @memberof NullableClass + */ + array_nullable_prop?: Array | null; + /** + * + * @type {Array} + * @memberof NullableClass + */ + array_and_items_nullable_prop?: Array | null; + /** + * + * @type {Array} + * @memberof NullableClass + */ + array_items_nullable?: Array; + /** + * + * @type {{ [key: string]: object; }} + * @memberof NullableClass + */ + object_nullable_prop?: { [key: string]: object; } | null; + /** + * + * @type {{ [key: string]: object; }} + * @memberof NullableClass + */ + object_and_items_nullable_prop?: { [key: string]: object; } | null; + /** + * + * @type {{ [key: string]: object; }} + * @memberof NullableClass + */ + object_items_nullable?: { [key: string]: object; }; +} +/** + * + * @export + * @interface NumberOnly + */ +export interface NumberOnly { + /** + * + * @type {number} + * @memberof NumberOnly + */ + JustNumber?: number; +} +/** + * + * @export + * @interface Order + */ +export interface Order { + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {string} + * @memberof Order + */ + shipDate?: string; + /** + * Order Status + * @type {string} + * @memberof Order + */ + status?: OrderStatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @enum {string} + */ +export enum OrderStatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' +} + +/** + * + * @export + * @interface OuterComposite + */ +export interface OuterComposite { + /** + * + * @type {number} + * @memberof OuterComposite + */ + my_number?: number; + /** + * + * @type {string} + * @memberof OuterComposite + */ + my_string?: string; + /** + * + * @type {boolean} + * @memberof OuterComposite + */ + my_boolean?: boolean; +} +/** + * + * @export + * @enum {string} + */ +export enum OuterEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' +} + +/** + * + * @export + * @enum {string} + */ +export enum OuterEnumDefaultValue { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' +} + +/** + * + * @export + * @enum {string} + */ +export enum OuterEnumInteger { + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2 +} + +/** + * + * @export + * @enum {string} + */ +export enum OuterEnumIntegerDefaultValue { + NUMBER_0 = 0, + NUMBER_1 = 1, + NUMBER_2 = 2 +} + +/** + * + * @export + * @interface Pet + */ +export interface Pet { + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array} + * @memberof Pet + */ + tags?: Array; + /** + * pet status in the store + * @type {string} + * @memberof Pet + */ + status?: PetStatusEnum; +} + +/** + * @export + * @enum {string} + */ +export enum PetStatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' +} + +/** + * + * @export + * @interface ReadOnlyFirst + */ +export interface ReadOnlyFirst { + /** + * + * @type {string} + * @memberof ReadOnlyFirst + */ + bar?: string; + /** + * + * @type {string} + * @memberof ReadOnlyFirst + */ + baz?: string; +} +/** + * Model for testing reserved words + * @export + * @interface Return + */ +export interface Return { + /** + * + * @type {number} + * @memberof Return + */ + _return?: number; +} +/** + * + * @export + * @interface SpecialModelName + */ +export interface SpecialModelName { + /** + * + * @type {number} + * @memberof SpecialModelName + */ + $special_property_name?: number; +} +/** + * + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} +/** + * + * @export + * @interface User + */ +export interface User { + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; + /** + * User Status + * @type {number} + * @memberof User + */ + userStatus?: number; + /** + * test code generation for objects Value must be a map of strings to values. It cannot be the \'null\' value. + * @type {object} + * @memberof User + */ + arbitraryObject?: object; + /** + * test code generation for nullable objects. Value must be a map of strings to values or the \'null\' value. + * @type {object} + * @memberof User + */ + arbitraryNullableObject?: object | null; + /** + * test code generation for any type Value can be any type - string, number, boolean, array or object. + * @type {any} + * @memberof User + */ + arbitraryTypeValue?: any | null; + /** + * test code generation for any type Value can be any type - string, number, boolean, array, object or the \'null\' value. + * @type {any} + * @memberof User + */ + arbitraryNullableTypeValue?: any | null; +} +/** + * + * @export + * @interface Whale + */ +export interface Whale { + /** + * + * @type {boolean} + * @memberof Whale + */ + hasBaleen?: boolean; + /** + * + * @type {boolean} + * @memberof Whale + */ + hasTeeth?: boolean; + /** + * + * @type {string} + * @memberof Whale + */ + className: string; +} +/** + * + * @export + * @interface Zebra + */ +export interface Zebra { + /** + * + * @type {string} + * @memberof Zebra + */ + type?: ZebraTypeEnum; + /** + * + * @type {string} + * @memberof Zebra + */ + className: string; +} + +/** + * @export + * @enum {string} + */ +export enum ZebraTypeEnum { + Plains = 'plains', + Mountain = 'mountain', + Grevys = 'grevys' +} + + +/** + * AnotherFakeApi - axios parameter creator + * @export + */ +export const AnotherFakeApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * To test special tags and operation ID starting with number + * @summary To test special tags + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + _123testSpecialTags: async (client: Client, options: any = {}): Promise => { + // verify required parameter 'client' is not null or undefined + assertParamExists('_123testSpecialTags', 'client', client) + const localVarPath = `/another-fake/dummy`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(client, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * AnotherFakeApi - functional programming interface + * @export + */ +export const AnotherFakeApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = AnotherFakeApiAxiosParamCreator(configuration) + return { + /** + * To test special tags and operation ID starting with number + * @summary To test special tags + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async _123testSpecialTags(client: Client, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator._123testSpecialTags(client, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * AnotherFakeApi - factory interface + * @export + */ +export const AnotherFakeApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = AnotherFakeApiFp(configuration) + return { + /** + * To test special tags and operation ID starting with number + * @summary To test special tags + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + _123testSpecialTags(client: Client, options?: any): AxiosPromise { + return localVarFp._123testSpecialTags(client, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * AnotherFakeApi - object-oriented interface + * @export + * @class AnotherFakeApi + * @extends {BaseAPI} + */ +export class AnotherFakeApi extends BaseAPI { + /** + * To test special tags and operation ID starting with number + * @summary To test special tags + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AnotherFakeApi + */ + public _123testSpecialTags(client: Client, options?: any) { + return AnotherFakeApiFp(this.configuration)._123testSpecialTags(client, options).then((request) => request(this.axios, this.basePath)); + } +} + + +/** + * DefaultApi - axios parameter creator + * @export + */ +export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fooGet: async (options: any = {}): Promise => { + const localVarPath = `/foo`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * DefaultApi - functional programming interface + * @export + */ +export const DefaultApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration) + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async fooGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fooGet(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * DefaultApi - factory interface + * @export + */ +export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DefaultApiFp(configuration) + return { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fooGet(options?: any): AxiosPromise { + return localVarFp.fooGet(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * DefaultApi - object-oriented interface + * @export + * @class DefaultApi + * @extends {BaseAPI} + */ +export class DefaultApi extends BaseAPI { + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public fooGet(options?: any) { + return DefaultApiFp(this.configuration).fooGet(options).then((request) => request(this.axios, this.basePath)); + } +} + + +/** + * FakeApi - axios parameter creator + * @export + */ +export const FakeApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Health check endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeHealthGet: async (options: any = {}): Promise => { + const localVarPath = `/fake/health`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Test serialization of outer boolean types + * @param {boolean} [body] Input boolean as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterBooleanSerialize: async (body?: boolean, options: any = {}): Promise => { + const localVarPath = `/fake/outer/boolean`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Test serialization of object with outer number type + * @param {OuterComposite} [outerComposite] Input composite as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterCompositeSerialize: async (outerComposite?: OuterComposite, options: any = {}): Promise => { + const localVarPath = `/fake/outer/composite`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(outerComposite, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Test serialization of outer number types + * @param {number} [body] Input number as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterNumberSerialize: async (body?: number, options: any = {}): Promise => { + const localVarPath = `/fake/outer/number`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Test serialization of outer string types + * @param {string} [body] Input string as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterStringSerialize: async (body?: string, options: any = {}): Promise => { + const localVarPath = `/fake/outer/string`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * For this test, the body for this request much reference a schema named `File`. + * @param {FileSchemaTestClass} fileSchemaTestClass + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testBodyWithFileSchema: async (fileSchemaTestClass: FileSchemaTestClass, options: any = {}): Promise => { + // verify required parameter 'fileSchemaTestClass' is not null or undefined + assertParamExists('testBodyWithFileSchema', 'fileSchemaTestClass', fileSchemaTestClass) + const localVarPath = `/fake/body-with-file-schema`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(fileSchemaTestClass, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} query + * @param {User} user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testBodyWithQueryParams: async (query: string, user: User, options: any = {}): Promise => { + // verify required parameter 'query' is not null or undefined + assertParamExists('testBodyWithQueryParams', 'query', query) + // verify required parameter 'user' is not null or undefined + assertParamExists('testBodyWithQueryParams', 'user', user) + const localVarPath = `/fake/body-with-query-params`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (query !== undefined) { + localVarQueryParameter['query'] = query; + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * To test \"client\" model + * @summary To test \"client\" model + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testClientModel: async (client: Client, options: any = {}): Promise => { + // verify required parameter 'client' is not null or undefined + assertParamExists('testClientModel', 'client', client) + const localVarPath = `/fake`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(client, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @summary Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param {number} number None + * @param {number} _double None + * @param {string} patternWithoutDelimiter None + * @param {string} _byte None + * @param {number} [integer] None + * @param {number} [int32] None + * @param {number} [int64] None + * @param {number} [_float] None + * @param {string} [string] None + * @param {any} [binary] None + * @param {string} [date] None + * @param {string} [dateTime] None + * @param {string} [password] None + * @param {string} [callback] None + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testEndpointParameters: async (number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: any, date?: string, dateTime?: string, password?: string, callback?: string, options: any = {}): Promise => { + // verify required parameter 'number' is not null or undefined + assertParamExists('testEndpointParameters', 'number', number) + // verify required parameter '_double' is not null or undefined + assertParamExists('testEndpointParameters', '_double', _double) + // verify required parameter 'patternWithoutDelimiter' is not null or undefined + assertParamExists('testEndpointParameters', 'patternWithoutDelimiter', patternWithoutDelimiter) + // verify required parameter '_byte' is not null or undefined + assertParamExists('testEndpointParameters', '_byte', _byte) + const localVarPath = `/fake`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new URLSearchParams(); + + // authentication http_basic_test required + // http basic authentication required + setBasicAuthToObject(localVarRequestOptions, configuration) + + + if (integer !== undefined) { + localVarFormParams.set('integer', integer as any); + } + + if (int32 !== undefined) { + localVarFormParams.set('int32', int32 as any); + } + + if (int64 !== undefined) { + localVarFormParams.set('int64', int64 as any); + } + + if (number !== undefined) { + localVarFormParams.set('number', number as any); + } + + if (_float !== undefined) { + localVarFormParams.set('float', _float as any); + } + + if (_double !== undefined) { + localVarFormParams.set('double', _double as any); + } + + if (string !== undefined) { + localVarFormParams.set('string', string as any); + } + + if (patternWithoutDelimiter !== undefined) { + localVarFormParams.set('pattern_without_delimiter', patternWithoutDelimiter as any); + } + + if (_byte !== undefined) { + localVarFormParams.set('byte', _byte as any); + } + + if (binary !== undefined) { + localVarFormParams.set('binary', binary as any); + } + + if (date !== undefined) { + localVarFormParams.set('date', date as any); + } + + if (dateTime !== undefined) { + localVarFormParams.set('dateTime', dateTime as any); + } + + if (password !== undefined) { + localVarFormParams.set('password', password as any); + } + + if (callback !== undefined) { + localVarFormParams.set('callback', callback as any); + } + + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * To test enum parameters + * @summary To test enum parameters + * @param {Array<'>' | '$'>} [enumHeaderStringArray] Header parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumHeaderString] Header parameter enum test (string) + * @param {Array<'>' | '$'>} [enumQueryStringArray] Query parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumQueryString] Query parameter enum test (string) + * @param {1 | -2} [enumQueryInteger] Query parameter enum test (double) + * @param {1.1 | -1.2} [enumQueryDouble] Query parameter enum test (double) + * @param {Array} [enumFormStringArray] Form parameter enum test (string array) + * @param {string} [enumFormString] Form parameter enum test (string) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testEnumParameters: async (enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumFormStringArray?: Array, enumFormString?: string, options: any = {}): Promise => { + const localVarPath = `/fake`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new URLSearchParams(); + + if (enumQueryStringArray) { + localVarQueryParameter['enum_query_string_array'] = enumQueryStringArray; + } + + if (enumQueryString !== undefined) { + localVarQueryParameter['enum_query_string'] = enumQueryString; + } + + if (enumQueryInteger !== undefined) { + localVarQueryParameter['enum_query_integer'] = enumQueryInteger; + } + + if (enumQueryDouble !== undefined) { + localVarQueryParameter['enum_query_double'] = enumQueryDouble; + } + + if (enumHeaderStringArray) { + let mapped = enumHeaderStringArray.map(value => ("Array<'>' | '$'>" !== "Array") ? JSON.stringify(value) : (value || "")); + localVarHeaderParameter['enum_header_string_array'] = mapped.join(COLLECTION_FORMATS["csv"]); + } + + if (enumHeaderString !== undefined && enumHeaderString !== null) { + localVarHeaderParameter['enum_header_string'] = String(enumHeaderString); + } + + if (enumFormStringArray) { + localVarFormParams.set(enumFormStringArray.join(COLLECTION_FORMATS.csv)); + } + + + if (enumFormString !== undefined) { + localVarFormParams.set('enum_form_string', enumFormString as any); + } + + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Fake endpoint to test group parameters (optional) + * @summary Fake endpoint to test group parameters (optional) + * @param {number} requiredStringGroup Required String in group parameters + * @param {boolean} requiredBooleanGroup Required Boolean in group parameters + * @param {number} requiredInt64Group Required Integer in group parameters + * @param {number} [stringGroup] String in group parameters + * @param {boolean} [booleanGroup] Boolean in group parameters + * @param {number} [int64Group] Integer in group parameters + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testGroupParameters: async (requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, options: any = {}): Promise => { + // verify required parameter 'requiredStringGroup' is not null or undefined + assertParamExists('testGroupParameters', 'requiredStringGroup', requiredStringGroup) + // verify required parameter 'requiredBooleanGroup' is not null or undefined + assertParamExists('testGroupParameters', 'requiredBooleanGroup', requiredBooleanGroup) + // verify required parameter 'requiredInt64Group' is not null or undefined + assertParamExists('testGroupParameters', 'requiredInt64Group', requiredInt64Group) + const localVarPath = `/fake`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearer_test required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (requiredStringGroup !== undefined) { + localVarQueryParameter['required_string_group'] = requiredStringGroup; + } + + if (requiredInt64Group !== undefined) { + localVarQueryParameter['required_int64_group'] = requiredInt64Group; + } + + if (stringGroup !== undefined) { + localVarQueryParameter['string_group'] = stringGroup; + } + + if (int64Group !== undefined) { + localVarQueryParameter['int64_group'] = int64Group; + } + + if (requiredBooleanGroup !== undefined && requiredBooleanGroup !== null) { + localVarHeaderParameter['required_boolean_group'] = String(JSON.stringify(requiredBooleanGroup)); + } + + if (booleanGroup !== undefined && booleanGroup !== null) { + localVarHeaderParameter['boolean_group'] = String(JSON.stringify(booleanGroup)); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary test inline additionalProperties + * @param {{ [key: string]: string; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testInlineAdditionalProperties: async (requestBody: { [key: string]: string; }, options: any = {}): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('testInlineAdditionalProperties', 'requestBody', requestBody) + const localVarPath = `/fake/inline-additionalProperties`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary test json serialization of form data + * @param {string} param field1 + * @param {string} param2 field2 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testJsonFormData: async (param: string, param2: string, options: any = {}): Promise => { + // verify required parameter 'param' is not null or undefined + assertParamExists('testJsonFormData', 'param', param) + // verify required parameter 'param2' is not null or undefined + assertParamExists('testJsonFormData', 'param2', param2) + const localVarPath = `/fake/jsonFormData`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new URLSearchParams(); + + + if (param !== undefined) { + localVarFormParams.set('param', param as any); + } + + if (param2 !== undefined) { + localVarFormParams.set('param2', param2 as any); + } + + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * To test the collection format in query parameters + * @param {Array} pipe + * @param {Array} ioutil + * @param {Array} http + * @param {Array} url + * @param {Array} context + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testQueryParameterCollectionFormat: async (pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, options: any = {}): Promise => { + // verify required parameter 'pipe' is not null or undefined + assertParamExists('testQueryParameterCollectionFormat', 'pipe', pipe) + // verify required parameter 'ioutil' is not null or undefined + assertParamExists('testQueryParameterCollectionFormat', 'ioutil', ioutil) + // verify required parameter 'http' is not null or undefined + assertParamExists('testQueryParameterCollectionFormat', 'http', http) + // verify required parameter 'url' is not null or undefined + assertParamExists('testQueryParameterCollectionFormat', 'url', url) + // verify required parameter 'context' is not null or undefined + assertParamExists('testQueryParameterCollectionFormat', 'context', context) + const localVarPath = `/fake/test-query-paramters`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (pipe) { + localVarQueryParameter['pipe'] = pipe; + } + + if (ioutil) { + localVarQueryParameter['ioutil'] = ioutil.join(COLLECTION_FORMATS.csv); + } + + if (http) { + localVarQueryParameter['http'] = http.join(COLLECTION_FORMATS.ssv); + } + + if (url) { + localVarQueryParameter['url'] = url.join(COLLECTION_FORMATS.csv); + } + + if (context) { + localVarQueryParameter['context'] = context; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * To test unique items in header and query parameters + * @param {Set} queryUnique + * @param {Set} headerUnique + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testUniqueItemsHeaderAndQueryParameterCollectionFormat: async (queryUnique: Set, headerUnique: Set, options: any = {}): Promise => { + // verify required parameter 'queryUnique' is not null or undefined + assertParamExists('testUniqueItemsHeaderAndQueryParameterCollectionFormat', 'queryUnique', queryUnique) + // verify required parameter 'headerUnique' is not null or undefined + assertParamExists('testUniqueItemsHeaderAndQueryParameterCollectionFormat', 'headerUnique', headerUnique) + const localVarPath = `/fake/test-unique-paramters`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (queryUnique) { + localVarQueryParameter['queryUnique'] = Array.from(queryUnique); + } + + if (headerUnique) { + let mapped = Array.from(headerUnique).map(value => ("Set" !== "Set") ? JSON.stringify(value) : (value || "")); + localVarHeaderParameter['headerUnique'] = mapped.join(COLLECTION_FORMATS["csv"]); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * FakeApi - functional programming interface + * @export + */ +export const FakeApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = FakeApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Health check endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async fakeHealthGet(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fakeHealthGet(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Test serialization of outer boolean types + * @param {boolean} [body] Input boolean as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async fakeOuterBooleanSerialize(body?: boolean, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fakeOuterBooleanSerialize(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Test serialization of object with outer number type + * @param {OuterComposite} [outerComposite] Input composite as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async fakeOuterCompositeSerialize(outerComposite?: OuterComposite, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fakeOuterCompositeSerialize(outerComposite, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Test serialization of outer number types + * @param {number} [body] Input number as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async fakeOuterNumberSerialize(body?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fakeOuterNumberSerialize(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Test serialization of outer string types + * @param {string} [body] Input string as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async fakeOuterStringSerialize(body?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.fakeOuterStringSerialize(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * For this test, the body for this request much reference a schema named `File`. + * @param {FileSchemaTestClass} fileSchemaTestClass + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testBodyWithFileSchema(fileSchemaTestClass, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {string} query + * @param {User} user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testBodyWithQueryParams(query: string, user: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testBodyWithQueryParams(query, user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * To test \"client\" model + * @summary To test \"client\" model + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testClientModel(client: Client, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testClientModel(client, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @summary Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param {number} number None + * @param {number} _double None + * @param {string} patternWithoutDelimiter None + * @param {string} _byte None + * @param {number} [integer] None + * @param {number} [int32] None + * @param {number} [int64] None + * @param {number} [_float] None + * @param {string} [string] None + * @param {any} [binary] None + * @param {string} [date] None + * @param {string} [dateTime] None + * @param {string} [password] None + * @param {string} [callback] None + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testEndpointParameters(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: any, date?: string, dateTime?: string, password?: string, callback?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, callback, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * To test enum parameters + * @summary To test enum parameters + * @param {Array<'>' | '$'>} [enumHeaderStringArray] Header parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumHeaderString] Header parameter enum test (string) + * @param {Array<'>' | '$'>} [enumQueryStringArray] Query parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumQueryString] Query parameter enum test (string) + * @param {1 | -2} [enumQueryInteger] Query parameter enum test (double) + * @param {1.1 | -1.2} [enumQueryDouble] Query parameter enum test (double) + * @param {Array} [enumFormStringArray] Form parameter enum test (string array) + * @param {string} [enumFormString] Form parameter enum test (string) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testEnumParameters(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumFormStringArray?: Array, enumFormString?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Fake endpoint to test group parameters (optional) + * @summary Fake endpoint to test group parameters (optional) + * @param {number} requiredStringGroup Required String in group parameters + * @param {boolean} requiredBooleanGroup Required Boolean in group parameters + * @param {number} requiredInt64Group Required Integer in group parameters + * @param {number} [stringGroup] String in group parameters + * @param {boolean} [booleanGroup] Boolean in group parameters + * @param {number} [int64Group] Integer in group parameters + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testGroupParameters(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary test inline additionalProperties + * @param {{ [key: string]: string; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testInlineAdditionalProperties(requestBody: { [key: string]: string; }, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testInlineAdditionalProperties(requestBody, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary test json serialization of form data + * @param {string} param field1 + * @param {string} param2 field2 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testJsonFormData(param: string, param2: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testJsonFormData(param, param2, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * To test the collection format in query parameters + * @param {Array} pipe + * @param {Array} ioutil + * @param {Array} http + * @param {Array} url + * @param {Array} context + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testQueryParameterCollectionFormat(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * To test unique items in header and query parameters + * @param {Set} queryUnique + * @param {Set} headerUnique + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testUniqueItemsHeaderAndQueryParameterCollectionFormat(queryUnique: Set, headerUnique: Set, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testUniqueItemsHeaderAndQueryParameterCollectionFormat(queryUnique, headerUnique, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * FakeApi - factory interface + * @export + */ +export const FakeApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = FakeApiFp(configuration) + return { + /** + * + * @summary Health check endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeHealthGet(options?: any): AxiosPromise { + return localVarFp.fakeHealthGet(options).then((request) => request(axios, basePath)); + }, + /** + * Test serialization of outer boolean types + * @param {boolean} [body] Input boolean as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterBooleanSerialize(body?: boolean, options?: any): AxiosPromise { + return localVarFp.fakeOuterBooleanSerialize(body, options).then((request) => request(axios, basePath)); + }, + /** + * Test serialization of object with outer number type + * @param {OuterComposite} [outerComposite] Input composite as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterCompositeSerialize(outerComposite?: OuterComposite, options?: any): AxiosPromise { + return localVarFp.fakeOuterCompositeSerialize(outerComposite, options).then((request) => request(axios, basePath)); + }, + /** + * Test serialization of outer number types + * @param {number} [body] Input number as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterNumberSerialize(body?: number, options?: any): AxiosPromise { + return localVarFp.fakeOuterNumberSerialize(body, options).then((request) => request(axios, basePath)); + }, + /** + * Test serialization of outer string types + * @param {string} [body] Input string as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + fakeOuterStringSerialize(body?: string, options?: any): AxiosPromise { + return localVarFp.fakeOuterStringSerialize(body, options).then((request) => request(axios, basePath)); + }, + /** + * For this test, the body for this request much reference a schema named `File`. + * @param {FileSchemaTestClass} fileSchemaTestClass + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, options?: any): AxiosPromise { + return localVarFp.testBodyWithFileSchema(fileSchemaTestClass, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {string} query + * @param {User} user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testBodyWithQueryParams(query: string, user: User, options?: any): AxiosPromise { + return localVarFp.testBodyWithQueryParams(query, user, options).then((request) => request(axios, basePath)); + }, + /** + * To test \"client\" model + * @summary To test \"client\" model + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testClientModel(client: Client, options?: any): AxiosPromise { + return localVarFp.testClientModel(client, options).then((request) => request(axios, basePath)); + }, + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @summary Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param {number} number None + * @param {number} _double None + * @param {string} patternWithoutDelimiter None + * @param {string} _byte None + * @param {number} [integer] None + * @param {number} [int32] None + * @param {number} [int64] None + * @param {number} [_float] None + * @param {string} [string] None + * @param {any} [binary] None + * @param {string} [date] None + * @param {string} [dateTime] None + * @param {string} [password] None + * @param {string} [callback] None + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testEndpointParameters(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: any, date?: string, dateTime?: string, password?: string, callback?: string, options?: any): AxiosPromise { + return localVarFp.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, callback, options).then((request) => request(axios, basePath)); + }, + /** + * To test enum parameters + * @summary To test enum parameters + * @param {Array<'>' | '$'>} [enumHeaderStringArray] Header parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumHeaderString] Header parameter enum test (string) + * @param {Array<'>' | '$'>} [enumQueryStringArray] Query parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumQueryString] Query parameter enum test (string) + * @param {1 | -2} [enumQueryInteger] Query parameter enum test (double) + * @param {1.1 | -1.2} [enumQueryDouble] Query parameter enum test (double) + * @param {Array} [enumFormStringArray] Form parameter enum test (string array) + * @param {string} [enumFormString] Form parameter enum test (string) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testEnumParameters(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumFormStringArray?: Array, enumFormString?: string, options?: any): AxiosPromise { + return localVarFp.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, options).then((request) => request(axios, basePath)); + }, + /** + * Fake endpoint to test group parameters (optional) + * @summary Fake endpoint to test group parameters (optional) + * @param {number} requiredStringGroup Required String in group parameters + * @param {boolean} requiredBooleanGroup Required Boolean in group parameters + * @param {number} requiredInt64Group Required Integer in group parameters + * @param {number} [stringGroup] String in group parameters + * @param {boolean} [booleanGroup] Boolean in group parameters + * @param {number} [int64Group] Integer in group parameters + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testGroupParameters(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, options?: any): AxiosPromise { + return localVarFp.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary test inline additionalProperties + * @param {{ [key: string]: string; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testInlineAdditionalProperties(requestBody: { [key: string]: string; }, options?: any): AxiosPromise { + return localVarFp.testInlineAdditionalProperties(requestBody, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary test json serialization of form data + * @param {string} param field1 + * @param {string} param2 field2 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testJsonFormData(param: string, param2: string, options?: any): AxiosPromise { + return localVarFp.testJsonFormData(param, param2, options).then((request) => request(axios, basePath)); + }, + /** + * To test the collection format in query parameters + * @param {Array} pipe + * @param {Array} ioutil + * @param {Array} http + * @param {Array} url + * @param {Array} context + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testQueryParameterCollectionFormat(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, options?: any): AxiosPromise { + return localVarFp.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, options).then((request) => request(axios, basePath)); + }, + /** + * To test unique items in header and query parameters + * @param {Set} queryUnique + * @param {Set} headerUnique + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testUniqueItemsHeaderAndQueryParameterCollectionFormat(queryUnique: Set, headerUnique: Set, options?: any): AxiosPromise> { + return localVarFp.testUniqueItemsHeaderAndQueryParameterCollectionFormat(queryUnique, headerUnique, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * FakeApi - object-oriented interface + * @export + * @class FakeApi + * @extends {BaseAPI} + */ +export class FakeApi extends BaseAPI { + /** + * + * @summary Health check endpoint + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public fakeHealthGet(options?: any) { + return FakeApiFp(this.configuration).fakeHealthGet(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Test serialization of outer boolean types + * @param {boolean} [body] Input boolean as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public fakeOuterBooleanSerialize(body?: boolean, options?: any) { + return FakeApiFp(this.configuration).fakeOuterBooleanSerialize(body, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Test serialization of object with outer number type + * @param {OuterComposite} [outerComposite] Input composite as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public fakeOuterCompositeSerialize(outerComposite?: OuterComposite, options?: any) { + return FakeApiFp(this.configuration).fakeOuterCompositeSerialize(outerComposite, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Test serialization of outer number types + * @param {number} [body] Input number as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public fakeOuterNumberSerialize(body?: number, options?: any) { + return FakeApiFp(this.configuration).fakeOuterNumberSerialize(body, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Test serialization of outer string types + * @param {string} [body] Input string as post body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public fakeOuterStringSerialize(body?: string, options?: any) { + return FakeApiFp(this.configuration).fakeOuterStringSerialize(body, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * For this test, the body for this request much reference a schema named `File`. + * @param {FileSchemaTestClass} fileSchemaTestClass + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, options?: any) { + return FakeApiFp(this.configuration).testBodyWithFileSchema(fileSchemaTestClass, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @param {string} query + * @param {User} user + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testBodyWithQueryParams(query: string, user: User, options?: any) { + return FakeApiFp(this.configuration).testBodyWithQueryParams(query, user, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * To test \"client\" model + * @summary To test \"client\" model + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testClientModel(client: Client, options?: any) { + return FakeApiFp(this.configuration).testClientModel(client, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @summary Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * @param {number} number None + * @param {number} _double None + * @param {string} patternWithoutDelimiter None + * @param {string} _byte None + * @param {number} [integer] None + * @param {number} [int32] None + * @param {number} [int64] None + * @param {number} [_float] None + * @param {string} [string] None + * @param {any} [binary] None + * @param {string} [date] None + * @param {string} [dateTime] None + * @param {string} [password] None + * @param {string} [callback] None + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testEndpointParameters(number: number, _double: number, patternWithoutDelimiter: string, _byte: string, integer?: number, int32?: number, int64?: number, _float?: number, string?: string, binary?: any, date?: string, dateTime?: string, password?: string, callback?: string, options?: any) { + return FakeApiFp(this.configuration).testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, callback, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * To test enum parameters + * @summary To test enum parameters + * @param {Array<'>' | '$'>} [enumHeaderStringArray] Header parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumHeaderString] Header parameter enum test (string) + * @param {Array<'>' | '$'>} [enumQueryStringArray] Query parameter enum test (string array) + * @param {'_abc' | '-efg' | '(xyz)'} [enumQueryString] Query parameter enum test (string) + * @param {1 | -2} [enumQueryInteger] Query parameter enum test (double) + * @param {1.1 | -1.2} [enumQueryDouble] Query parameter enum test (double) + * @param {Array} [enumFormStringArray] Form parameter enum test (string array) + * @param {string} [enumFormString] Form parameter enum test (string) + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testEnumParameters(enumHeaderStringArray?: Array<'>' | '$'>, enumHeaderString?: '_abc' | '-efg' | '(xyz)', enumQueryStringArray?: Array<'>' | '$'>, enumQueryString?: '_abc' | '-efg' | '(xyz)', enumQueryInteger?: 1 | -2, enumQueryDouble?: 1.1 | -1.2, enumFormStringArray?: Array, enumFormString?: string, options?: any) { + return FakeApiFp(this.configuration).testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Fake endpoint to test group parameters (optional) + * @summary Fake endpoint to test group parameters (optional) + * @param {number} requiredStringGroup Required String in group parameters + * @param {boolean} requiredBooleanGroup Required Boolean in group parameters + * @param {number} requiredInt64Group Required Integer in group parameters + * @param {number} [stringGroup] String in group parameters + * @param {boolean} [booleanGroup] Boolean in group parameters + * @param {number} [int64Group] Integer in group parameters + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testGroupParameters(requiredStringGroup: number, requiredBooleanGroup: boolean, requiredInt64Group: number, stringGroup?: number, booleanGroup?: boolean, int64Group?: number, options?: any) { + return FakeApiFp(this.configuration).testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary test inline additionalProperties + * @param {{ [key: string]: string; }} requestBody request body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testInlineAdditionalProperties(requestBody: { [key: string]: string; }, options?: any) { + return FakeApiFp(this.configuration).testInlineAdditionalProperties(requestBody, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary test json serialization of form data + * @param {string} param field1 + * @param {string} param2 field2 + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testJsonFormData(param: string, param2: string, options?: any) { + return FakeApiFp(this.configuration).testJsonFormData(param, param2, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * To test the collection format in query parameters + * @param {Array} pipe + * @param {Array} ioutil + * @param {Array} http + * @param {Array} url + * @param {Array} context + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testQueryParameterCollectionFormat(pipe: Array, ioutil: Array, http: Array, url: Array, context: Array, options?: any) { + return FakeApiFp(this.configuration).testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * To test unique items in header and query parameters + * @param {Set} queryUnique + * @param {Set} headerUnique + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeApi + */ + public testUniqueItemsHeaderAndQueryParameterCollectionFormat(queryUnique: Set, headerUnique: Set, options?: any) { + return FakeApiFp(this.configuration).testUniqueItemsHeaderAndQueryParameterCollectionFormat(queryUnique, headerUnique, options).then((request) => request(this.axios, this.basePath)); + } +} + + +/** + * FakeClassnameTags123Api - axios parameter creator + * @export + */ +export const FakeClassnameTags123ApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * To test class name in snake case + * @summary To test class name in snake case + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testClassname: async (client: Client, options: any = {}): Promise => { + // verify required parameter 'client' is not null or undefined + assertParamExists('testClassname', 'client', client) + const localVarPath = `/fake_classname_test`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key_query required + await setApiKeyToObject(localVarQueryParameter, "api_key_query", configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(client, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * FakeClassnameTags123Api - functional programming interface + * @export + */ +export const FakeClassnameTags123ApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = FakeClassnameTags123ApiAxiosParamCreator(configuration) + return { + /** + * To test class name in snake case + * @summary To test class name in snake case + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async testClassname(client: Client, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.testClassname(client, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * FakeClassnameTags123Api - factory interface + * @export + */ +export const FakeClassnameTags123ApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = FakeClassnameTags123ApiFp(configuration) + return { + /** + * To test class name in snake case + * @summary To test class name in snake case + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testClassname(client: Client, options?: any): AxiosPromise { + return localVarFp.testClassname(client, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * FakeClassnameTags123Api - object-oriented interface + * @export + * @class FakeClassnameTags123Api + * @extends {BaseAPI} + */ +export class FakeClassnameTags123Api extends BaseAPI { + /** + * To test class name in snake case + * @summary To test class name in snake case + * @param {Client} client client model + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FakeClassnameTags123Api + */ + public testClassname(client: Client, options?: any) { + return FakeClassnameTags123ApiFp(this.configuration).testClassname(client, options).then((request) => request(this.axios, this.basePath)); + } +} + + +/** + * PetApi - axios parameter creator + * @export + */ +export const PetApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet: async (pet: Pet, options: any = {}): Promise => { + // verify required parameter 'pet' is not null or undefined + assertParamExists('addPet', 'pet', pet) + const localVarPath = `/pet`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication http_signature_test required + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(pet, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet: async (petId: number, apiKey?: string, options: any = {}): Promise => { + // verify required parameter 'petId' is not null or undefined + assertParamExists('deletePet', 'petId', petId) + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (apiKey !== undefined && apiKey !== null) { + localVarHeaderParameter['api_key'] = String(apiKey); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus: async (status: Array<'available' | 'pending' | 'sold'>, options: any = {}): Promise => { + // verify required parameter 'status' is not null or undefined + assertParamExists('findPetsByStatus', 'status', status) + const localVarPath = `/pet/findByStatus`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication http_signature_test required + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (status) { + localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS.csv); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags: async (tags: Array, options: any = {}): Promise => { + // verify required parameter 'tags' is not null or undefined + assertParamExists('findPetsByTags', 'tags', tags) + const localVarPath = `/pet/findByTags`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication http_signature_test required + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + if (tags) { + localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS.csv); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById: async (petId: number, options: any = {}): Promise => { + // verify required parameter 'petId' is not null or undefined + assertParamExists('getPetById', 'petId', petId) + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet: async (pet: Pet, options: any = {}): Promise => { + // verify required parameter 'pet' is not null or undefined + assertParamExists('updatePet', 'pet', pet) + const localVarPath = `/pet`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication http_signature_test required + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(pet, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm: async (petId: number, name?: string, status?: string, options: any = {}): Promise => { + // verify required parameter 'petId' is not null or undefined + assertParamExists('updatePetWithForm', 'petId', petId) + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new URLSearchParams(); + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile: async (petId: number, additionalMetadata?: string, file?: any, options: any = {}): Promise => { + // verify required parameter 'petId' is not null or undefined + assertParamExists('uploadFile', 'petId', petId) + const localVarPath = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + + if (additionalMetadata !== undefined) { + localVarFormParams.append('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + localVarFormParams.append('file', file as any); + } + + + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary uploads an image (required) + * @param {number} petId ID of pet to update + * @param {any} requiredFile file to upload + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFileWithRequiredFile: async (petId: number, requiredFile: any, additionalMetadata?: string, options: any = {}): Promise => { + // verify required parameter 'petId' is not null or undefined + assertParamExists('uploadFileWithRequiredFile', 'petId', petId) + // verify required parameter 'requiredFile' is not null or undefined + assertParamExists('uploadFileWithRequiredFile', 'requiredFile', requiredFile) + const localVarPath = `/fake/{petId}/uploadImageWithRequiredFile` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); + + // authentication petstore_auth required + // oauth required + await setOAuthToObject(localVarHeaderParameter, "petstore_auth", ["write:pets", "read:pets"], configuration) + + + if (additionalMetadata !== undefined) { + localVarFormParams.append('additionalMetadata', additionalMetadata as any); + } + + if (requiredFile !== undefined) { + localVarFormParams.append('requiredFile', requiredFile as any); + } + + + localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * PetApi - functional programming interface + * @export + */ +export const PetApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = PetApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async addPet(pet: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.addPet(pet, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deletePet(petId: number, apiKey?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deletePet(petId, apiKey, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByStatus(status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async findPetsByTags(tags: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.findPetsByTags(tags, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getPetById(petId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getPetById(petId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updatePet(pet: Pet, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePet(pet, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updatePetWithForm(petId, name, status, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFile(petId, additionalMetadata, file, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary uploads an image (required) + * @param {number} petId ID of pet to update + * @param {any} requiredFile file to upload + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async uploadFileWithRequiredFile(petId: number, requiredFile: any, additionalMetadata?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * PetApi - factory interface + * @export + */ +export const PetApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = PetApiFp(configuration) + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any): AxiosPromise { + return localVarFp.addPet(pet, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise { + return localVarFp.deletePet(petId, apiKey, options).then((request) => request(axios, basePath)); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise> { + return localVarFp.findPetsByStatus(status, options).then((request) => request(axios, basePath)); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): AxiosPromise> { + return localVarFp.findPetsByTags(tags, options).then((request) => request(axios, basePath)); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): AxiosPromise { + return localVarFp.getPetById(petId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any): AxiosPromise { + return localVarFp.updatePet(pet, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise { + return localVarFp.updatePetWithForm(petId, name, status, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise { + return localVarFp.uploadFile(petId, additionalMetadata, file, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary uploads an image (required) + * @param {number} petId ID of pet to update + * @param {any} requiredFile file to upload + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFileWithRequiredFile(petId: number, requiredFile: any, additionalMetadata?: string, options?: any): AxiosPromise { + return localVarFp.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(pet, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).deletePet(petId, apiKey, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(this.configuration).findPetsByStatus(status, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).getPetById(petId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).updatePet(pet, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary uploads an image (required) + * @param {number} petId ID of pet to update + * @param {any} requiredFile file to upload + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFileWithRequiredFile(petId: number, requiredFile: any, additionalMetadata?: string, options?: any) { + return PetApiFp(this.configuration).uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, options).then((request) => request(this.axios, this.basePath)); + } +} + + +/** + * StoreApi - axios parameter creator + * @export + */ +export const StoreApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder: async (orderId: string, options: any = {}): Promise => { + // verify required parameter 'orderId' is not null or undefined + assertParamExists('deleteOrder', 'orderId', orderId) + const localVarPath = `/store/order/{order_id}` + .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory: async (options: any = {}): Promise => { + const localVarPath = `/store/inventory`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + await setApiKeyToObject(localVarHeaderParameter, "api_key", configuration) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById: async (orderId: number, options: any = {}): Promise => { + // verify required parameter 'orderId' is not null or undefined + assertParamExists('getOrderById', 'orderId', orderId) + const localVarPath = `/store/order/{order_id}` + .replace(`{${"order_id"}}`, encodeURIComponent(String(orderId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder: async (order: Order, options: any = {}): Promise => { + // verify required parameter 'order' is not null or undefined + assertParamExists('placeOrder', 'order', order) + const localVarPath = `/store/order`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(order, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * StoreApi - functional programming interface + * @export + */ +export const StoreApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = StoreApiAxiosParamCreator(configuration) + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteOrder(orderId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteOrder(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getInventory(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<{ [key: string]: number; }>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getInventory(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getOrderById(orderId: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderById(orderId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async placeOrder(order: Order, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.placeOrder(order, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * StoreApi - factory interface + * @export + */ +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = StoreApiFp(configuration) + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): AxiosPromise { + return localVarFp.deleteOrder(orderId, options).then((request) => request(axios, basePath)); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): AxiosPromise<{ [key: string]: number; }> { + return localVarFp.getInventory(options).then((request) => request(axios, basePath)); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): AxiosPromise { + return localVarFp.getOrderById(orderId, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any): AxiosPromise { + return localVarFp.placeOrder(order, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).deleteOrder(orderId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getInventory(options?: any) { + return StoreApiFp(this.configuration).getInventory(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public placeOrder(order: Order, options?: any) { + return StoreApiFp(this.configuration).placeOrder(order, options).then((request) => request(this.axios, this.basePath)); + } +} + + +/** + * UserApi - axios parameter creator + * @export + */ +export const UserApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser: async (user: User, options: any = {}): Promise => { + // verify required parameter 'user' is not null or undefined + assertParamExists('createUser', 'user', user) + const localVarPath = `/user`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput: async (user: Array, options: any = {}): Promise => { + // verify required parameter 'user' is not null or undefined + assertParamExists('createUsersWithArrayInput', 'user', user) + const localVarPath = `/user/createWithArray`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput: async (user: Array, options: any = {}): Promise => { + // verify required parameter 'user' is not null or undefined + assertParamExists('createUsersWithListInput', 'user', user) + const localVarPath = `/user/createWithList`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser: async (username: string, options: any = {}): Promise => { + // verify required parameter 'username' is not null or undefined + assertParamExists('deleteUser', 'username', username) + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName: async (username: string, options: any = {}): Promise => { + // verify required parameter 'username' is not null or undefined + assertParamExists('getUserByName', 'username', username) + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser: async (username: string, password: string, options: any = {}): Promise => { + // verify required parameter 'username' is not null or undefined + assertParamExists('loginUser', 'username', username) + // verify required parameter 'password' is not null or undefined + assertParamExists('loginUser', 'password', password) + const localVarPath = `/user/login`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (username !== undefined) { + localVarQueryParameter['username'] = username; + } + + if (password !== undefined) { + localVarQueryParameter['password'] = password; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser: async (options: any = {}): Promise => { + const localVarPath = `/user/logout`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser: async (username: string, user: User, options: any = {}): Promise => { + // verify required parameter 'username' is not null or undefined + assertParamExists('updateUser', 'username', username) + // verify required parameter 'user' is not null or undefined + assertParamExists('updateUser', 'user', user) + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(user, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UserApi - functional programming interface + * @export + */ +export const UserApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = UserApiAxiosParamCreator(configuration) + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createUser(user: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createUser(user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createUsersWithArrayInput(user: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithArrayInput(user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createUsersWithListInput(user: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createUsersWithListInput(user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteUser(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteUser(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getUserByName(username: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getUserByName(username, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async loginUser(username: string, password: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.loginUser(username, password, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async logoutUser(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.logoutUser(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateUser(username: string, user: User, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUser(username, user, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * UserApi - factory interface + * @export + */ +export const UserApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = UserApiFp(configuration) + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any): AxiosPromise { + return localVarFp.createUser(user, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any): AxiosPromise { + return localVarFp.createUsersWithArrayInput(user, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any): AxiosPromise { + return localVarFp.createUsersWithListInput(user, options).then((request) => request(axios, basePath)); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): AxiosPromise { + return localVarFp.deleteUser(username, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): AxiosPromise { + return localVarFp.getUserByName(username, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): AxiosPromise { + return localVarFp.loginUser(username, password, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): AxiosPromise { + return localVarFp.logoutUser(options).then((request) => request(axios, basePath)); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any): AxiosPromise { + return localVarFp.updateUser(username, user, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(user: User, options?: any) { + return UserApiFp(this.configuration).createUser(user, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithListInput(user, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).deleteUser(username, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).getUserByName(username, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).loginUser(username, password, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public logoutUser(options?: any) { + return UserApiFp(this.configuration).logoutUser(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, user: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, user, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/base.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/base.ts new file mode 100644 index 00000000000..ffc1b092d6e --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; + +export const BASE_PATH = "http://petstore.swagger.io:80/v2".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts new file mode 100644 index 00000000000..35e91dfeee8 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/common.ts @@ -0,0 +1,138 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + if (Array.isArray(object[key])) { + searchParams.delete(key); + for (const item of object[key]) { + searchParams.append(key, item); + } + } else { + searchParams.set(key, object[key]); + } + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts new file mode 100644 index 00000000000..9d6922b1165 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/git_push.sh b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/git_push.sh @@ -0,0 +1,58 @@ +#!/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-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git 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 + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/index.ts b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/index.ts new file mode 100644 index 00000000000..7ffd3df3280 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-fake-endpoints-models-for-testing-with-http-signature/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index d09a686f837..e74890dab41 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -94,6 +94,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**TestInlineAdditionalProperties**](docs/FakeApi.md#testinlineadditionalproperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties *FakeApi* | [**TestJsonFormData**](docs/FakeApi.md#testjsonformdata) | **Get** /fake/jsonFormData | test json serialization of form data *FakeApi* | [**TestQueryParameterCollectionFormat**](docs/FakeApi.md#testqueryparametercollectionformat) | **Put** /fake/test-query-paramters | +*FakeApi* | [**TestUniqueItemsHeaderAndQueryParameterCollectionFormat**](docs/FakeApi.md#testuniqueitemsheaderandqueryparametercollectionformat) | **Put** /fake/test-unique-paramters | *FakeClassnameTags123Api* | [**TestClassname**](docs/FakeClassnameTags123Api.md#testclassname) | **Patch** /fake_classname_test | To test class name in snake case *PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **Post** /pet | Add a new pet to the store *PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet diff --git a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml index c55a3aec4ac..e0fba9d45fe 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -1120,6 +1120,43 @@ paths: description: Success tags: - fake + /fake/test-unique-paramters: + put: + description: To test unique items in header and query parameters + operationId: testUniqueItemsHeaderAndQueryParameterCollectionFormat + parameters: + - explode: true + in: query + name: queryUnique + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + - explode: false + in: header + name: headerUnique + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: simple + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + uniqueItems: true + description: Success + tags: + - fake /fake/{petId}/uploadImageWithRequiredFile: post: operationId: uploadFileWithRequiredFile diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go index c7d9644d638..0780536bcbb 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go @@ -215,6 +215,20 @@ type FakeApi interface { * TestQueryParameterCollectionFormatExecute executes the request */ TestQueryParameterCollectionFormatExecute(r ApiTestQueryParameterCollectionFormatRequest) (*_nethttp.Response, error) + + /* + * TestUniqueItemsHeaderAndQueryParameterCollectionFormat Method for TestUniqueItemsHeaderAndQueryParameterCollectionFormat + * To test unique items in header and query parameters + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest + */ + TestUniqueItemsHeaderAndQueryParameterCollectionFormat(ctx _context.Context) ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest + + /* + * TestUniqueItemsHeaderAndQueryParameterCollectionFormatExecute executes the request + * @return []Pet + */ + TestUniqueItemsHeaderAndQueryParameterCollectionFormatExecute(r ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest) ([]Pet, *_nethttp.Response, error) } // FakeApiService FakeApi service @@ -1978,3 +1992,133 @@ func (a *FakeApiService) TestQueryParameterCollectionFormatExecute(r ApiTestQuer return localVarHTTPResponse, nil } + +type ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest struct { + ctx _context.Context + ApiService FakeApi + queryUnique *[]string + headerUnique *[]string +} + +func (r ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest) QueryUnique(queryUnique []string) ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest { + r.queryUnique = &queryUnique + return r +} +func (r ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest) HeaderUnique(headerUnique []string) ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest { + r.headerUnique = &headerUnique + return r +} + +func (r ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest) Execute() ([]Pet, *_nethttp.Response, error) { + return r.ApiService.TestUniqueItemsHeaderAndQueryParameterCollectionFormatExecute(r) +} + +/* + * TestUniqueItemsHeaderAndQueryParameterCollectionFormat Method for TestUniqueItemsHeaderAndQueryParameterCollectionFormat + * To test unique items in header and query parameters + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest + */ +func (a *FakeApiService) TestUniqueItemsHeaderAndQueryParameterCollectionFormat(ctx _context.Context) ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest { + return ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return []Pet + */ +func (a *FakeApiService) TestUniqueItemsHeaderAndQueryParameterCollectionFormatExecute(r ApiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest) ([]Pet, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue []Pet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FakeApiService.TestUniqueItemsHeaderAndQueryParameterCollectionFormat") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/fake/test-unique-paramters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.queryUnique == nil { + return localVarReturnValue, nil, reportError("queryUnique is required and must be specified") + } + if r.headerUnique == nil { + return localVarReturnValue, nil, reportError("headerUnique is required and must be specified") + } + + { + t := *r.queryUnique + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("queryUnique", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("queryUnique", parameterToString(t, "multi")) + } + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + localVarHeaderParams["headerUnique"] = parameterToString(*r.headerUnique, "csv") + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md index 9021892276c..8ced9ff7c2a 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md @@ -18,6 +18,7 @@ Method | HTTP request | Description [**TestInlineAdditionalProperties**](FakeApi.md#TestInlineAdditionalProperties) | **Post** /fake/inline-additionalProperties | test inline additionalProperties [**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data [**TestQueryParameterCollectionFormat**](FakeApi.md#TestQueryParameterCollectionFormat) | **Put** /fake/test-query-paramters | +[**TestUniqueItemsHeaderAndQueryParameterCollectionFormat**](FakeApi.md#TestUniqueItemsHeaderAndQueryParameterCollectionFormat) | **Put** /fake/test-unique-paramters | @@ -978,3 +979,71 @@ No authorization required [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## TestUniqueItemsHeaderAndQueryParameterCollectionFormat + +> []Pet TestUniqueItemsHeaderAndQueryParameterCollectionFormat(ctx).QueryUnique(queryUnique).HeaderUnique(headerUnique).Execute() + + + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + queryUnique := []string{"Inner_example"} // []string | + headerUnique := []string{"Inner_example"} // []string | + + configuration := openapiclient.NewConfiguration() + api_client := openapiclient.NewAPIClient(configuration) + resp, r, err := api_client.FakeApi.TestUniqueItemsHeaderAndQueryParameterCollectionFormat(context.Background()).QueryUnique(queryUnique).HeaderUnique(headerUnique).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `FakeApi.TestUniqueItemsHeaderAndQueryParameterCollectionFormat``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `TestUniqueItemsHeaderAndQueryParameterCollectionFormat`: []Pet + fmt.Fprintf(os.Stdout, "Response from `FakeApi.TestUniqueItemsHeaderAndQueryParameterCollectionFormat`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTestUniqueItemsHeaderAndQueryParameterCollectionFormatRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryUnique** | **[]string** | | + **headerUnique** | **[]string** | | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + From fc58adee312b4b2684b9bd4dbfb57ca1c7eaa3a5 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 1 Apr 2021 13:34:19 -0700 Subject: [PATCH 04/89] Fixes serialization of array items in model_to_dict [python] (#9153) * Adds tests of endpoint with inline and refed model * Regen samples * Samples regenerated --- .../resources/python/model_utils.mustache | 20 +- ...odels-for-testing-with-http-signature.yaml | 75 ++++++ .../python/petstore_api/model_utils.py | 20 +- .../python/x_auth_id_alias/model_utils.py | 20 +- .../python/dynamic_servers/model_utils.py | 20 +- .../petstore/python/.openapi-generator/FILES | 6 + .../openapi3/client/petstore/python/README.md | 5 + .../client/petstore/python/docs/FakeApi.md | 144 +++++++++++ ...ineAdditionalPropertiesPayloadArrayData.md | 11 + .../InlineAdditionalPropertiesRefPayload.md | 12 + .../petstore/python/docs/InlineObject6.md | 12 + .../python/petstore_api/api/fake_api.py | 224 ++++++++++++++++++ ...dditional_properties_payload_array_data.py | 166 +++++++++++++ ...nline_additional_properties_ref_payload.py | 171 +++++++++++++ .../petstore_api/model/inline_object6.py | 171 +++++++++++++ .../python/petstore_api/model_utils.py | 20 +- .../python/petstore_api/models/__init__.py | 3 + .../petstore/python/test/test_fake_api.py | 49 +++- ...dditional_properties_payload_array_data.py | 35 +++ ...nline_additional_properties_ref_payload.py | 37 +++ .../python/test/test_inline_object6.py | 37 +++ .../python/tests_manual/test_fake_api.py | 69 ++++++ 22 files changed, 1290 insertions(+), 37 deletions(-) create mode 100644 samples/openapi3/client/petstore/python/docs/FakeGetInlineAdditionalPropertiesPayloadArrayData.md create mode 100644 samples/openapi3/client/petstore/python/docs/InlineAdditionalPropertiesRefPayload.md create mode 100644 samples/openapi3/client/petstore/python/docs/InlineObject6.md create mode 100644 samples/openapi3/client/petstore/python/petstore_api/model/fake_get_inline_additional_properties_payload_array_data.py create mode 100644 samples/openapi3/client/petstore/python/petstore_api/model/inline_additional_properties_ref_payload.py create mode 100644 samples/openapi3/client/petstore/python/petstore_api/model/inline_object6.py create mode 100644 samples/openapi3/client/petstore/python/test/test_fake_get_inline_additional_properties_payload_array_data.py create mode 100644 samples/openapi3/client/petstore/python/test/test_inline_additional_properties_ref_payload.py create mode 100644 samples/openapi3/client/petstore/python/test/test_inline_object6.py diff --git a/modules/openapi-generator/src/main/resources/python/model_utils.mustache b/modules/openapi-generator/src/main/resources/python/model_utils.mustache index 07b77a99d18..396948e0a35 100644 --- a/modules/openapi-generator/src/main/resources/python/model_utils.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_utils.mustache @@ -1211,13 +1211,19 @@ def model_to_dict(model_instance, serialize=True): # exist in attribute_map attr = model_instance.attribute_map.get(attr, attr) if isinstance(value, list): - if not value or isinstance(value[0], PRIMITIVE_TYPES): - # empty list or primitive types - result[attr] = value - elif isinstance(value[0], ModelSimple): - result[attr] = [x.value for x in value] - else: - result[attr] = [model_to_dict(x, serialize=serialize) for x in value] + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], diff --git a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index bd29a22a5f9..dc3743a492a 100644 --- a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1286,6 +1286,66 @@ paths: application/json: schema: $ref: '#/components/schemas/HealthCheckResult' + /fake/getInlineAdditionalPropertiesRefPayload: + get: + tags: + - fake + operationId: getInlineAdditionalPropertiesRefPayload + responses: + 200: + description: InlineAdditionalPropertiesRefPayload + content: + application/json: + schema: + $ref: '#/components/schemas/InlineAdditionalPropertiesRefPayload' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/InlineAdditionalPropertiesRefPayload' + /fake/getInlineAdditionalPropertiesPayload: + get: + tags: + - fake + operationId: getInlineAdditionalPropertiesPayload + responses: + 200: + description: InlineAdditionalPropertiesPayload + content: + application/json: + schema: + description: this payload is used for verification that some model_to_dict issues are fixed + type: object + properties: + arrayData: + type: array + nullable: true + items: + type: object + properties: + labels: + type: array + items: + type: string + nullable: true + requestBody: + content: + application/json: + schema: + description: this payload is used for verification that some model_to_dict issues are fixed + type: object + properties: + arrayData: + type: array + nullable: true + items: + type: object + properties: + labels: + type: array + items: + type: string + nullable: true servers: - url: 'http://{server}.swagger.io:{port}/v2' description: petstore server @@ -2318,3 +2378,18 @@ components: SomeObject: allOf: - $ref: '#/components/schemas/ObjectInterface' + InlineAdditionalPropertiesRefPayload: + description: this payload is used for verification that some model_to_dict issues are fixed + type: object + properties: + arrayData: + type: array + nullable: true + items: + type: object + properties: + labels: + type: array + items: + type: string + nullable: true \ No newline at end of file diff --git a/samples/client/petstore/python/petstore_api/model_utils.py b/samples/client/petstore/python/petstore_api/model_utils.py index ae554710670..11a6cbf2d1b 100644 --- a/samples/client/petstore/python/petstore_api/model_utils.py +++ b/samples/client/petstore/python/petstore_api/model_utils.py @@ -1493,13 +1493,19 @@ def model_to_dict(model_instance, serialize=True): # exist in attribute_map attr = model_instance.attribute_map.get(attr, attr) if isinstance(value, list): - if not value or isinstance(value[0], PRIMITIVE_TYPES): - # empty list or primitive types - result[attr] = value - elif isinstance(value[0], ModelSimple): - result[attr] = [x.value for x in value] - else: - result[attr] = [model_to_dict(x, serialize=serialize) for x in value] + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py index 3276615fd49..84c8c74a7f6 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py @@ -1493,13 +1493,19 @@ def model_to_dict(model_instance, serialize=True): # exist in attribute_map attr = model_instance.attribute_map.get(attr, attr) if isinstance(value, list): - if not value or isinstance(value[0], PRIMITIVE_TYPES): - # empty list or primitive types - result[attr] = value - elif isinstance(value[0], ModelSimple): - result[attr] = [x.value for x in value] - else: - result[attr] = [model_to_dict(x, serialize=serialize) for x in value] + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py index 7edd9487c37..6bb0bd10234 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py @@ -1493,13 +1493,19 @@ def model_to_dict(model_instance, serialize=True): # exist in attribute_map attr = model_instance.attribute_map.get(attr, attr) if isinstance(value, list): - if not value or isinstance(value[0], PRIMITIVE_TYPES): - # empty list or primitive types - result[attr] = value - elif isinstance(value[0], ModelSimple): - result[attr] = [x.value for x in value] - else: - result[attr] = [model_to_dict(x, serialize=serialize) for x in value] + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES index aa906bc845d..a6f26c9c81f 100644 --- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES @@ -39,6 +39,7 @@ docs/EnumTest.md docs/EquilateralTriangle.md docs/FakeApi.md docs/FakeClassnameTags123Api.md +docs/FakeGetInlineAdditionalPropertiesPayloadArrayData.md docs/File.md docs/FileSchemaTestClass.md docs/Foo.md @@ -49,6 +50,8 @@ docs/GmFruit.md docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md docs/HealthCheckResult.md +docs/InlineAdditionalPropertiesRefPayload.md +docs/InlineObject6.md docs/InlineResponseDefault.md docs/IntegerEnum.md docs/IntegerEnumOneValue.md @@ -142,6 +145,7 @@ petstore_api/model/enum_arrays.py petstore_api/model/enum_class.py petstore_api/model/enum_test.py petstore_api/model/equilateral_triangle.py +petstore_api/model/fake_get_inline_additional_properties_payload_array_data.py petstore_api/model/file.py petstore_api/model/file_schema_test_class.py petstore_api/model/foo.py @@ -152,6 +156,8 @@ petstore_api/model/gm_fruit.py petstore_api/model/grandparent_animal.py petstore_api/model/has_only_read_only.py petstore_api/model/health_check_result.py +petstore_api/model/inline_additional_properties_ref_payload.py +petstore_api/model/inline_object6.py petstore_api/model/inline_response_default.py petstore_api/model/integer_enum.py petstore_api/model/integer_enum_one_value.py diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 61aebac0aa1..49e1220659f 100644 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -91,6 +91,8 @@ Class | Method | HTTP request | Description *FakeApi* | [**download_attachment**](docs/FakeApi.md#download_attachment) | **GET** /{fileName} | downloads a file using Content-Disposition *FakeApi* | [**enum_test**](docs/FakeApi.md#enum_test) | **POST** /fake/refs/enum-test | Object contains enum properties and array properties containing enums *FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**get_inline_additional_properties_payload**](docs/FakeApi.md#get_inline_additional_properties_payload) | **GET** /fake/getInlineAdditionalPropertiesPayload | +*FakeApi* | [**get_inline_additional_properties_ref_payload**](docs/FakeApi.md#get_inline_additional_properties_ref_payload) | **GET** /fake/getInlineAdditionalPropertiesRefPayload | *FakeApi* | [**mammal**](docs/FakeApi.md#mammal) | **POST** /fake/refs/mammal | *FakeApi* | [**number_with_validations**](docs/FakeApi.md#number_with_validations) | **POST** /fake/refs/number | *FakeApi* | [**object_model_with_ref_props**](docs/FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props | @@ -165,6 +167,7 @@ Class | Method | HTTP request | Description - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FakeGetInlineAdditionalPropertiesPayloadArrayData](docs/FakeGetInlineAdditionalPropertiesPayloadArrayData.md) - [File](docs/File.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) @@ -175,6 +178,8 @@ Class | Method | HTTP request | Description - [GrandparentAnimal](docs/GrandparentAnimal.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [HealthCheckResult](docs/HealthCheckResult.md) + - [InlineAdditionalPropertiesRefPayload](docs/InlineAdditionalPropertiesRefPayload.md) + - [InlineObject6](docs/InlineObject6.md) - [InlineResponseDefault](docs/InlineResponseDefault.md) - [IntegerEnum](docs/IntegerEnum.md) - [IntegerEnumOneValue](docs/IntegerEnumOneValue.md) diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index 3bb042e8845..acc41cb4899 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -12,6 +12,8 @@ Method | HTTP request | Description [**download_attachment**](FakeApi.md#download_attachment) | **GET** /{fileName} | downloads a file using Content-Disposition [**enum_test**](FakeApi.md#enum_test) | **POST** /fake/refs/enum-test | Object contains enum properties and array properties containing enums [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +[**get_inline_additional_properties_payload**](FakeApi.md#get_inline_additional_properties_payload) | **GET** /fake/getInlineAdditionalPropertiesPayload | +[**get_inline_additional_properties_ref_payload**](FakeApi.md#get_inline_additional_properties_ref_payload) | **GET** /fake/getInlineAdditionalPropertiesRefPayload | [**mammal**](FakeApi.md#mammal) | **POST** /fake/refs/mammal | [**number_with_validations**](FakeApi.md#number_with_validations) | **POST** /fake/refs/number | [**object_model_with_ref_props**](FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props | @@ -562,6 +564,148 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **get_inline_additional_properties_payload** +> InlineObject6 get_inline_additional_properties_payload() + + + +### Example + +```python +import time +import petstore_api +from petstore_api.api import fake_api +from petstore_api.model.inline_object6 import InlineObject6 +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient() as api_client: + # Create an instance of the API class + api_instance = fake_api.FakeApi(api_client) + inline_object6 = InlineObject6( + array_data=[ + FakeGetInlineAdditionalPropertiesPayloadArrayData( + labels=[ + "labels_example", + ], + ), + ], + ) # InlineObject6 | (optional) + + # example passing only required values which don't have defaults set + # and optional values + try: + api_response = api_instance.get_inline_additional_properties_payload(inline_object6=inline_object6) + pprint(api_response) + except petstore_api.ApiException as e: + print("Exception when calling FakeApi->get_inline_additional_properties_payload: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inline_object6** | [**InlineObject6**](InlineObject6.md)| | [optional] + +### Return type + +[**InlineObject6**](InlineObject6.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | InlineAdditionalPropertiesPayload | - | + +[[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) + +# **get_inline_additional_properties_ref_payload** +> InlineAdditionalPropertiesRefPayload get_inline_additional_properties_ref_payload() + + + +### Example + +```python +import time +import petstore_api +from petstore_api.api import fake_api +from petstore_api.model.inline_additional_properties_ref_payload import InlineAdditionalPropertiesRefPayload +from pprint import pprint +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient() as api_client: + # Create an instance of the API class + api_instance = fake_api.FakeApi(api_client) + inline_additional_properties_ref_payload = InlineAdditionalPropertiesRefPayload( + array_data=[ + FakeGetInlineAdditionalPropertiesPayloadArrayData( + labels=[ + "labels_example", + ], + ), + ], + ) # InlineAdditionalPropertiesRefPayload | (optional) + + # example passing only required values which don't have defaults set + # and optional values + try: + api_response = api_instance.get_inline_additional_properties_ref_payload(inline_additional_properties_ref_payload=inline_additional_properties_ref_payload) + pprint(api_response) + except petstore_api.ApiException as e: + print("Exception when calling FakeApi->get_inline_additional_properties_ref_payload: %s\n" % e) +``` + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **inline_additional_properties_ref_payload** | [**InlineAdditionalPropertiesRefPayload**](InlineAdditionalPropertiesRefPayload.md)| | [optional] + +### Return type + +[**InlineAdditionalPropertiesRefPayload**](InlineAdditionalPropertiesRefPayload.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | InlineAdditionalPropertiesRefPayload | - | + +[[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) + # **mammal** > Mammal mammal(mammal) diff --git a/samples/openapi3/client/petstore/python/docs/FakeGetInlineAdditionalPropertiesPayloadArrayData.md b/samples/openapi3/client/petstore/python/docs/FakeGetInlineAdditionalPropertiesPayloadArrayData.md new file mode 100644 index 00000000000..0ba4e3b8e5a --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/FakeGetInlineAdditionalPropertiesPayloadArrayData.md @@ -0,0 +1,11 @@ +# FakeGetInlineAdditionalPropertiesPayloadArrayData + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**labels** | **[str, none_type]** | | [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/openapi3/client/petstore/python/docs/InlineAdditionalPropertiesRefPayload.md b/samples/openapi3/client/petstore/python/docs/InlineAdditionalPropertiesRefPayload.md new file mode 100644 index 00000000000..130320d1daa --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/InlineAdditionalPropertiesRefPayload.md @@ -0,0 +1,12 @@ +# InlineAdditionalPropertiesRefPayload + +this payload is used for verification that some model_to_dict issues are fixed + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_data** | [**[FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type**](FakeGetInlineAdditionalPropertiesPayloadArrayData.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python/docs/InlineObject6.md b/samples/openapi3/client/petstore/python/docs/InlineObject6.md new file mode 100644 index 00000000000..6e4975b3542 --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/InlineObject6.md @@ -0,0 +1,12 @@ +# InlineObject6 + +this payload is used for verification that some model_to_dict issues are fixed + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_data** | [**[FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type**](FakeGetInlineAdditionalPropertiesPayloadArrayData.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 6baed5ea63d..5f98e228c3b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -30,6 +30,8 @@ from petstore_api.model.composed_one_of_number_with_validations import ComposedO from petstore_api.model.enum_test import EnumTest from petstore_api.model.file_schema_test_class import FileSchemaTestClass from petstore_api.model.health_check_result import HealthCheckResult +from petstore_api.model.inline_additional_properties_ref_payload import InlineAdditionalPropertiesRefPayload +from petstore_api.model.inline_object6 import InlineObject6 from petstore_api.model.mammal import Mammal from petstore_api.model.number_with_validations import NumberWithValidations from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps @@ -943,6 +945,228 @@ class FakeApi(object): callable=__fake_health_get ) + def __get_inline_additional_properties_payload( + self, + **kwargs + ): + """get_inline_additional_properties_payload # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_inline_additional_properties_payload(async_req=True) + >>> result = thread.get() + + + Keyword Args: + inline_object6 (InlineObject6): [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + InlineObject6 + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.get_inline_additional_properties_payload = _Endpoint( + settings={ + 'response_type': (InlineObject6,), + 'auth': [], + 'endpoint_path': '/fake/getInlineAdditionalPropertiesPayload', + 'operation_id': 'get_inline_additional_properties_payload', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'inline_object6', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'inline_object6': + (InlineObject6,), + }, + 'attribute_map': { + }, + 'location_map': { + 'inline_object6': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__get_inline_additional_properties_payload + ) + + def __get_inline_additional_properties_ref_payload( + self, + **kwargs + ): + """get_inline_additional_properties_ref_payload # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_inline_additional_properties_ref_payload(async_req=True) + >>> result = thread.get() + + + Keyword Args: + inline_additional_properties_ref_payload (InlineAdditionalPropertiesRefPayload): [optional] + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (float/tuple): timeout setting for this request. If one + number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + InlineAdditionalPropertiesRefPayload + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.get_inline_additional_properties_ref_payload = _Endpoint( + settings={ + 'response_type': (InlineAdditionalPropertiesRefPayload,), + 'auth': [], + 'endpoint_path': '/fake/getInlineAdditionalPropertiesRefPayload', + 'operation_id': 'get_inline_additional_properties_ref_payload', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'inline_additional_properties_ref_payload', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'inline_additional_properties_ref_payload': + (InlineAdditionalPropertiesRefPayload,), + }, + 'attribute_map': { + }, + 'location_map': { + 'inline_additional_properties_ref_payload': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__get_inline_additional_properties_ref_payload + ) + def __mammal( self, mammal, diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/fake_get_inline_additional_properties_payload_array_data.py b/samples/openapi3/client/petstore/python/petstore_api/model/fake_get_inline_additional_properties_payload_array_data.py new file mode 100644 index 00000000000..bbbc449b429 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/model/fake_get_inline_additional_properties_payload_array_data.py @@ -0,0 +1,166 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + + +class FakeGetInlineAdditionalPropertiesPayloadArrayData(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'labels': ([str, none_type],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'labels': 'labels', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """FakeGetInlineAdditionalPropertiesPayloadArrayData - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + labels ([str, none_type]): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/inline_additional_properties_ref_payload.py b/samples/openapi3/client/petstore/python/petstore_api/model/inline_additional_properties_ref_payload.py new file mode 100644 index 00000000000..4d8e8aecff3 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/model/inline_additional_properties_ref_payload.py @@ -0,0 +1,171 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + +def lazy_import(): + from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData + globals()['FakeGetInlineAdditionalPropertiesPayloadArrayData'] = FakeGetInlineAdditionalPropertiesPayloadArrayData + + +class InlineAdditionalPropertiesRefPayload(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'array_data': ([FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'array_data': 'arrayData', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """InlineAdditionalPropertiesRefPayload - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + array_data ([FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/inline_object6.py b/samples/openapi3/client/petstore/python/petstore_api/model/inline_object6.py new file mode 100644 index 00000000000..d60fec5fa68 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/model/inline_object6.py @@ -0,0 +1,171 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from petstore_api.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) + +def lazy_import(): + from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData + globals()['FakeGetInlineAdditionalPropertiesPayloadArrayData'] = FakeGetInlineAdditionalPropertiesPayloadArrayData + + +class InlineObject6(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + additional_properties_type = None + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'array_data': ([FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'array_data': 'arrayData', # noqa: E501 + } + + _composed_schemas = {} + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """InlineObject6 - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + array_data ([FakeGetInlineAdditionalPropertiesPayloadArrayData], none_type): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) diff --git a/samples/openapi3/client/petstore/python/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python/petstore_api/model_utils.py index ae554710670..11a6cbf2d1b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model_utils.py @@ -1493,13 +1493,19 @@ def model_to_dict(model_instance, serialize=True): # exist in attribute_map attr = model_instance.attribute_map.get(attr, attr) if isinstance(value, list): - if not value or isinstance(value[0], PRIMITIVE_TYPES): - # empty list or primitive types - result[attr] = value - elif isinstance(value[0], ModelSimple): - result[attr] = [x.value for x in value] - else: - result[attr] = [model_to_dict(x, serialize=serialize) for x in value] + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py index 4941dc7de6e..1d9f8235ac7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -42,6 +42,7 @@ from petstore_api.model.enum_arrays import EnumArrays from petstore_api.model.enum_class import EnumClass from petstore_api.model.enum_test import EnumTest from petstore_api.model.equilateral_triangle import EquilateralTriangle +from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData from petstore_api.model.file import File from petstore_api.model.file_schema_test_class import FileSchemaTestClass from petstore_api.model.foo import Foo @@ -52,6 +53,8 @@ from petstore_api.model.gm_fruit import GmFruit from petstore_api.model.grandparent_animal import GrandparentAnimal from petstore_api.model.has_only_read_only import HasOnlyReadOnly from petstore_api.model.health_check_result import HealthCheckResult +from petstore_api.model.inline_additional_properties_ref_payload import InlineAdditionalPropertiesRefPayload +from petstore_api.model.inline_object6 import InlineObject6 from petstore_api.model.inline_response_default import InlineResponseDefault from petstore_api.model.integer_enum import IntegerEnum from petstore_api.model.integer_enum_one_value import IntegerEnumOneValue diff --git a/samples/openapi3/client/petstore/python/test/test_fake_api.py b/samples/openapi3/client/petstore/python/test/test_fake_api.py index 48230221f42..8782dcd4c23 100644 --- a/samples/openapi3/client/petstore/python/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python/test/test_fake_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ OpenAPI Petstore @@ -57,6 +55,20 @@ class TestFakeApi(unittest.TestCase): """ pass + def test_download_attachment(self): + """Test case for download_attachment + + downloads a file using Content-Disposition # noqa: E501 + """ + pass + + def test_enum_test(self): + """Test case for enum_test + + Object contains enum properties and array properties containing enums # noqa: E501 + """ + pass + def test_fake_health_get(self): """Test case for fake_health_get @@ -64,6 +76,18 @@ class TestFakeApi(unittest.TestCase): """ pass + def test_get_inline_additionl_properties_ref_payload(self): + """Test case for get_inline_additionl_properties_ref_payload + + """ + pass + + def test_mammal(self): + """Test case for mammal + + """ + pass + def test_number_with_validations(self): """Test case for number_with_validations @@ -148,6 +172,27 @@ class TestFakeApi(unittest.TestCase): """ pass + def test_upload_download_file(self): + """Test case for upload_download_file + + uploads a file and downloads a file using application/octet-stream # noqa: E501 + """ + pass + + def test_upload_file(self): + """Test case for upload_file + + uploads a file using multipart/form-data # noqa: E501 + """ + pass + + def test_upload_files(self): + """Test case for upload_files + + uploads files using multipart/form-data # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_fake_get_inline_additional_properties_payload_array_data.py b/samples/openapi3/client/petstore/python/test/test_fake_get_inline_additional_properties_payload_array_data.py new file mode 100644 index 00000000000..2e95eb37dff --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_fake_get_inline_additional_properties_payload_array_data.py @@ -0,0 +1,35 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import petstore_api +from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData + + +class TestFakeGetInlineAdditionalPropertiesPayloadArrayData(unittest.TestCase): + """FakeGetInlineAdditionalPropertiesPayloadArrayData unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFakeGetInlineAdditionalPropertiesPayloadArrayData(self): + """Test FakeGetInlineAdditionalPropertiesPayloadArrayData""" + # FIXME: construct object with mandatory attributes with example values + # model = FakeGetInlineAdditionalPropertiesPayloadArrayData() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_inline_additional_properties_ref_payload.py b/samples/openapi3/client/petstore/python/test/test_inline_additional_properties_ref_payload.py new file mode 100644 index 00000000000..709ee27adc8 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_inline_additional_properties_ref_payload.py @@ -0,0 +1,37 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import petstore_api +from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData +globals()['FakeGetInlineAdditionalPropertiesPayloadArrayData'] = FakeGetInlineAdditionalPropertiesPayloadArrayData +from petstore_api.model.inline_additional_properties_ref_payload import InlineAdditionalPropertiesRefPayload + + +class TestInlineAdditionalPropertiesRefPayload(unittest.TestCase): + """InlineAdditionalPropertiesRefPayload unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInlineAdditionalPropertiesRefPayload(self): + """Test InlineAdditionalPropertiesRefPayload""" + # FIXME: construct object with mandatory attributes with example values + # model = InlineAdditionalPropertiesRefPayload() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_inline_object6.py b/samples/openapi3/client/petstore/python/test/test_inline_object6.py new file mode 100644 index 00000000000..463123d8e55 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_inline_object6.py @@ -0,0 +1,37 @@ +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import sys +import unittest + +import petstore_api +from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData +globals()['FakeGetInlineAdditionalPropertiesPayloadArrayData'] = FakeGetInlineAdditionalPropertiesPayloadArrayData +from petstore_api.model.inline_object6 import InlineObject6 + + +class TestInlineObject6(unittest.TestCase): + """InlineObject6 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testInlineObject6(self): + """Test InlineObject6""" + # FIXME: construct object with mandatory attributes with example values + # model = InlineObject6() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_fake_api.py b/samples/openapi3/client/petstore/python/tests_manual/test_fake_api.py index 12fb6163684..8c0886e373b 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_fake_api.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_fake_api.py @@ -604,6 +604,75 @@ class TestFakeApi(unittest.TestCase): """ pass + def test_get_inline_additional_properties_ref_payload(self): + """Test case for getInlineAdditionlPropertiesRefPayload + """ + from petstore_api.model.inline_additional_properties_ref_payload import InlineAdditionalPropertiesRefPayload + from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData + endpoint = self.api.get_inline_additional_properties_ref_payload + assert endpoint.openapi_types['inline_additional_properties_ref_payload'] == (InlineAdditionalPropertiesRefPayload,) + assert endpoint.settings['response_type'] == (InlineAdditionalPropertiesRefPayload,) + + # serialization + deserialization works + from petstore_api.rest import RESTClientObject, RESTResponse + with patch.object(RESTClientObject, 'request') as mock_method: + expected_json_body = { + 'array_data': [ + { + 'labels': [ + None, + 'foo' + ] + } + ] + } + inline_additional_properties_ref_payload = InlineAdditionalPropertiesRefPayload( + array_data=[ + FakeGetInlineAdditionalPropertiesPayloadArrayData(labels=[None, 'foo']) + ] + ) + mock_method.return_value = self.mock_response(expected_json_body) + + response = endpoint(inline_additional_properties_ref_payload=inline_additional_properties_ref_payload) + self.assert_request_called_with(mock_method, 'http://petstore.swagger.io:80/v2/fake/refs/enum', body=expected_json_body) + + assert isinstance(response, InlineAdditionalPropertiesRefPayload) + assert response.to_dict() == expected_json_body + + def test_get_inline_additional_properties_payload(self): + """Test case for getInlineAdditionlPropertiesPayload + """ + from petstore_api.model.inline_object6 import InlineObject6 + from petstore_api.model.fake_get_inline_additional_properties_payload_array_data import FakeGetInlineAdditionalPropertiesPayloadArrayData + endpoint = self.api.get_inline_additional_properties_payload + assert endpoint.openapi_types['inline_object6'] == (InlineObject6,) + assert endpoint.settings['response_type'] == (InlineObject6,) + + # serialization + deserialization works + from petstore_api.rest import RESTClientObject, RESTResponse + with patch.object(RESTClientObject, 'request') as mock_method: + expected_json_body = { + 'array_data': [ + { + 'labels': [ + None, + 'foo' + ] + } + ] + } + inline_object6 = InlineObject6( + array_data=[ + FakeGetInlineAdditionalPropertiesPayloadArrayData(labels=[None, 'foo']) + ] + ) + mock_method.return_value = self.mock_response(expected_json_body) + + response = endpoint(inline_object6=inline_object6) + self.assert_request_called_with(mock_method, 'http://petstore.swagger.io:80/v2/fake/refs/enum', body=expected_json_body) + + assert isinstance(response, InlineObject6) + assert response.to_dict() == expected_json_body if __name__ == '__main__': unittest.main() From 4db6f46a00a0f4d6ac2b082b4ca8dd81e7f731eb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 3 Apr 2021 11:18:05 +0800 Subject: [PATCH 05/89] Add links to blog posts about openapi-generator (#9164) * Add links to blog posts about openapi-generator * add more articles * add more article --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 5b36ced7376..84a876cf0b8 100644 --- a/README.md +++ b/README.md @@ -814,6 +814,12 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2021-01-18 - [「アプリ開発あるある」を疑うことから始まった、API Clientコードの自動生成【デブスト2020】](https://codezine.jp/article/detail/13406?p=2) by [CodeZine編集部](https://codezine.jp/author/1) - 2021-02-05 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://blog.viadee.de/en/rest-api-roundtrip) by [Benjamin Klatt](https://twitter.com/benklatt) at [viadee](https://www.viadee.de/en/) - 2021-02-17 - [REST-API-Roundtrip with SpringDoc and OpenAPI Generator](https://medium.com/nerd-for-tech/rest-api-roundtrip-with-springdoc-and-openapi-generator-30bd27ccf698) by [cloud @viadee](https://cloud-viadee.medium.com/) +- 2021-03-08 - [OpenAPI Generator 工具的躺坑尝试](https://blog.csdn.net/u013019701/article/details/114531975) by [独家雨天](https://blog.csdn.net/u013019701) at [CSDN官方博客](https://blog.csdn.net/) +- 2021-03-16 - [如何基于 Swagger 使用 OpenAPI Generator 生成 JMeter 脚本?](https://cloud.tencent.com/developer/article/1802704) by [高楼Zee](https://cloud.tencent.com/developer/user/5836255) at [腾讯云专栏](https://cloud.tencent.com/developer/column) +- 2021-03-24 - [openapi-generator-cli による TypeScript 型定義](https://zenn.dev/takepepe/articles/openapi-generator-cli-ts) by [Takefumi Yoshii](https://zenn.dev/takepepe) +- 2021-03-28 - [Trying out NestJS part 4: Generate Typescript clients from OpenAPI documents](https://dev.to/arnaudcortisse/trying-out-nestjs-part-4-generate-typescript-clients-from-openapi-documents-28mk) by [Arnaud Cortisse](https://dev.to/arnaudcortisse) +- 2021-03-31 - [Open API Server Implementation Using OpenAPI Generator](https://www.baeldung.com/java-openapi-generator-server) at [Baeldung](https://www.baeldung.com/) +- 2021-03-31 - [使用OpenAPI Generator實現Open API Server](https://www.1ju.org/article/java-openapi-generator-server) at [億聚網](https://www.1ju.org/) ## [6 - About Us](#table-of-contents) From 7a3b01a0f63e6b9a98962c189d7d985316544234 Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Sat, 3 Apr 2021 05:28:25 +0200 Subject: [PATCH 06/89] Update usage.md with current CLI output (#9156) --- docs/usage.md | 120 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 82 insertions(+), 38 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index a5719e27761..bfc2c4fa2a4 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -10,12 +10,13 @@ This page demonstrates navigating the options via CLI. Commands are presented he The `help` option lists all commands available to the CLI. -```bash +```text openapi-generator-cli help usage: openapi-generator-cli [] The most commonly used openapi-generator-cli commands are: author Utilities for authoring generators or customizing templates. + batch Generate code in batch via external configs. config-help Config help for chosen lang generate Generate code with the specified generator. help Display help information about openapi-generator @@ -30,26 +31,28 @@ command. ## version -The version command provides version information, returning either the semver version by default or the git sha when passed `--sha`. +The version command provides version information, returning either the [semver version](https://semver.org/) by default, the git commit sha when passed `--sha`, or verbose output when passed `--full`. -```bash +```text NAME - openapi-generator-cli version - Show version information + openapi-generator-cli version - Show version information used in tooling SYNOPSIS - openapi-generator-cli version [--sha] + openapi-generator-cli version [--full] [--sha] OPTIONS + --full + Full version details + --sha Git commit SHA version - ``` ## list The `list` command outputs a formatted list of every available generator. Pass the `-s/--short` option if you would like a CSV output for easy parsing. -```bash +```text openapi-generator-cli help list NAME openapi-generator-cli list - Lists the available generators @@ -66,7 +69,6 @@ OPTIONS -s, --short shortened output (suitable for scripting) - ``` Example: @@ -81,26 +83,49 @@ For the full list of generators, refer to the [Generators List](./generators.md) The `config-help` option provides details about -```bash +```text openapi-generator-cli help config-help NAME openapi-generator-cli config-help - Config help for chosen lang SYNOPSIS openapi-generator-cli config-help - [(-f | --format )] + [(-f | --format )] [--feature-set] + [--full-details] [(-g | --generator-name )] - [--markdown-header] [--named-header] - [(-o | --output )] + [--import-mappings] [--instantiation-types] + [--language-specific-primitive] [--markdown-header] [--named-header] + [(-o | --output )] [--reserved-words] OPTIONS -f , --format Write output files in the desired format. Options are 'text', 'markdown' or 'yamlsample'. Default is 'text'. + --feature-set + displays feature set as supported by the generator + + --full-details + displays CLI options as well as other configs/mappings (implies + --instantiation-types, --reserved-words, + --language-specific-primitives, --import-mappings, + --supporting-files) + -g , --generator-name generator to get config help for + --import-mappings + displays the default import mappings (types and aliases, and what + imports they will pull into the template) + + --instantiation-types + displays types used to instantiate simple type/alias names + + --language-specific-primitive + displays the language specific primitives (types which require no + additional imports, or which may conflict with user defined model + names) + --markdown-header When format=markdown, include this option to write out markdown headers (e.g. for docusaurus). @@ -112,6 +137,9 @@ OPTIONS Optionally write help to this location, otherwise default is standard output + --reserved-words + displays the reserved words which may result in renamed model or + property names ``` The option of note is `-g/--generator-name` (other options are exposed for tooling). @@ -153,7 +181,7 @@ To pass these go client generator-specific options to the `generate` command for The `meta` command creates a new Java class and template files, used for creating your own custom templates. -```bash +```text openapi-generator-cli help meta NAME openapi-generator-cli meta - MetaGenerator. Generator for creating a new @@ -161,11 +189,15 @@ NAME the language you specify, and includes default templates to include. SYNOPSIS - openapi-generator-cli meta [(-n | --name )] + openapi-generator-cli meta [(-l | --language )] + [(-n | --name )] [(-o | --output )] [(-p | --package )] [(-t | --type )] OPTIONS + -l , --language + the implementation language for the generator class + -n , --name the human-readable name of the generator @@ -186,7 +218,7 @@ For an in-depth example of using the `meta` command, see [Customization](./custo The `validate` command allows you to validate an input specification, optionally providing recommendations for error fixes or other improvements (if available). -```bash +```text openapi-generator-cli help validate NAME openapi-generator-cli validate - Validate specification @@ -200,7 +232,6 @@ OPTIONS location of the OpenAPI spec, as URL or file (required) --recommend - ``` Valid Spec Example (using [petstore-v3.0.yaml](https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator-gradle-plugin/samples/local-spec/petstore-v3.0.yaml)) @@ -250,7 +281,7 @@ An example bash completion script can be found in the repo at [scripts/openapi-g The `generate` command is the workhorse of the generator toolset. As such, it has _many_ more options available than the previous commands. The abbreviated options are below, but you may expand the full descriptions. -```bash +```text openapi-generator-cli help generate NAME openapi-generator-cli generate - Generate code with the specified @@ -269,23 +300,24 @@ SYNOPSIS [--git-repo-id ] [--git-user-id ] [--global-property ...] [--group-id ] [--http-user-agent ] - (-i | --input-spec ) + [(-i | --input-spec )] [--ignore-file-override ] [--import-mappings ...] [--instantiation-types ...] [--invoker-package ] [--language-specific-primitives ...] - [--library ] [--log-to-stderr] [--minimal-update] + [--legacy-discriminator-behavior] [--library ] + [--log-to-stderr] [--minimal-update] [--model-name-prefix ] [--model-name-suffix ] [--model-package ] - [(-o | --output )] - [(-p | --additional-properties )...] + [(-o | --output )] [(-p | --additional-properties )...] [--package-name ] [--release-note ] [--remove-operation-id-prefix] [--reserved-words-mappings ...] [(-s | --skip-overwrite)] [--server-variables ...] - [--skip-validate-spec] [--strict-spec ] + [--skip-operation-example] [--skip-validate-spec] + [--strict-spec ] [(-t