forked from loafle/openapi-generator-original
Compare commits
17 Commits
skip-form-
...
add-const
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b52f6aa204 | ||
|
|
3b81c707b6 | ||
|
|
3ca8bb3e5a | ||
|
|
e9c767d098 | ||
|
|
4b87606665 | ||
|
|
d671fe24ee | ||
|
|
e75e5a2c57 | ||
|
|
ec59334904 | ||
|
|
82e3590eed | ||
|
|
353507ef23 | ||
|
|
9170e1030f | ||
|
|
4260c7aaf0 | ||
|
|
781ccae722 | ||
|
|
5b4d97016a | ||
|
|
9c4f6c46f7 | ||
|
|
a5f79a7bdc | ||
|
|
70543126f2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -212,6 +212,7 @@ samples/server/petstore/kotlin-server/ktor/build
|
||||
samples/server/petstore/kotlin-springboot/build
|
||||
samples/client/petstore/kotlin*/src/main/kotlin/test/
|
||||
samples/client/petstore/kotlin*/build/
|
||||
samples/server/others/kotlin-server/jaxrs-spec/build/
|
||||
|
||||
# haskell
|
||||
.stack-work
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.8
|
||||
11
|
||||
|
||||
6
bin/configs/go-echo-api.yaml
Normal file
6
bin/configs/go-echo-api.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
generatorName: go
|
||||
outputDir: samples/client/echo_api/go
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/go
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
6
bin/configs/php-nextgen-echo-api.yaml
Normal file
6
bin/configs/php-nextgen-echo-api.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
generatorName: php-nextgen
|
||||
outputDir: samples/client/echo_api/php-nextgen
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/php-nextgen
|
||||
additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
@@ -1,4 +1,4 @@
|
||||
generatorName: php-nextgen
|
||||
outputDir: samples/client/petstore/php-nextgen/OpenAPIClient-php
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/php-nextgen/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/php-nextgen
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
generatorName: python-flask
|
||||
outputDir: samples/server/petstore/python-flask
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-flask/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/python-flask
|
||||
|
||||
@@ -25,6 +25,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-groovy|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|async|use async Callable controllers| |false|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-client|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-inflector-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|authorizationFilterPattern|Configure the authorization filter pattern for the client. Generally defined when generating clients from multiple specification files| |null|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|basePathSeparator|Configure the separator to use between the application name and base path when referencing the property| |-|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-micronaut|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|build|Specify for which build tool to generate files|<dl><dt>**gradle**</dt><dd>Gradle configuration is generated for the project</dd><dt>**all**</dt><dd>Both Gradle and Maven configurations are generated</dd><dt>**maven**</dt><dd>Maven configuration is generated for the project</dd></dl>|all|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |pkmst-microservice|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|basePackage|base package for java source code| |null|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-playframework|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|basePackage|base package for generated code| |org.openapitools|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-undertow-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-vertx-web-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-java-vertx-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0-SNAPSHOT|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -29,6 +29,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|asyncNative|If true, async handlers will be used, instead of the sync version| |false|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-cxf-cdi-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-client|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-cxf-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -28,6 +28,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-cxf-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-resteasy-eap-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-resteasy-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |openapi-jaxrs-server|
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|camelCaseDollarSign|Fix camelCase when starting with $ sign. when true : $Value when false : $value| |false|
|
||||
|
||||
@@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|
||||
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0|
|
||||
|async|use async Callable controllers| |false|
|
||||
|autosetConstants|Automatically set Required Params having a Single enum value i.e. Constants in generated code| |false|
|
||||
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|
||||
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|
||||
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
|
||||
|
||||
@@ -33,12 +33,5 @@ open class OpenApiGeneratorValidateExtension(project: Project) {
|
||||
/**
|
||||
* Whether to offer recommendations related to the validated specification document.
|
||||
*/
|
||||
val recommend = project.objects.property<Boolean?>()
|
||||
|
||||
init {
|
||||
applyDefaults()
|
||||
}
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
fun applyDefaults() = recommend.set(true)
|
||||
val recommend = project.objects.property<Boolean>().convention(true)
|
||||
}
|
||||
@@ -58,7 +58,7 @@ open class ValidateTask : DefaultTask() {
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
val recommend = project.objects.property<Boolean?>()
|
||||
val recommend = project.objects.property<Boolean>().convention(true)
|
||||
|
||||
@get:Internal
|
||||
@set:Option(option = "input", description = "The input specification.")
|
||||
|
||||
@@ -144,4 +144,161 @@ class ValidateTaskDslTest : TestBase() {
|
||||
"Expected a failed run, but found ${result.task(":openApiValidate")?.outcome}"
|
||||
)
|
||||
}
|
||||
|
||||
@Test(dataProvider = "gradle_version_provider")
|
||||
fun `validateGoodSpec as defined task should succeed on valid spec`(gradleVersion: String?) {
|
||||
// Arrange
|
||||
val projectFiles = mapOf(
|
||||
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0.yaml")
|
||||
)
|
||||
|
||||
withProject(
|
||||
"""
|
||||
| plugins {
|
||||
| id 'org.openapi.generator'
|
||||
| }
|
||||
|
|
||||
| task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask) {
|
||||
| inputSpec.set(file("spec.yaml").absolutePath)
|
||||
| }
|
||||
""".trimMargin(), projectFiles
|
||||
)
|
||||
|
||||
// Act
|
||||
val result = getGradleRunner(gradleVersion)
|
||||
.withProjectDir(temp)
|
||||
.withArguments("validateGoodSpec")
|
||||
.withPluginClasspath()
|
||||
.build()
|
||||
|
||||
// Assert
|
||||
assertTrue(
|
||||
result.output.contains("Spec is valid."),
|
||||
"Unexpected/no message presented to the user for a valid spec."
|
||||
)
|
||||
assertEquals(
|
||||
SUCCESS, result.task(":validateGoodSpec")?.outcome,
|
||||
"Expected a successful run, but found ${result.task(":validateGoodSpec")?.outcome}"
|
||||
)
|
||||
}
|
||||
|
||||
@Test(dataProvider = "gradle_version_provider")
|
||||
fun `validateBadSpec as defined task should fail on invalid spec`(gradleVersion: String?) {
|
||||
// Arrange
|
||||
val projectFiles = mapOf(
|
||||
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0-invalid.yaml")
|
||||
)
|
||||
withProject(
|
||||
"""
|
||||
| plugins {
|
||||
| id 'org.openapi.generator'
|
||||
| }
|
||||
|
|
||||
| task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask) {
|
||||
| inputSpec.set(file("spec.yaml").absolutePath)
|
||||
| }
|
||||
""".trimMargin(), projectFiles
|
||||
)
|
||||
|
||||
// Act
|
||||
val result = getGradleRunner(gradleVersion)
|
||||
.withProjectDir(temp)
|
||||
.withArguments("validateBadSpec")
|
||||
.withPluginClasspath()
|
||||
.buildAndFail()
|
||||
|
||||
// Assert
|
||||
assertTrue(
|
||||
result.output.contains("Spec is invalid."),
|
||||
"Unexpected/no message presented to the user for an invalid spec."
|
||||
)
|
||||
assertEquals(
|
||||
FAILED, result.task(":validateBadSpec")?.outcome,
|
||||
"Expected a failed run, but found ${result.task(":validateBadSpec")?.outcome}"
|
||||
)
|
||||
}
|
||||
|
||||
@Test(dataProvider = "gradle_version_provider")
|
||||
fun `openApiValidate should succeed with recommendations on valid spec`(gradleVersion: String?) {
|
||||
// Arrange
|
||||
val projectFiles = mapOf(
|
||||
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0-recommend.yaml")
|
||||
)
|
||||
|
||||
// recommend = true is the default
|
||||
withProject(
|
||||
"""
|
||||
| plugins {
|
||||
| id 'org.openapi.generator'
|
||||
| }
|
||||
|
|
||||
| openApiValidate {
|
||||
| inputSpec = file("spec.yaml").absolutePath
|
||||
| }
|
||||
""".trimMargin(), projectFiles
|
||||
)
|
||||
|
||||
// Act
|
||||
val result = getGradleRunner(gradleVersion)
|
||||
.withProjectDir(temp)
|
||||
.withArguments("openApiValidate")
|
||||
.withPluginClasspath()
|
||||
.build()
|
||||
|
||||
// Assert
|
||||
assertTrue(
|
||||
result.output.contains("Spec is valid."),
|
||||
"Unexpected/no message presented to the user for a valid spec."
|
||||
)
|
||||
assertTrue(
|
||||
result.output.contains("Spec has issues or recommendations."),
|
||||
"Unexpected/no recommendations message presented to the user for a valid spec."
|
||||
)
|
||||
assertEquals(
|
||||
SUCCESS, result.task(":openApiValidate")?.outcome,
|
||||
"Expected a successful run, but found ${result.task(":openApiValidate")?.outcome}"
|
||||
)
|
||||
}
|
||||
|
||||
@Test(dataProvider = "gradle_version_provider")
|
||||
fun `openApiValidate should succeed without recommendations on valid spec`(gradleVersion: String?) {
|
||||
// Arrange
|
||||
val projectFiles = mapOf(
|
||||
"spec.yaml" to javaClass.classLoader.getResourceAsStream("specs/petstore-v3.0-recommend.yaml")
|
||||
)
|
||||
|
||||
withProject(
|
||||
"""
|
||||
| plugins {
|
||||
| id 'org.openapi.generator'
|
||||
| }
|
||||
|
|
||||
| openApiValidate {
|
||||
| inputSpec = file("spec.yaml").absolutePath
|
||||
| recommend = false
|
||||
| }
|
||||
""".trimMargin(), projectFiles
|
||||
)
|
||||
|
||||
// Act
|
||||
val result = getGradleRunner(gradleVersion)
|
||||
.withProjectDir(temp)
|
||||
.withArguments("openApiValidate")
|
||||
.withPluginClasspath()
|
||||
.build()
|
||||
|
||||
// Assert
|
||||
assertTrue(
|
||||
result.output.contains("Spec is valid."),
|
||||
"Unexpected/no message presented to the user for a valid spec."
|
||||
)
|
||||
assertTrue(
|
||||
result.output.contains("Spec has issues or recommendations.").not(),
|
||||
"Unexpected/recommendations message presented to the user for a valid spec"
|
||||
)
|
||||
assertEquals(
|
||||
SUCCESS, result.task(":openApiValidate")?.outcome,
|
||||
"Expected a successful run, but found ${result.task(":openApiValidate")?.outcome}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
openapi: "3.0.0"
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Swagger Petstore
|
||||
license:
|
||||
name: MIT
|
||||
servers:
|
||||
- url: http://petstore.swagger.io/v1
|
||||
paths:
|
||||
/pets:
|
||||
get:
|
||||
summary: List all pets
|
||||
operationId: listPets
|
||||
tags:
|
||||
- pets
|
||||
parameters:
|
||||
- name: limit
|
||||
in: query
|
||||
description: How many items to return at one time (max 100)
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
requestBody: # warning `API GET/HEAD defined with request body`
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Pets"
|
||||
responses:
|
||||
'200':
|
||||
description: A paged array of pets
|
||||
headers:
|
||||
x-next:
|
||||
description: A link to the next page of responses
|
||||
schema:
|
||||
type: string
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Pets"
|
||||
default:
|
||||
description: unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
post:
|
||||
summary: Create a pet
|
||||
operationId: createPets
|
||||
tags:
|
||||
- pets
|
||||
responses:
|
||||
'201':
|
||||
description: Null response
|
||||
default:
|
||||
description: unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
/pets/{petId}:
|
||||
get:
|
||||
summary: Info for a specific pet
|
||||
operationId: showPetById
|
||||
tags:
|
||||
- pets
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
required: true
|
||||
description: The id of the pet to retrieve
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: Expected response to a valid request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Pets"
|
||||
default:
|
||||
description: unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
components:
|
||||
schemas:
|
||||
Pet:
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
tag:
|
||||
type: string
|
||||
Pets:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Pet"
|
||||
Error:
|
||||
required:
|
||||
- code
|
||||
- message
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
message:
|
||||
type: string
|
||||
@@ -30,7 +30,7 @@ public class CodegenOperation {
|
||||
hasVersionHeaders = false, hasVersionQueryParams = false,
|
||||
isResponseBinary = false, isResponseFile = false, isResponseOptional = false, hasReference = false, defaultReturnType = false,
|
||||
isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy,
|
||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false,
|
||||
isRestful, isDeprecated, isCallbackRequest, uniqueItems, hasDefaultResponse = false, hasConstantParams = false,
|
||||
hasErrorResponseObject; // if 4xx, 5xx responses have at least one error object defined
|
||||
public CodegenProperty returnProperty;
|
||||
public String path, operationId, returnType, returnFormat, httpMethod, returnBaseType,
|
||||
@@ -45,6 +45,7 @@ public class CodegenOperation {
|
||||
public List<CodegenParameter> queryParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> headerParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> implicitHeadersParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> constantParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> cookieParams = new ArrayList<CodegenParameter>();
|
||||
public List<CodegenParameter> requiredParams = new ArrayList<CodegenParameter>();
|
||||
@@ -392,6 +393,7 @@ public class CodegenOperation {
|
||||
sb.append(", operationIdLowerCase='").append(operationIdLowerCase).append('\'');
|
||||
sb.append(", operationIdCamelCase='").append(operationIdCamelCase).append('\'');
|
||||
sb.append(", operationIdSnakeCase='").append(operationIdSnakeCase).append('\'');
|
||||
sb.append(", constantParams='").append(constantParams).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -472,7 +474,8 @@ public class CodegenOperation {
|
||||
Objects.equals(operationIdOriginal, that.operationIdOriginal) &&
|
||||
Objects.equals(operationIdLowerCase, that.operationIdLowerCase) &&
|
||||
Objects.equals(operationIdCamelCase, that.operationIdCamelCase) &&
|
||||
Objects.equals(operationIdSnakeCase, that.operationIdSnakeCase);
|
||||
Objects.equals(operationIdSnakeCase, that.operationIdSnakeCase) &&
|
||||
Objects.equals(constantParams, that.constantParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -488,6 +491,6 @@ public class CodegenOperation {
|
||||
pathParams, queryParams, headerParams, formParams, cookieParams, requiredParams, returnProperty, optionalParams,
|
||||
authMethods, tags, responses, callbacks, imports, examples, requestBodyExamples, externalDocs,
|
||||
vendorExtensions, nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase,
|
||||
operationIdSnakeCase, hasErrorResponseObject, requiredAndNotNullableParams, notNullableParams);
|
||||
operationIdSnakeCase, hasErrorResponseObject, requiredAndNotNullableParams, notNullableParams, constantParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,9 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
* See http://json-schema.org/latest/json-schema-validation.html#anchor14
|
||||
*/
|
||||
public Number multipleOf;
|
||||
|
||||
public String constant; // for const or enum with a single item
|
||||
|
||||
private Integer maxProperties;
|
||||
private Integer minProperties;
|
||||
public boolean isNull;
|
||||
@@ -164,6 +167,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
output.uniqueItems = this.uniqueItems;
|
||||
output.setUniqueItemsBoolean(this.uniqueItemsBoolean);
|
||||
output.multipleOf = this.multipleOf;
|
||||
output.constant = this.constant;
|
||||
output.jsonSchema = this.jsonSchema;
|
||||
output.defaultValue = this.defaultValue;
|
||||
output.enumDefaultValue = this.enumDefaultValue;
|
||||
@@ -260,7 +264,20 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, containerType, containerTypeMapped, defaultValue, enumDefaultValue, enumName, style, isDeepObject, isMatrix, isAllowEmptyValue, example, examples, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, isEnumRef, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, isVoid, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content, requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties);
|
||||
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam,
|
||||
isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName,
|
||||
dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType,
|
||||
containerType, containerTypeMapped, defaultValue, enumDefaultValue, enumName, style, isDeepObject,
|
||||
isMatrix, isAllowEmptyValue, example, examples, jsonSchema, isString, isNumeric, isInteger, isLong,
|
||||
isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid,
|
||||
isUri, isEmail, isPassword, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, isEnumRef,
|
||||
_enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars,
|
||||
vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated,
|
||||
required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(),
|
||||
getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf,
|
||||
isNull, isVoid, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger,
|
||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, schema, content,
|
||||
requiredVarsMap, ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, constant);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -365,6 +382,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
Objects.equals(getMaxItems(), that.getMaxItems()) &&
|
||||
Objects.equals(getMinItems(), that.getMinItems()) &&
|
||||
Objects.equals(contentType, that.contentType) &&
|
||||
Objects.equals(constant, that.constant) &&
|
||||
Objects.equals(multipleOf, that.multipleOf);
|
||||
}
|
||||
|
||||
@@ -465,6 +483,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
|
||||
sb.append(", uniqueItemsBoolean=").append(uniqueItemsBoolean);
|
||||
sb.append(", contentType=").append(contentType);
|
||||
sb.append(", multipleOf=").append(multipleOf);
|
||||
sb.append(", constant=").append(constant);
|
||||
sb.append(", isNull=").append(isNull);
|
||||
sb.append(", isVoid=").append(isVoid);
|
||||
sb.append(", getAdditionalPropertiesIsAnyType=").append(additionalPropertiesIsAnyType);
|
||||
|
||||
@@ -211,6 +211,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
private LinkedHashMap<String, List<String>> dependentRequired;
|
||||
private CodegenProperty contains;
|
||||
|
||||
// JSON Schema keywords
|
||||
private String constant; // for `const`
|
||||
|
||||
@Override
|
||||
public CodegenProperty getContains() {
|
||||
return contains;
|
||||
@@ -1036,6 +1039,14 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
return isEnum || isEnumRef;
|
||||
}
|
||||
|
||||
public void setConstant(String constant) {
|
||||
this.constant = constant;
|
||||
}
|
||||
|
||||
public String getConstant() {
|
||||
return constant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("CodegenProperty{");
|
||||
@@ -1150,6 +1161,7 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
sb.append(", format=").append(format);
|
||||
sb.append(", dependentRequired=").append(dependentRequired);
|
||||
sb.append(", contains=").append(contains);
|
||||
sb.append(", constant=").append(constant);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -1266,7 +1278,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
Objects.equals(xmlPrefix, that.xmlPrefix) &&
|
||||
Objects.equals(xmlName, that.xmlName) &&
|
||||
Objects.equals(xmlNamespace, that.xmlNamespace) &&
|
||||
Objects.equals(multipleOf, that.multipleOf);
|
||||
Objects.equals(multipleOf, that.multipleOf) &&
|
||||
Objects.equals(constant, that.getConstant());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1288,6 +1301,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
|
||||
xmlNamespace, isXmlWrapped, isNull, isVoid, additionalPropertiesIsAnyType, hasVars, hasRequired,
|
||||
hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes, requiredVarsMap,
|
||||
ref, uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
|
||||
format, dependentRequired, contains);
|
||||
format, dependentRequired, contains, constant);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,6 +449,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
.put("pascalcase", new CamelCaseLambda(false).generator(this))
|
||||
.put("forwardslash", new ForwardSlashLambda())
|
||||
.put("backslash", new BackSlashLambda())
|
||||
.put("doublequote", new DoubleQuoteLambda())
|
||||
.put("indented", new IndentedLambda())
|
||||
.put("indented_8", new IndentedLambda(8, " ", false))
|
||||
.put("indented_12", new IndentedLambda(12, " ", false))
|
||||
@@ -477,6 +478,11 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
for (Map.Entry<String, ModelsMap> entry : objs.entrySet()) {
|
||||
CodegenModel model = ModelUtils.getModelByName(entry.getKey(), objs);
|
||||
|
||||
if (model == null) {
|
||||
LOGGER.warn("Null model found in postProcessAllModels: {}", entry.getKey());
|
||||
continue;
|
||||
}
|
||||
|
||||
// add the model to the discriminator's mapping so templates have access to more than just the string to string mapping
|
||||
if (model.discriminator != null && model.discriminator.getMappedModels() != null) {
|
||||
for (CodegenDiscriminator.MappedModel mappedModel : model.discriminator.getMappedModels()) {
|
||||
@@ -2747,14 +2753,14 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
if (composed.getAnyOf() != null) {
|
||||
if (m.anyOf.contains(languageType)) {
|
||||
LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
|
||||
LOGGER.debug("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
|
||||
} else {
|
||||
m.anyOf.add(languageType);
|
||||
|
||||
}
|
||||
} else if (composed.getOneOf() != null) {
|
||||
if (m.oneOf.contains(languageType)) {
|
||||
LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
|
||||
LOGGER.debug("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType);
|
||||
} else {
|
||||
m.oneOf.add(languageType);
|
||||
}
|
||||
@@ -4587,6 +4593,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
List<CodegenParameter> optionalParams = new ArrayList<>();
|
||||
List<CodegenParameter> requiredAndNotNullableParams = new ArrayList<>();
|
||||
List<CodegenParameter> notNullableParams = new ArrayList<>();
|
||||
List<CodegenParameter> constantParams = new ArrayList<>();
|
||||
|
||||
CodegenParameter bodyParam = null;
|
||||
RequestBody requestBody = operation.getRequestBody();
|
||||
@@ -4650,20 +4657,22 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
allParams.add(p);
|
||||
|
||||
if (param instanceof QueryParameter || "query".equalsIgnoreCase(param.getIn())) {
|
||||
queryParams.add(p.copy());
|
||||
} else if (param instanceof PathParameter || "path".equalsIgnoreCase(param.getIn())) {
|
||||
pathParams.add(p.copy());
|
||||
} else if (param instanceof HeaderParameter || "header".equalsIgnoreCase(param.getIn())) {
|
||||
headerParams.add(p.copy());
|
||||
} else if (param instanceof CookieParameter || "cookie".equalsIgnoreCase(param.getIn())) {
|
||||
cookieParams.add(p.copy());
|
||||
} else {
|
||||
LOGGER.warn("Unknown parameter type {} for {}", p.baseType, p.baseName);
|
||||
if (p.constant != null) { // for constant
|
||||
constantParams.add(p.copy());
|
||||
} else { // a typical parameter
|
||||
allParams.add(p);
|
||||
if (param instanceof QueryParameter || "query".equalsIgnoreCase(param.getIn())) {
|
||||
queryParams.add(p.copy());
|
||||
} else if (param instanceof PathParameter || "path".equalsIgnoreCase(param.getIn())) {
|
||||
pathParams.add(p.copy());
|
||||
} else if (param instanceof HeaderParameter || "header".equalsIgnoreCase(param.getIn())) {
|
||||
headerParams.add(p.copy());
|
||||
} else if (param instanceof CookieParameter || "cookie".equalsIgnoreCase(param.getIn())) {
|
||||
cookieParams.add(p.copy());
|
||||
} else {
|
||||
LOGGER.warn("Unknown parameter type {} for {}", p.baseType, p.baseName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5349,6 +5358,26 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// set default value
|
||||
codegenParameter.defaultValue = toDefaultParameterValue(codegenProperty, parameterSchema);
|
||||
|
||||
// set constant
|
||||
if (codegenParameter.getIsEnumOrRef()) { // enum with only 1 item
|
||||
Schema enumSchema = ModelUtils.getReferencedSchema(openAPI, unaliasSchema(parameterSchema));
|
||||
if (enumSchema.getEnum() != null && enumSchema.getEnum().size() == 1) { // only 1 element
|
||||
codegenParameter.constant = toDefaultParameterValue(codegenProperty, enumSchema);
|
||||
}
|
||||
} else if (parameterSchema.getConst() != null) { // JSON Sschema keyword `const`
|
||||
Schema temp = null;
|
||||
Pattern pattern = Pattern.compile("-?\\d+(\\.\\d+)?");
|
||||
String constantValue = String.valueOf(parameterSchema.getConst());
|
||||
if (pattern.matcher(constantValue).matches()) { // numeric constant value
|
||||
temp = new NumberSchema();
|
||||
temp.setDefault(constantValue);
|
||||
} else { // constant value is a string
|
||||
temp = new StringSchema();
|
||||
temp.setDefault(constantValue);
|
||||
}
|
||||
codegenParameter.constant = toDefaultParameterValue(temp);
|
||||
}
|
||||
|
||||
finishUpdatingParameter(codegenParameter, parameter);
|
||||
return codegenParameter;
|
||||
}
|
||||
@@ -5976,6 +6005,10 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private static Boolean isAliasOfSimpleTypes(Schema schema) {
|
||||
if (schema == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (!ModelUtils.isObjectSchema(schema)
|
||||
&& !ModelUtils.isArraySchema(schema)
|
||||
&& !ModelUtils.isMapSchema(schema)
|
||||
|
||||
@@ -1334,8 +1334,10 @@ public class DefaultGenerator implements Generator {
|
||||
for (Map.Entry<String, Schema> definitionsEntry : definitions.entrySet()) {
|
||||
String key = definitionsEntry.getKey();
|
||||
Schema schema = definitionsEntry.getValue();
|
||||
if (schema == null)
|
||||
throw new RuntimeException("schema cannot be null in processModels");
|
||||
if (schema == null) {
|
||||
LOGGER.warn("Schema {} cannot be null in processModels", key);
|
||||
continue;
|
||||
}
|
||||
CodegenModel cm = config.fromModel(key, schema);
|
||||
ModelMap mo = new ModelMap();
|
||||
mo.setModel(cm);
|
||||
|
||||
@@ -286,6 +286,11 @@ public class InlineModelResolver {
|
||||
if (props != null) {
|
||||
for (String propName : props.keySet()) {
|
||||
Schema prop = props.get(propName);
|
||||
|
||||
if (prop == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String schemaName = resolveModelName(prop.getTitle(), modelPrefix + "_" + propName);
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels(prop, schemaName);
|
||||
@@ -308,13 +313,15 @@ public class InlineModelResolver {
|
||||
if (schema.getAdditionalProperties() != null) {
|
||||
if (schema.getAdditionalProperties() instanceof Schema) {
|
||||
Schema inner = (Schema) schema.getAdditionalProperties();
|
||||
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + this.inlineSchemaOptions.get("MAP_ITEM_SUFFIX"));
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels(inner, schemaName);
|
||||
if (isModelNeeded(inner)) {
|
||||
// If this schema should be split into its own model, do so
|
||||
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
|
||||
schema.setAdditionalProperties(refSchema);
|
||||
if (inner != null) {
|
||||
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + this.inlineSchemaOptions.get("MAP_ITEM_SUFFIX"));
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels(inner, schemaName);
|
||||
if (isModelNeeded(inner)) {
|
||||
// If this schema should be split into its own model, do so
|
||||
Schema refSchema = this.makeSchemaInComponents(schemaName, inner);
|
||||
schema.setAdditionalProperties(refSchema);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,10 +341,6 @@ public class InlineModelResolver {
|
||||
if (schema instanceof ArraySchema) {
|
||||
ArraySchema array = (ArraySchema) schema;
|
||||
Schema items = array.getItems();
|
||||
/*if (items.getTitle() != null) {
|
||||
LOGGER.info("schema title {}", items);
|
||||
throw new RuntimeException("getTitle for array item is not null");
|
||||
}*/
|
||||
if (items == null) {
|
||||
LOGGER.error("Illegal schema found with array type but no items," +
|
||||
" items must be defined for array schemas:\n " + schema.toString());
|
||||
@@ -360,6 +363,9 @@ public class InlineModelResolver {
|
||||
List<Schema> newAllOf = new ArrayList<Schema>();
|
||||
boolean atLeastOneModel = false;
|
||||
for (Object inner : schema.getAllOf()) {
|
||||
if (inner == null) {
|
||||
continue;
|
||||
}
|
||||
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_allOf");
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels((Schema) inner, schemaName);
|
||||
@@ -392,6 +398,9 @@ public class InlineModelResolver {
|
||||
if (schema.getAnyOf() != null) {
|
||||
List<Schema> newAnyOf = new ArrayList<Schema>();
|
||||
for (Object inner : schema.getAnyOf()) {
|
||||
if (inner == null) {
|
||||
continue;
|
||||
}
|
||||
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_anyOf");
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels((Schema) inner, schemaName);
|
||||
@@ -407,6 +416,9 @@ public class InlineModelResolver {
|
||||
if (schema.getOneOf() != null) {
|
||||
List<Schema> newOneOf = new ArrayList<Schema>();
|
||||
for (Object inner : schema.getOneOf()) {
|
||||
if (inner == null) {
|
||||
continue;
|
||||
}
|
||||
String schemaName = resolveModelName(((Schema) inner).getTitle(), modelPrefix + "_oneOf");
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels((Schema) inner, schemaName);
|
||||
@@ -423,12 +435,14 @@ public class InlineModelResolver {
|
||||
// Check not schema
|
||||
if (schema.getNot() != null) {
|
||||
Schema not = schema.getNot();
|
||||
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + "_not");
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels(not, schemaName);
|
||||
if (isModelNeeded(not)) {
|
||||
Schema refSchema = this.makeSchemaInComponents(schemaName, not);
|
||||
schema.setNot(refSchema);
|
||||
if (not != null) {
|
||||
String schemaName = resolveModelName(schema.getTitle(), modelPrefix + "_not");
|
||||
// Recurse to create $refs for inner models
|
||||
gatherInlineModels(not, schemaName);
|
||||
if (isModelNeeded(not)) {
|
||||
Schema refSchema = this.makeSchemaInComponents(schemaName, not);
|
||||
schema.setNot(refSchema);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -629,6 +643,9 @@ public class InlineModelResolver {
|
||||
List<String> modelNames = new ArrayList<String>(models.keySet());
|
||||
for (String modelName : modelNames) {
|
||||
Schema model = models.get(modelName);
|
||||
if (model == null) {
|
||||
continue;
|
||||
}
|
||||
if (ModelUtils.isAnyOf(model)) { // contains anyOf only
|
||||
gatherInlineModels(model, modelName);
|
||||
} else if (ModelUtils.isOneOf(model)) { // contains oneOf only
|
||||
|
||||
@@ -527,7 +527,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
// GrandparentAnimal has a discriminator, but no oneOf nor anyOf
|
||||
// modules\openapi-generator\src\test\resources\3_0\csharp\petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
|
||||
model.setHasDiscriminatorWithNonEmptyMapping(
|
||||
((model.anyOf != null && model.anyOf.size() > 0) || (model.anyOf != null && model.oneOf.size() > 0)) &&
|
||||
((model.anyOf != null && model.anyOf.size() > 0) || (model.oneOf != null && model.oneOf.size() > 0)) &&
|
||||
model.discriminator != null &&
|
||||
model.discriminator.getMappedModels() != null &&
|
||||
model.discriminator.getMappedModels().size() > 0);
|
||||
|
||||
@@ -83,6 +83,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public static final String TEST_OUTPUT = "testOutput";
|
||||
public static final String IMPLICIT_HEADERS = "implicitHeaders";
|
||||
public static final String IMPLICIT_HEADERS_REGEX = "implicitHeadersRegex";
|
||||
public static final String AUTOSET_CONSTANTS = "autosetConstants";
|
||||
public static final String JAVAX_PACKAGE = "javaxPackage";
|
||||
public static final String USE_JAKARTA_EE = "useJakartaEe";
|
||||
public static final String CONTAINER_DEFAULT_TO_NULL = "containerDefaultToNull";
|
||||
@@ -137,6 +138,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
protected AnnotationLibrary annotationLibrary;
|
||||
protected boolean implicitHeaders = false;
|
||||
protected String implicitHeadersRegex = null;
|
||||
protected boolean autosetConstants = false;
|
||||
protected boolean camelCaseDollarSign = false;
|
||||
protected boolean useJakartaEe = false;
|
||||
protected boolean containerDefaultToNull = false;
|
||||
@@ -277,6 +279,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
cliOptions.add(CliOption.newBoolean(OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library", this.openApiNullable));
|
||||
cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Skip header parameters in the generated API methods using @ApiImplicitParams annotation.", implicitHeaders));
|
||||
cliOptions.add(CliOption.newString(IMPLICIT_HEADERS_REGEX, "Skip header parameters that matches given regex in the generated API methods using @ApiImplicitParams annotation. Note: this parameter is ignored when implicitHeaders=true"));
|
||||
cliOptions.add(CliOption.newBoolean(AUTOSET_CONSTANTS, "Automatically set Required Params having a Single enum value i.e. Constants in generated code", autosetConstants));
|
||||
cliOptions.add(CliOption.newBoolean(CAMEL_CASE_DOLLAR_SIGN, "Fix camelCase when starting with $ sign. when true : $Value when false : $value"));
|
||||
cliOptions.add(CliOption.newBoolean(USE_JAKARTA_EE, "whether to use Jakarta EE namespace instead of javax"));
|
||||
cliOptions.add(CliOption.newBoolean(CONTAINER_DEFAULT_TO_NULL, "Set containers (array, set, map) default to null"));
|
||||
@@ -563,6 +566,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.setImplicitHeadersRegex(additionalProperties.get(IMPLICIT_HEADERS_REGEX).toString());
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(AUTOSET_CONSTANTS)) {
|
||||
this.setAutosetConstants(Boolean.parseBoolean(additionalProperties.get(AUTOSET_CONSTANTS).toString()));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CAMEL_CASE_DOLLAR_SIGN)) {
|
||||
this.setCamelCaseDollarSign(Boolean.parseBoolean(additionalProperties.get(CAMEL_CASE_DOLLAR_SIGN).toString()));
|
||||
}
|
||||
@@ -1578,6 +1585,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
op.vendorExtensions.put("x-java-import", operationImports);
|
||||
|
||||
handleImplicitHeaders(op);
|
||||
handleConstantParams(op);
|
||||
}
|
||||
|
||||
return objs;
|
||||
@@ -2052,6 +2060,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.implicitHeadersRegex = implicitHeadersRegex;
|
||||
}
|
||||
|
||||
public void setAutosetConstants(boolean autosetConstants) {
|
||||
this.autosetConstants = autosetConstants;
|
||||
}
|
||||
|
||||
public void setCamelCaseDollarSign(boolean camelCaseDollarSign) {
|
||||
this.camelCaseDollarSign = camelCaseDollarSign;
|
||||
}
|
||||
@@ -2294,6 +2306,45 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
operation.hasParams = !operation.allParams.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method removes all constant Query, Header and Cookie Params from allParams and sets them as constantParams in the CodegenOperation.
|
||||
* The definition of constant is single valued required enum params.
|
||||
* The constantParams in the the generated code should be hardcoded to the constantValue if autosetConstants feature is enabled.
|
||||
*
|
||||
* @param operation - operation to be processed
|
||||
*/
|
||||
protected void handleConstantParams(CodegenOperation operation) {
|
||||
if (!autosetConstants || operation.allParams.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final ArrayList<CodegenParameter> copy = new ArrayList<>(operation.allParams);
|
||||
// Remove all params from Params, Non constant params will be added back later.
|
||||
operation.allParams.clear();
|
||||
|
||||
// Finds all constant params, removes them from allParams and adds them to constant params.
|
||||
// Also, adds back non constant params to allParams.
|
||||
for (CodegenParameter p : copy) {
|
||||
if (p.isEnum && p.required && p._enum != null && p._enum.size() == 1) {
|
||||
// Add to constantParams for use in the code generation templates.
|
||||
operation.constantParams.add(p);
|
||||
if(p.isQueryParam) {
|
||||
operation.queryParams.removeIf(param -> param.baseName.equals(p.baseName));
|
||||
}
|
||||
if(p.isHeaderParam) {
|
||||
operation.headerParams.removeIf(param -> param.baseName.equals(p.baseName));
|
||||
}
|
||||
if(p.isCookieParam) {
|
||||
operation.cookieParams.removeIf(param -> param.baseName.equals(p.baseName));
|
||||
}
|
||||
LOGGER.info("Update operation [{}]. Remove parameter [{}] because it can only have a fixed value of [{}]", operation.operationId, p.baseName, p._enum.get(0));
|
||||
} else {
|
||||
// Add back to allParams as the param is not a constant.
|
||||
operation.allParams.add(p);
|
||||
}
|
||||
}
|
||||
operation.hasParams = !operation.allParams.isEmpty();
|
||||
}
|
||||
|
||||
private boolean shouldBeImplicitHeader(CodegenParameter parameter) {
|
||||
return StringUtils.isNotBlank(implicitHeadersRegex) && parameter.baseName.matches(implicitHeadersRegex);
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
}
|
||||
example += ")";
|
||||
} else {
|
||||
LOGGER.warn("Type {} not handled properly in toExampleValue", schema.getType());
|
||||
LOGGER.debug("Type {} not handled properly in toExampleValue", schema.getType());
|
||||
}
|
||||
|
||||
if (ModelUtils.isStringSchema(schema)) {
|
||||
@@ -591,7 +591,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
// type is a model class, e.g. User
|
||||
example = this.packageName + "." + type + "()";
|
||||
} else {
|
||||
LOGGER.warn("Type {} not handled properly in setParameterExampleValue", type);
|
||||
LOGGER.debug("Type {} not handled properly in setParameterExampleValue", type);
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
@@ -1981,4 +1981,17 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
|
||||
public String toEnumDefaultValue(String value, String datatype) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if the data should be classified as "string" in enum
|
||||
* e.g. double in C# needs to be double-quoted (e.g. "2.8") by treating it as a string
|
||||
* In the future, we may rename this function to "isEnumString"
|
||||
*
|
||||
* @param dataType data type
|
||||
* @return true if it's a enum string
|
||||
*/
|
||||
@Override
|
||||
public boolean isDataTypeString(String dataType) {
|
||||
return "str".equals(dataType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,17 +16,9 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
@@ -69,6 +61,8 @@ import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||
|
||||
public abstract class AbstractPythonConnexionServerCodegen extends AbstractPythonCodegen implements CodegenConfig {
|
||||
private static class PythonBooleanSerializer extends JsonSerializer<Boolean> {
|
||||
@Override
|
||||
@@ -178,7 +172,7 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
cliOptions.add(new CliOption(USE_PYTHON_SRC_ROOT_IN_IMPORTS, "include pythonSrcRoot in import namespaces.").
|
||||
defaultValue("false"));
|
||||
cliOptions.add(new CliOption(MOVE_TESTS_UNDER_PYTHON_SRC_ROOT, "generates test under the pythonSrcRoot folder.")
|
||||
.defaultValue("false"));
|
||||
.defaultValue("false"));
|
||||
}
|
||||
|
||||
protected void addSupportingFiles() {
|
||||
@@ -333,7 +327,6 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toApiTestFilename(String name) {
|
||||
return "test_" + toApiFilename(name);
|
||||
@@ -636,12 +629,6 @@ public abstract class AbstractPythonConnexionServerCodegen extends AbstractPytho
|
||||
postProcessPattern(property.pattern, property.vendorExtensions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelsMap postProcessModels(ModelsMap objs) {
|
||||
// process enum in models
|
||||
return postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs) {
|
||||
Map<String, ModelsMap> result = super.postProcessAllModels(objs);
|
||||
|
||||
@@ -464,20 +464,6 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* checks if the data should be classified as "string" in enum
|
||||
* e.g. double in C# needs to be double-quoted (e.g. "2.8") by treating it as a string
|
||||
* In the future, we may rename this function to "isEnumString"
|
||||
*
|
||||
* @param dataType data type
|
||||
* @return true if it's a enum string
|
||||
*/
|
||||
@Override
|
||||
public boolean isDataTypeString(String dataType) {
|
||||
return "str".equals(dataType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
if (this.reservedWordsMappings().containsKey(name)) {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.templating.mustache;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
/**
|
||||
* Double quote the text if it's not already the case.
|
||||
*
|
||||
* Register:
|
||||
* <pre>
|
||||
* additionalProperties.put("doublequote", new DoubleQuoteLambda());
|
||||
* </pre>
|
||||
*
|
||||
* Use:
|
||||
* <pre>
|
||||
* {{#doublequote}}{{summary}}{{/doublequote}}
|
||||
* </pre>
|
||||
*/
|
||||
public class DoubleQuoteLambda implements Mustache.Lambda {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
String input = fragment.execute();
|
||||
if (input.startsWith("\"") && input.endsWith("\"")) {
|
||||
writer.write(input);
|
||||
} else {
|
||||
writer.write("\"" + input + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
*
|
||||
* Use:
|
||||
* <pre>
|
||||
* {{#fforwardslash}}{{summary}}{{/forwardslash}}
|
||||
* {{#forwardslash}}{{summary}}{{/forwardslash}}
|
||||
* </pre>
|
||||
*/
|
||||
public class ForwardSlashLambda implements Mustache.Lambda {
|
||||
|
||||
@@ -438,6 +438,10 @@ public class ModelUtils {
|
||||
* @return true if the specified schema is an Object schema.
|
||||
*/
|
||||
public static boolean isObjectSchema(Schema schema) {
|
||||
if (schema == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (schema instanceof ObjectSchema) ||
|
||||
// must not be a map
|
||||
(SchemaTypeUtil.OBJECT_TYPE.equals(schema.getType()) && !(schema instanceof MapSchema)) ||
|
||||
@@ -549,6 +553,10 @@ public class ModelUtils {
|
||||
* @return true if the specified schema is a Map schema.
|
||||
*/
|
||||
public static boolean isMapSchema(Schema schema) {
|
||||
if (schema == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// additionalProperties explicitly set to false
|
||||
if (schema.getAdditionalProperties() instanceof Boolean && Boolean.FALSE.equals(schema.getAdditionalProperties())) {
|
||||
return false;
|
||||
@@ -1858,6 +1866,10 @@ public class ModelUtils {
|
||||
* @return true if the schema contains oneOf but no properties/allOf/anyOf defined.
|
||||
*/
|
||||
public static boolean isOneOf(Schema schema) {
|
||||
if (schema == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hasOneOf(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty()) &&
|
||||
(schema.getAllOf() == null || schema.getAllOf().isEmpty()) &&
|
||||
(schema.getAnyOf() == null || schema.getAnyOf().isEmpty())) {
|
||||
@@ -1875,7 +1887,7 @@ public class ModelUtils {
|
||||
* @return true if allOf is not empty
|
||||
*/
|
||||
public static boolean hasOneOf(Schema schema) {
|
||||
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
|
||||
if (schema != null && schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1890,6 +1902,10 @@ public class ModelUtils {
|
||||
* @return true if the schema contains oneOf but no properties/allOf/anyOf defined.
|
||||
*/
|
||||
public static boolean isAnyOf(Schema schema) {
|
||||
if (schema == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hasAnyOf(schema) && (schema.getProperties() == null || schema.getProperties().isEmpty()) &&
|
||||
(schema.getAllOf() == null || schema.getAllOf().isEmpty()) &&
|
||||
(schema.getOneOf() == null || schema.getOneOf().isEmpty())) {
|
||||
@@ -1907,7 +1923,7 @@ public class ModelUtils {
|
||||
* @return true if anyOf is not empty
|
||||
*/
|
||||
public static boolean hasAnyOf(Schema schema) {
|
||||
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
|
||||
if (schema != null && schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,18 +172,39 @@ public class {{classname}} {
|
||||
}
|
||||
|
||||
{{/queryParams}}
|
||||
{{#constantParams}}
|
||||
{{#isQueryParam}}
|
||||
// Set client side default value of Query Param "{{baseName}}".
|
||||
localVarCollectionQueryParams.add(new Pair("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}));
|
||||
|
||||
{{/isQueryParam}}
|
||||
{{/constantParams}}
|
||||
{{#headerParams}}
|
||||
if ({{paramName}} != null) {
|
||||
localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}}));
|
||||
}
|
||||
|
||||
{{/headerParams}}
|
||||
{{#constantParams}}
|
||||
{{#isHeaderParam}}
|
||||
// Set client side default value of Header Param "{{baseName}}".
|
||||
localVarHeaderParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}});
|
||||
|
||||
{{/isHeaderParam}}
|
||||
{{/constantParams}}
|
||||
{{#cookieParams}}
|
||||
if ({{paramName}} != null) {
|
||||
localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}}));
|
||||
}
|
||||
|
||||
{{/cookieParams}}
|
||||
{{#constantParams}}
|
||||
{{#isCookieParam}}
|
||||
// Set client side default value of Cookie Param "{{baseName}}".
|
||||
localVarCookieParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}});
|
||||
|
||||
{{/isCookieParam}}
|
||||
{{/constantParams}}
|
||||
{{/dynamicOperations}}
|
||||
{{#dynamicOperations}}
|
||||
localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams);
|
||||
|
||||
@@ -404,10 +404,14 @@ func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
|
||||
{{#isMap}}
|
||||
var{{{classname}}} := _{{{classname}}}{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil {
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
err = json.Unmarshal(bytes, &var{{{classname}}})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
@@ -423,10 +427,14 @@ func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
|
||||
{{^parent}}
|
||||
var{{{classname}}} := _{{{classname}}}{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &var{{{classname}}}); err == nil {
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
err = json.Unmarshal(bytes, &var{{{classname}}})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = {{{classname}}}(var{{{classname}}})
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{#isCookieParam}}@CookieParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{{.}}}){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{.}}"){{/description}}{{/useSwaggerAnnotations}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isCookieParam}}
|
||||
{{#isCookieParam}}@CookieParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{{.}}}{{/lambda.doublequote}}){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{.}}"){{/description}}{{/useSwaggerAnnotations}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isCookieParam}}
|
||||
@@ -1 +1 @@
|
||||
{{#isHeaderParam}}@HeaderParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{#defaultValue}} @DefaultValue({{{.}}}){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{.}}"){{/description}}{{/useSwaggerAnnotations}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isHeaderParam}}
|
||||
{{#isHeaderParam}}@HeaderParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationHeaderParams}}{{/useBeanValidation}} {{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{{.}}}{{/lambda.doublequote}}){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{.}}"){{/description}}{{/useSwaggerAnnotations}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isHeaderParam}}
|
||||
@@ -1 +1 @@
|
||||
{{#isQueryParam}}@QueryParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{{.}}}){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{.}}"){{/description}}{{/useSwaggerAnnotations}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isQueryParam}}
|
||||
{{#isQueryParam}}@QueryParam("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{^isContainer}}{{#defaultValue}} @DefaultValue({{#lambda.doublequote}}{{{.}}}{{/lambda.doublequote}}){{/defaultValue}}{{/isContainer}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{.}}"){{/description}}{{/useSwaggerAnnotations}} {{paramName}}: {{{dataType}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}{{^required}}?{{/required}}{{/defaultValue}}{{/isNullable}}{{/isQueryParam}}
|
||||
@@ -29,7 +29,7 @@ class {{classname}}(Model):
|
||||
allowed enum values
|
||||
"""
|
||||
{{#enumVars}}
|
||||
{{name}} = {{{value}}}{{^-last}}
|
||||
{{{name}}} = {{{value}}}{{^-last}}
|
||||
{{/-last}}
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
||||
@@ -27,6 +27,7 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8 pytest
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
|
||||
@@ -22,4 +22,10 @@ pytest-3.8:
|
||||
image: python:3.8-alpine
|
||||
pytest-3.9:
|
||||
extends: .pytest
|
||||
image: python:3.9-alpine
|
||||
image: python:3.9-alpine
|
||||
pytest-3.10:
|
||||
extends: .pytest
|
||||
image: python:3.10-alpine
|
||||
pytest-3.11:
|
||||
extends: .pytest
|
||||
image: python:3.11-alpine
|
||||
|
||||
@@ -6,3 +6,6 @@ aenum >= 3.1.11
|
||||
{{#asyncio}}
|
||||
aiohttp >= 3.0.0
|
||||
{{/asyncio}}
|
||||
{{#hasHttpSignatureMethods}}
|
||||
pycryptodome >= 3.9.0
|
||||
{{/hasHttpSignatureMethods}}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
pytest~=7.1.3
|
||||
pytest-cov>=2.8.1
|
||||
pytest-randomly>=3.12.0
|
||||
{{#hasHttpSignatureMethods}}
|
||||
pycryptodome>=3.9.0
|
||||
{{/hasHttpSignatureMethods}}
|
||||
@@ -46,15 +46,6 @@ private var credentialStore = SynchronizedDictionary<Int, URLCredential>()
|
||||
*/
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var taskDidReceiveChallenge: {{projectName}}APIChallengeHandler?
|
||||
|
||||
/**
|
||||
May be assigned if you want to do any of those things:
|
||||
- control the task completion
|
||||
- intercept and handle errors like authorization
|
||||
- retry the request.
|
||||
*/
|
||||
@available(*, unavailable, message: "Please override execute() method to intercept and handle errors like authorization or retry the request. Check the Wiki for more info. https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-do-i-implement-bearer-token-authentication-with-urlsession-on-the-swift-api-client")
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} var taskCompletionShouldRetry: ((Data?, URLResponse?, Error?, @escaping (Bool) -> Void) -> Void)?
|
||||
|
||||
required {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:], requiresAuthentication: Bool) {
|
||||
super.init(method: method, URLString: URLString, parameters: parameters, headers: headers, requiresAuthentication: requiresAuthentication)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,703 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
description: 'This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.'
|
||||
version: 1.0.0
|
||||
title: OpenAPI Petstore
|
||||
license:
|
||||
name: Apache-2.0
|
||||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'
|
||||
host: petstore.swagger.io
|
||||
basePath: /v2
|
||||
tags:
|
||||
- name: pet
|
||||
description: Everything about your Pets
|
||||
- name: store
|
||||
description: Access to Petstore orders
|
||||
- name: user
|
||||
description: Operations about user
|
||||
schemes:
|
||||
- http
|
||||
paths:
|
||||
/pet:
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: ''
|
||||
operationId: addPet
|
||||
consumes:
|
||||
- application/json
|
||||
- application/xml
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/Pet'
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
put:
|
||||
tags:
|
||||
- pet
|
||||
summary: Update an existing pet
|
||||
description: ''
|
||||
operationId: updatePet
|
||||
consumes:
|
||||
- application/json
|
||||
- application/xml
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/Pet'
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
'405':
|
||||
description: Validation exception
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
/pet/findByStatus:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by status
|
||||
description: Multiple status values can be provided with comma separated strings
|
||||
operationId: findPetsByStatus
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: status
|
||||
in: query
|
||||
description: Status values that need to be considered for filter
|
||||
required: true
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
default: available
|
||||
collectionFormat: csv
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/Pet'
|
||||
'400':
|
||||
description: Invalid status value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
/pet/findByTags:
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by tags
|
||||
description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.'
|
||||
operationId: findPetsByTags
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: tags
|
||||
in: query
|
||||
description: Tags to filter by
|
||||
required: true
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
collectionFormat: csv
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/Pet'
|
||||
'400':
|
||||
description: Invalid tag value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
deprecated: true
|
||||
'/pet/{petId}':
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Find pet by ID
|
||||
description: Returns a single pet
|
||||
operationId: getPetById
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to return
|
||||
required: true
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
$ref: '#/definitions/Pet'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Updates a pet in the store with form data
|
||||
description: ''
|
||||
operationId: updatePetWithForm
|
||||
consumes:
|
||||
- application/x-www-form-urlencoded
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet that needs to be updated
|
||||
required: true
|
||||
type: integer
|
||||
format: int64
|
||||
- name: name
|
||||
in: formData
|
||||
description: Updated name of the pet
|
||||
required: false
|
||||
type: string
|
||||
- name: status
|
||||
in: formData
|
||||
description: Updated status of the pet
|
||||
required: false
|
||||
type: string
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
delete:
|
||||
tags:
|
||||
- pet
|
||||
summary: Deletes a pet
|
||||
description: ''
|
||||
operationId: deletePet
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: api_key
|
||||
in: header
|
||||
required: false
|
||||
type: string
|
||||
- name: petId
|
||||
in: path
|
||||
description: Pet id to delete
|
||||
required: true
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid pet value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
'/pet/{petId}/uploadImage':
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: uploads an image
|
||||
description: ''
|
||||
operationId: uploadFile
|
||||
consumes:
|
||||
- multipart/form-data
|
||||
produces:
|
||||
- application/json
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to update
|
||||
required: true
|
||||
type: integer
|
||||
format: int64
|
||||
- name: additionalMetadata
|
||||
in: formData
|
||||
description: Additional data to pass to server
|
||||
required: false
|
||||
type: string
|
||||
- name: file
|
||||
in: formData
|
||||
description: file to upload
|
||||
required: false
|
||||
type: file
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
$ref: '#/definitions/ApiResponse'
|
||||
security:
|
||||
- petstore_auth:
|
||||
- 'write:pets'
|
||||
- 'read:pets'
|
||||
/store/inventory:
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Returns pet inventories by status
|
||||
description: Returns a map of status codes to quantities
|
||||
operationId: getInventory
|
||||
produces:
|
||||
- application/json
|
||||
parameters: []
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: integer
|
||||
format: int32
|
||||
security:
|
||||
- api_key: []
|
||||
/store/order:
|
||||
post:
|
||||
tags:
|
||||
- store
|
||||
summary: Place an order for a pet
|
||||
description: ''
|
||||
operationId: placeOrder
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
description: order placed for purchasing the pet
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/Order'
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
$ref: '#/definitions/Order'
|
||||
'400':
|
||||
description: Invalid Order
|
||||
'/store/order/{orderId}':
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Find purchase order by ID
|
||||
description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions'
|
||||
operationId: getOrderById
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of pet that needs to be fetched
|
||||
required: true
|
||||
type: integer
|
||||
maximum: 5
|
||||
minimum: 1
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
$ref: '#/definitions/Order'
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
delete:
|
||||
tags:
|
||||
- store
|
||||
summary: Delete purchase order by ID
|
||||
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
operationId: deleteOrder
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of the order that needs to be deleted
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
/user:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Create user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: createUser
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
description: Created user object
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/User'
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
/user/createWithArray:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithArrayInput
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
description: List of user object
|
||||
required: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/User'
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
/user/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithListInput
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
description: List of user object
|
||||
required: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/definitions/User'
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
/user/login:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs user into the system
|
||||
description: ''
|
||||
operationId: loginUser
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: username
|
||||
in: query
|
||||
description: The user name for login
|
||||
required: true
|
||||
type: string
|
||||
- name: password
|
||||
in: query
|
||||
description: The password for login in clear text
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
type: string
|
||||
headers:
|
||||
X-Rate-Limit:
|
||||
type: integer
|
||||
format: int32
|
||||
description: calls per hour allowed by the user
|
||||
X-Expires-After:
|
||||
type: string
|
||||
format: date-time
|
||||
description: date in UTC when token expires
|
||||
'400':
|
||||
description: Invalid username/password supplied
|
||||
/user/logout:
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs out current logged in user session
|
||||
description: ''
|
||||
operationId: logoutUser
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters: []
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
'/user/{username}':
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Get user by user name
|
||||
description: ''
|
||||
operationId: getUserByName
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: 'The name that needs to be fetched. Use user1 for testing.'
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
schema:
|
||||
$ref: '#/definitions/User'
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
put:
|
||||
tags:
|
||||
- user
|
||||
summary: Updated user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: updateUser
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: name that need to be deleted
|
||||
required: true
|
||||
type: string
|
||||
- in: body
|
||||
name: body
|
||||
description: Updated user object
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/User'
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid user supplied
|
||||
'404':
|
||||
description: User not found
|
||||
delete:
|
||||
tags:
|
||||
- user
|
||||
summary: Delete user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: deleteUser
|
||||
produces:
|
||||
- application/xml
|
||||
- application/json
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be deleted
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
securityDefinitions:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
|
||||
flow: implicit
|
||||
scopes:
|
||||
'write:pets': modify pets in your account
|
||||
'read:pets': read your pets
|
||||
api_key:
|
||||
type: apiKey
|
||||
name: api_key
|
||||
in: header
|
||||
definitions:
|
||||
Order:
|
||||
title: Pet Order
|
||||
description: An order for a pets from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
petId:
|
||||
type: integer
|
||||
format: int64
|
||||
quantity:
|
||||
type: integer
|
||||
format: int32
|
||||
shipDate:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
complete:
|
||||
type: boolean
|
||||
default: false
|
||||
xml:
|
||||
name: Order
|
||||
Category:
|
||||
title: Pet category
|
||||
description: A category for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Category
|
||||
User:
|
||||
title: a User
|
||||
description: A User who is purchasing from the pet store
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
username:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
lastName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
userStatus:
|
||||
type: integer
|
||||
format: int32
|
||||
description: User Status
|
||||
xml:
|
||||
name: User
|
||||
Tag:
|
||||
title: Pet Tag
|
||||
description: A tag for a pet
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Tag
|
||||
Pet:
|
||||
title: a Pet
|
||||
description: A pet for sale in the pet store
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
category:
|
||||
$ref: '#/definitions/Category'
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: '#/definitions/Tag'
|
||||
status:
|
||||
type: string
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
xml:
|
||||
name: Pet
|
||||
ApiResponse:
|
||||
title: An uploaded response
|
||||
description: Describes the result of uploading an image resource
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
EnumModel:
|
||||
enum:
|
||||
- available>
|
||||
- pending<
|
||||
- sold
|
||||
- 1
|
||||
- 2
|
||||
type: string
|
||||
@@ -0,0 +1,42 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: Example Hello API
|
||||
description: ''
|
||||
version: v1
|
||||
servers:
|
||||
- url: http://localhost
|
||||
description: Global Endpoint
|
||||
paths:
|
||||
/v1/hello/{name}:
|
||||
get:
|
||||
tags:
|
||||
- hello_example
|
||||
operationId: Hello
|
||||
description: Say Hello
|
||||
parameters:
|
||||
- name: X-CUSTOM_CONSTANT_HEADER
|
||||
in: header
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- CONSTANT_VALUE
|
||||
- name: name
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: Successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/HelloResponse'
|
||||
components:
|
||||
schemas:
|
||||
HelloResponse:
|
||||
type: object
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
@@ -24,12 +24,46 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
default: available
|
||||
- name: query_default_enum
|
||||
in: query
|
||||
description: query default enum
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- A
|
||||
- B
|
||||
- C
|
||||
default: B
|
||||
- name: query_default_int
|
||||
in: query
|
||||
description: query default int
|
||||
schema:
|
||||
type: number
|
||||
format: int32
|
||||
default: 3
|
||||
- name: header_default
|
||||
in: header
|
||||
description: header default
|
||||
schema:
|
||||
type: string
|
||||
default: available
|
||||
- name: header_default_enum
|
||||
in: header
|
||||
description: header default enum
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- A
|
||||
- B
|
||||
- C
|
||||
default: B
|
||||
- name: header_default_int
|
||||
in: header
|
||||
description: header default int
|
||||
schema:
|
||||
type: number
|
||||
format: int32
|
||||
default: 3
|
||||
- name: path_default
|
||||
in: path
|
||||
description: path default
|
||||
@@ -42,6 +76,23 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
default: available
|
||||
- name: cookie_default_enum
|
||||
in: cookie
|
||||
description: cookie default enum
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- A
|
||||
- B
|
||||
- C
|
||||
default: B
|
||||
- name: cookie_default_int
|
||||
in: cookie
|
||||
description: cookie default int
|
||||
schema:
|
||||
type: number
|
||||
format: int32
|
||||
default: 3
|
||||
- name: query_nullable
|
||||
in: query
|
||||
description: query nullable
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
24
samples/client/echo_api/go/.gitignore
vendored
Normal file
24
samples/client/echo_api/go/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
23
samples/client/echo_api/go/.openapi-generator-ignore
Normal file
23
samples/client/echo_api/go/.openapi-generator-ignore
Normal file
@@ -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
|
||||
45
samples/client/echo_api/go/.openapi-generator/FILES
Normal file
45
samples/client/echo_api/go/.openapi-generator/FILES
Normal file
@@ -0,0 +1,45 @@
|
||||
.gitignore
|
||||
.travis.yml
|
||||
README.md
|
||||
api/openapi.yaml
|
||||
api_auth.go
|
||||
api_body.go
|
||||
api_form.go
|
||||
api_header.go
|
||||
api_path.go
|
||||
api_query.go
|
||||
client.go
|
||||
configuration.go
|
||||
docs/AuthAPI.md
|
||||
docs/Bird.md
|
||||
docs/BodyAPI.md
|
||||
docs/Category.md
|
||||
docs/DataQuery.md
|
||||
docs/DefaultValue.md
|
||||
docs/FormAPI.md
|
||||
docs/HeaderAPI.md
|
||||
docs/NumberPropertiesOnly.md
|
||||
docs/PathAPI.md
|
||||
docs/Pet.md
|
||||
docs/Query.md
|
||||
docs/QueryAPI.md
|
||||
docs/StringEnumRef.md
|
||||
docs/Tag.md
|
||||
docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md
|
||||
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
|
||||
git_push.sh
|
||||
go.mod
|
||||
go.sum
|
||||
model_bird.go
|
||||
model_category.go
|
||||
model_data_query.go
|
||||
model_default_value.go
|
||||
model_number_properties_only.go
|
||||
model_pet.go
|
||||
model_query.go
|
||||
model_string_enum_ref.go
|
||||
model_tag.go
|
||||
model_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.go
|
||||
model_test_query_style_form_explode_true_array_string_query_object_parameter.go
|
||||
response.go
|
||||
utils.go
|
||||
1
samples/client/echo_api/go/.openapi-generator/VERSION
Normal file
1
samples/client/echo_api/go/.openapi-generator/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
7.0.1-SNAPSHOT
|
||||
8
samples/client/echo_api/go/.travis.yml
Normal file
8
samples/client/echo_api/go/.travis.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
language: go
|
||||
|
||||
install:
|
||||
- go get -d -v .
|
||||
|
||||
script:
|
||||
- go build -v ./
|
||||
|
||||
155
samples/client/echo_api/go/README.md
Normal file
155
samples/client/echo_api/go/README.md
Normal file
@@ -0,0 +1,155 @@
|
||||
# Go API client for openapi
|
||||
|
||||
Echo Server API
|
||||
|
||||
## Overview
|
||||
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
|
||||
|
||||
- API version: 0.1.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: org.openapitools.codegen.languages.GoClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
Install the following dependencies:
|
||||
|
||||
```shell
|
||||
go get github.com/stretchr/testify/assert
|
||||
go get golang.org/x/net/context
|
||||
```
|
||||
|
||||
Put the package under your project folder and add the following in import:
|
||||
|
||||
```golang
|
||||
import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
```
|
||||
|
||||
To use a proxy, set the environment variable `HTTP_PROXY`:
|
||||
|
||||
```golang
|
||||
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
|
||||
```
|
||||
|
||||
## Configuration of Server URL
|
||||
|
||||
Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.
|
||||
|
||||
### Select Server Configuration
|
||||
|
||||
For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`.
|
||||
|
||||
```golang
|
||||
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
|
||||
```
|
||||
|
||||
### Templated Server URL
|
||||
|
||||
Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`.
|
||||
|
||||
```golang
|
||||
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
|
||||
"basePath": "v2",
|
||||
})
|
||||
```
|
||||
|
||||
Note, enum values are always validated and all unused variables are silently ignored.
|
||||
|
||||
### URLs Configuration per Operation
|
||||
|
||||
Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
|
||||
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
|
||||
Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps.
|
||||
|
||||
```golang
|
||||
ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
|
||||
"{classname}Service.{nickname}": 2,
|
||||
})
|
||||
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
|
||||
"{classname}Service.{nickname}": {
|
||||
"port": "8443",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*AuthAPI* | [**TestAuthHttpBasic**](docs/AuthAPI.md#testauthhttpbasic) | **Post** /auth/http/basic | To test HTTP basic authentication
|
||||
*BodyAPI* | [**TestBinaryGif**](docs/BodyAPI.md#testbinarygif) | **Post** /binary/gif | Test binary (gif) response body
|
||||
*BodyAPI* | [**TestBodyApplicationOctetstreamBinary**](docs/BodyAPI.md#testbodyapplicationoctetstreambinary) | **Post** /body/application/octetstream/binary | Test body parameter(s)
|
||||
*BodyAPI* | [**TestBodyMultipartFormdataArrayOfBinary**](docs/BodyAPI.md#testbodymultipartformdataarrayofbinary) | **Post** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
|
||||
*BodyAPI* | [**TestEchoBodyFreeFormObjectResponseString**](docs/BodyAPI.md#testechobodyfreeformobjectresponsestring) | **Post** /echo/body/FreeFormObject/response_string | Test free form object
|
||||
*BodyAPI* | [**TestEchoBodyPet**](docs/BodyAPI.md#testechobodypet) | **Post** /echo/body/Pet | Test body parameter(s)
|
||||
*BodyAPI* | [**TestEchoBodyPetResponseString**](docs/BodyAPI.md#testechobodypetresponsestring) | **Post** /echo/body/Pet/response_string | Test empty response body
|
||||
*BodyAPI* | [**TestEchoBodyTagResponseString**](docs/BodyAPI.md#testechobodytagresponsestring) | **Post** /echo/body/Tag/response_string | Test empty json (request body)
|
||||
*FormAPI* | [**TestFormIntegerBooleanString**](docs/FormAPI.md#testformintegerbooleanstring) | **Post** /form/integer/boolean/string | Test form parameter(s)
|
||||
*FormAPI* | [**TestFormOneof**](docs/FormAPI.md#testformoneof) | **Post** /form/oneof | Test form parameter(s) for oneOf schema
|
||||
*HeaderAPI* | [**TestHeaderIntegerBooleanString**](docs/HeaderAPI.md#testheaderintegerbooleanstring) | **Get** /header/integer/boolean/string | Test header parameter(s)
|
||||
*PathAPI* | [**TestsPathStringPathStringIntegerPathInteger**](docs/PathAPI.md#testspathstringpathstringintegerpathinteger) | **Get** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||
*QueryAPI* | [**TestEnumRefString**](docs/QueryAPI.md#testenumrefstring) | **Get** /query/enum_ref_string | Test query parameter(s)
|
||||
*QueryAPI* | [**TestQueryDatetimeDateString**](docs/QueryAPI.md#testquerydatetimedatestring) | **Get** /query/datetime/date/string | Test query parameter(s)
|
||||
*QueryAPI* | [**TestQueryIntegerBooleanString**](docs/QueryAPI.md#testqueryintegerbooleanstring) | **Get** /query/integer/boolean/string | Test query parameter(s)
|
||||
*QueryAPI* | [**TestQueryStyleDeepObjectExplodeTrueObject**](docs/QueryAPI.md#testquerystyledeepobjectexplodetrueobject) | **Get** /query/style_deepObject/explode_true/object | Test query parameter(s)
|
||||
*QueryAPI* | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryAPI.md#testquerystyledeepobjectexplodetrueobjectallof) | **Get** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
|
||||
*QueryAPI* | [**TestQueryStyleFormExplodeTrueArrayString**](docs/QueryAPI.md#testquerystyleformexplodetruearraystring) | **Get** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
*QueryAPI* | [**TestQueryStyleFormExplodeTrueObject**](docs/QueryAPI.md#testquerystyleformexplodetrueobject) | **Get** /query/style_form/explode_true/object | Test query parameter(s)
|
||||
*QueryAPI* | [**TestQueryStyleFormExplodeTrueObjectAllOf**](docs/QueryAPI.md#testquerystyleformexplodetrueobjectallof) | **Get** /query/style_form/explode_true/object/allOf | Test query parameter(s)
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [Bird](docs/Bird.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [DataQuery](docs/DataQuery.md)
|
||||
- [DefaultValue](docs/DefaultValue.md)
|
||||
- [NumberPropertiesOnly](docs/NumberPropertiesOnly.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [Query](docs/Query.md)
|
||||
- [StringEnumRef](docs/StringEnumRef.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md)
|
||||
- [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
### http_auth
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
Example
|
||||
|
||||
```golang
|
||||
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
|
||||
UserName: "username",
|
||||
Password: "password",
|
||||
})
|
||||
r, err := client.Service.Operation(auth, args)
|
||||
```
|
||||
|
||||
|
||||
## Documentation for Utility Methods
|
||||
|
||||
Due to the fact that model structure members are all pointers, this package contains
|
||||
a number of utility functions to easily obtain pointers to values of basic types.
|
||||
Each of these functions takes a value of the given basic type and returns a pointer to it:
|
||||
|
||||
* `PtrBool`
|
||||
* `PtrInt`
|
||||
* `PtrInt32`
|
||||
* `PtrInt64`
|
||||
* `PtrFloat`
|
||||
* `PtrFloat32`
|
||||
* `PtrFloat64`
|
||||
* `PtrString`
|
||||
* `PtrTime`
|
||||
|
||||
## Author
|
||||
|
||||
team@openapitools.org
|
||||
|
||||
724
samples/client/echo_api/go/api/openapi.yaml
Normal file
724
samples/client/echo_api/go/api/openapi.yaml
Normal file
@@ -0,0 +1,724 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
contact:
|
||||
email: team@openapitools.org
|
||||
description: Echo Server API
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
title: Echo Server API
|
||||
version: 0.1.0
|
||||
servers:
|
||||
- url: http://localhost:3000/
|
||||
paths:
|
||||
/path/string/{path_string}/integer/{path_integer}:
|
||||
get:
|
||||
description: Test path parameter(s)
|
||||
operationId: "tests/path/string/{path_string}/integer/{path_integer}"
|
||||
parameters:
|
||||
- explode: false
|
||||
in: path
|
||||
name: path_string
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
style: simple
|
||||
- explode: false
|
||||
in: path
|
||||
name: path_integer
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
style: simple
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test path parameter(s)
|
||||
tags:
|
||||
- path
|
||||
/form/integer/boolean/string:
|
||||
post:
|
||||
description: Test form parameter(s)
|
||||
operationId: test/form/integer/boolean/string
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_form_integer_boolean_string_request'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test form parameter(s)
|
||||
tags:
|
||||
- form
|
||||
/form/oneof:
|
||||
post:
|
||||
description: Test form parameter(s) for oneOf schema
|
||||
operationId: test/form/oneof
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_form_oneof_request'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test form parameter(s) for oneOf schema
|
||||
tags:
|
||||
- form
|
||||
/header/integer/boolean/string:
|
||||
get:
|
||||
description: Test header parameter(s)
|
||||
operationId: test/header/integer/boolean/string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: header
|
||||
name: integer_header
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
style: form
|
||||
- explode: true
|
||||
in: header
|
||||
name: boolean_header
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
style: form
|
||||
- explode: true
|
||||
in: header
|
||||
name: string_header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test header parameter(s)
|
||||
tags:
|
||||
- header
|
||||
/query/enum_ref_string:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/enum_ref_string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: enum_ref_string_query
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/StringEnumRef'
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/query/datetime/date/string:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/datetime/date/string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: datetime_query
|
||||
required: false
|
||||
schema:
|
||||
format: date-time
|
||||
type: string
|
||||
style: form
|
||||
- explode: true
|
||||
in: query
|
||||
name: date_query
|
||||
required: false
|
||||
schema:
|
||||
format: date
|
||||
type: string
|
||||
style: form
|
||||
- explode: true
|
||||
in: query
|
||||
name: string_query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/query/integer/boolean/string:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/integer/boolean/string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: integer_query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
style: form
|
||||
- explode: true
|
||||
in: query
|
||||
name: boolean_query
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
style: form
|
||||
- explode: true
|
||||
in: query
|
||||
name: string_query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/query/style_form/explode_true/array_string:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/style_form/explode_true/array_string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: query_object
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_query_style_form_explode_true_array_string_query_object_parameter'
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/query/style_form/explode_true/object:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/style_form/explode_true/object
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: query_object
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/query/style_form/explode_true/object/allOf:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/style_form/explode_true/object/allOf
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: query_object
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/DataQuery'
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/query/style_deepObject/explode_true/object:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/style_deepObject/explode_true/object
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: query_object
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
style: deepObject
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/query/style_deepObject/explode_true/object/allOf:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
operationId: test/query/style_deepObject/explode_true/object/allOf
|
||||
parameters:
|
||||
- explode: true
|
||||
in: query
|
||||
name: query_object
|
||||
required: false
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_query_style_deepObject_explode_true_object_allOf_query_object_parameter'
|
||||
style: deepObject
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test query parameter(s)
|
||||
tags:
|
||||
- query
|
||||
/body/application/octetstream/binary:
|
||||
post:
|
||||
description: Test body parameter(s)
|
||||
operationId: test/body/application/octetstream/binary
|
||||
requestBody:
|
||||
content:
|
||||
application/octet-stream:
|
||||
schema:
|
||||
format: binary
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test body parameter(s)
|
||||
tags:
|
||||
- body
|
||||
/echo/body/Pet:
|
||||
post:
|
||||
description: Test body parameter(s)
|
||||
operationId: test/echo/body/Pet
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Successful operation
|
||||
summary: Test body parameter(s)
|
||||
tags:
|
||||
- body
|
||||
/echo/body/Pet/response_string:
|
||||
post:
|
||||
description: Test empty response body
|
||||
operationId: test/echo/body/Pet/response_string
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test empty response body
|
||||
tags:
|
||||
- body
|
||||
/echo/body/Tag/response_string:
|
||||
post:
|
||||
description: Test empty json (request body)
|
||||
operationId: test/echo/body/Tag/response_string
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Tag'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test empty json (request body)
|
||||
tags:
|
||||
- body
|
||||
/echo/body/FreeFormObject/response_string:
|
||||
post:
|
||||
description: Test free form object
|
||||
operationId: test/echo/body/FreeFormObject/response_string
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
description: Free form object
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test free form object
|
||||
tags:
|
||||
- body
|
||||
/binary/gif:
|
||||
post:
|
||||
description: Test binary (gif) response body
|
||||
operationId: test/binary/gif
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
image/gif:
|
||||
schema:
|
||||
format: binary
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test binary (gif) response body
|
||||
tags:
|
||||
- body
|
||||
/body/application/octetstream/array_of_binary:
|
||||
post:
|
||||
description: Test array of binary in multipart mime
|
||||
operationId: test/body/multipart/formdata/array_of_binary
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_body_multipart_formdata_array_of_binary_request'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test array of binary in multipart mime
|
||||
tags:
|
||||
- body
|
||||
/auth/http/basic:
|
||||
post:
|
||||
description: To test HTTP basic authentication
|
||||
operationId: test/auth/http/basic
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
security:
|
||||
- http_auth: []
|
||||
summary: To test HTTP basic authentication
|
||||
tags:
|
||||
- auth
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
description: Pet object that needs to be added to the store
|
||||
Tag:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Tag'
|
||||
description: Tag object
|
||||
schemas:
|
||||
Category:
|
||||
example:
|
||||
name: Dogs
|
||||
id: 1
|
||||
properties:
|
||||
id:
|
||||
example: 1
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
example: Dogs
|
||||
type: string
|
||||
type: object
|
||||
xml:
|
||||
name: category
|
||||
Tag:
|
||||
example:
|
||||
name: name
|
||||
id: 0
|
||||
properties:
|
||||
id:
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
xml:
|
||||
name: tag
|
||||
Pet:
|
||||
example:
|
||||
photoUrls:
|
||||
- photoUrls
|
||||
- photoUrls
|
||||
name: doggie
|
||||
id: 10
|
||||
category:
|
||||
name: Dogs
|
||||
id: 1
|
||||
tags:
|
||||
- name: name
|
||||
id: 0
|
||||
- name: name
|
||||
id: 0
|
||||
status: available
|
||||
properties:
|
||||
id:
|
||||
example: 10
|
||||
format: int64
|
||||
type: integer
|
||||
name:
|
||||
example: doggie
|
||||
type: string
|
||||
category:
|
||||
$ref: '#/components/schemas/Category'
|
||||
photoUrls:
|
||||
items:
|
||||
type: string
|
||||
xml:
|
||||
name: photoUrl
|
||||
type: array
|
||||
xml:
|
||||
wrapped: true
|
||||
tags:
|
||||
items:
|
||||
$ref: '#/components/schemas/Tag'
|
||||
type: array
|
||||
xml:
|
||||
wrapped: true
|
||||
status:
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
type: object
|
||||
xml:
|
||||
name: pet
|
||||
StringEnumRef:
|
||||
enum:
|
||||
- success
|
||||
- failure
|
||||
- unclassified
|
||||
type: string
|
||||
DefaultValue:
|
||||
description: to test the default value of properties
|
||||
properties:
|
||||
array_string_enum_ref_default:
|
||||
default:
|
||||
- success
|
||||
- failure
|
||||
items:
|
||||
$ref: '#/components/schemas/StringEnumRef'
|
||||
type: array
|
||||
array_string_enum_default:
|
||||
default:
|
||||
- success
|
||||
- failure
|
||||
items:
|
||||
enum:
|
||||
- success
|
||||
- failure
|
||||
- unclassified
|
||||
type: string
|
||||
type: array
|
||||
array_string_default:
|
||||
default:
|
||||
- failure
|
||||
- skipped
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
array_integer_default:
|
||||
default:
|
||||
- 1
|
||||
- 3
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
array_string:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
array_string_nullable:
|
||||
items:
|
||||
type: string
|
||||
nullable: true
|
||||
type: array
|
||||
array_string_extension_nullable:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
x-nullable: true
|
||||
string_nullable:
|
||||
nullable: true
|
||||
type: string
|
||||
type: object
|
||||
Bird:
|
||||
properties:
|
||||
size:
|
||||
type: string
|
||||
color:
|
||||
type: string
|
||||
type: object
|
||||
Query:
|
||||
properties:
|
||||
id:
|
||||
description: Query
|
||||
format: int64
|
||||
type: integer
|
||||
outcomes:
|
||||
default:
|
||||
- SUCCESS
|
||||
- FAILURE
|
||||
items:
|
||||
enum:
|
||||
- SUCCESS
|
||||
- FAILURE
|
||||
- SKIPPED
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
x-parent: true
|
||||
DataQuery:
|
||||
allOf:
|
||||
- properties:
|
||||
suffix:
|
||||
description: test suffix
|
||||
type: string
|
||||
text:
|
||||
description: Some text containing white spaces
|
||||
example: Some text
|
||||
type: string
|
||||
date:
|
||||
description: A date
|
||||
format: date-time
|
||||
type: string
|
||||
type: object
|
||||
- $ref: '#/components/schemas/Query'
|
||||
NumberPropertiesOnly:
|
||||
properties:
|
||||
number:
|
||||
type: number
|
||||
float:
|
||||
format: float
|
||||
type: number
|
||||
double:
|
||||
format: double
|
||||
maximum: 50.2
|
||||
minimum: 0.8
|
||||
type: number
|
||||
type: object
|
||||
test_form_integer_boolean_string_request:
|
||||
properties:
|
||||
integer_form:
|
||||
type: integer
|
||||
boolean_form:
|
||||
type: boolean
|
||||
string_form:
|
||||
type: string
|
||||
type: object
|
||||
test_form_oneof_request_oneOf:
|
||||
properties:
|
||||
form1:
|
||||
type: string
|
||||
form2:
|
||||
type: integer
|
||||
type: object
|
||||
test_form_oneof_request_oneOf_1:
|
||||
properties:
|
||||
form3:
|
||||
type: string
|
||||
form4:
|
||||
type: boolean
|
||||
type: object
|
||||
test_form_oneof_request:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/test_form_oneof_request_oneOf'
|
||||
- $ref: '#/components/schemas/test_form_oneof_request_oneOf_1'
|
||||
- $ref: '#/components/schemas/Tag'
|
||||
type: object
|
||||
test_query_style_form_explode_true_array_string_query_object_parameter:
|
||||
properties:
|
||||
values:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
test_query_style_deepObject_explode_true_object_allOf_query_object_parameter:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/Bird'
|
||||
- $ref: '#/components/schemas/Category'
|
||||
test_body_multipart_formdata_array_of_binary_request:
|
||||
properties:
|
||||
files:
|
||||
items:
|
||||
format: binary
|
||||
type: string
|
||||
type: array
|
||||
required:
|
||||
- files
|
||||
type: object
|
||||
securitySchemes:
|
||||
http_auth:
|
||||
scheme: basic
|
||||
type: http
|
||||
123
samples/client/echo_api/go/api_auth.go
Normal file
123
samples/client/echo_api/go/api_auth.go
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
|
||||
// AuthAPIService AuthAPI service
|
||||
type AuthAPIService service
|
||||
|
||||
type ApiTestAuthHttpBasicRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *AuthAPIService
|
||||
}
|
||||
|
||||
func (r ApiTestAuthHttpBasicRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestAuthHttpBasicExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestAuthHttpBasic To test HTTP basic authentication
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestAuthHttpBasicRequest
|
||||
*/
|
||||
func (a *AuthAPIService) TestAuthHttpBasic(ctx context.Context) ApiTestAuthHttpBasicRequest {
|
||||
return ApiTestAuthHttpBasicRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *AuthAPIService) TestAuthHttpBasicExecute(r ApiTestAuthHttpBasicRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthAPIService.TestAuthHttpBasic")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/auth/http/basic"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
788
samples/client/echo_api/go/api_body.go
Normal file
788
samples/client/echo_api/go/api_body.go
Normal file
@@ -0,0 +1,788 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
)
|
||||
|
||||
|
||||
// BodyAPIService BodyAPI service
|
||||
type BodyAPIService service
|
||||
|
||||
type ApiTestBinaryGifRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *BodyAPIService
|
||||
}
|
||||
|
||||
func (r ApiTestBinaryGifRequest) Execute() (*os.File, *http.Response, error) {
|
||||
return r.ApiService.TestBinaryGifExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestBinaryGif Test binary (gif) response body
|
||||
|
||||
Test binary (gif) response body
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestBinaryGifRequest
|
||||
*/
|
||||
func (a *BodyAPIService) TestBinaryGif(ctx context.Context) ApiTestBinaryGifRequest {
|
||||
return ApiTestBinaryGifRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return *os.File
|
||||
func (a *BodyAPIService) TestBinaryGifExecute(r ApiTestBinaryGifRequest) (*os.File, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *os.File
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBinaryGif")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/binary/gif"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// 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{"image/gif"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestBodyApplicationOctetstreamBinaryRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *BodyAPIService
|
||||
body *os.File
|
||||
}
|
||||
|
||||
func (r ApiTestBodyApplicationOctetstreamBinaryRequest) Body(body *os.File) ApiTestBodyApplicationOctetstreamBinaryRequest {
|
||||
r.body = body
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestBodyApplicationOctetstreamBinaryRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestBodyApplicationOctetstreamBinaryExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestBodyApplicationOctetstreamBinary Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestBodyApplicationOctetstreamBinaryRequest
|
||||
*/
|
||||
func (a *BodyAPIService) TestBodyApplicationOctetstreamBinary(ctx context.Context) ApiTestBodyApplicationOctetstreamBinaryRequest {
|
||||
return ApiTestBodyApplicationOctetstreamBinaryRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *BodyAPIService) TestBodyApplicationOctetstreamBinaryExecute(r ApiTestBodyApplicationOctetstreamBinaryRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBodyApplicationOctetstreamBinary")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/body/application/octetstream/binary"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/octet-stream"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.body
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestBodyMultipartFormdataArrayOfBinaryRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *BodyAPIService
|
||||
files []*os.File
|
||||
}
|
||||
|
||||
func (r ApiTestBodyMultipartFormdataArrayOfBinaryRequest) Files(files []*os.File) ApiTestBodyMultipartFormdataArrayOfBinaryRequest {
|
||||
r.files = files
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestBodyMultipartFormdataArrayOfBinaryRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestBodyMultipartFormdataArrayOfBinaryExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestBodyMultipartFormdataArrayOfBinary Test array of binary in multipart mime
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestBodyMultipartFormdataArrayOfBinaryRequest
|
||||
*/
|
||||
func (a *BodyAPIService) TestBodyMultipartFormdataArrayOfBinary(ctx context.Context) ApiTestBodyMultipartFormdataArrayOfBinaryRequest {
|
||||
return ApiTestBodyMultipartFormdataArrayOfBinaryRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *BodyAPIService) TestBodyMultipartFormdataArrayOfBinaryExecute(r ApiTestBodyMultipartFormdataArrayOfBinaryRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestBodyMultipartFormdataArrayOfBinary")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/body/application/octetstream/array_of_binary"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
if r.files == nil {
|
||||
return localVarReturnValue, nil, reportError("files is required and must be specified")
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"multipart/form-data"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
var filesLocalVarFormFileName string
|
||||
var filesLocalVarFileName string
|
||||
var filesLocalVarFileBytes []byte
|
||||
|
||||
filesLocalVarFormFileName = "files"
|
||||
|
||||
|
||||
filesLocalVarFile := r.files
|
||||
|
||||
if filesLocalVarFile != nil {
|
||||
fbs, _ := io.ReadAll(filesLocalVarFile)
|
||||
|
||||
filesLocalVarFileBytes = fbs
|
||||
filesLocalVarFileName = filesLocalVarFile.Name()
|
||||
filesLocalVarFile.Close()
|
||||
formFiles = append(formFiles, formFile{fileBytes: filesLocalVarFileBytes, fileName: filesLocalVarFileName, formFileName: filesLocalVarFormFileName})
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestEchoBodyFreeFormObjectResponseStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *BodyAPIService
|
||||
body *map[string]interface{}
|
||||
}
|
||||
|
||||
// Free form object
|
||||
func (r ApiTestEchoBodyFreeFormObjectResponseStringRequest) Body(body map[string]interface{}) ApiTestEchoBodyFreeFormObjectResponseStringRequest {
|
||||
r.body = &body
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestEchoBodyFreeFormObjectResponseStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestEchoBodyFreeFormObjectResponseStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestEchoBodyFreeFormObjectResponseString Test free form object
|
||||
|
||||
Test free form object
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestEchoBodyFreeFormObjectResponseStringRequest
|
||||
*/
|
||||
func (a *BodyAPIService) TestEchoBodyFreeFormObjectResponseString(ctx context.Context) ApiTestEchoBodyFreeFormObjectResponseStringRequest {
|
||||
return ApiTestEchoBodyFreeFormObjectResponseStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *BodyAPIService) TestEchoBodyFreeFormObjectResponseStringExecute(r ApiTestEchoBodyFreeFormObjectResponseStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyFreeFormObjectResponseString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/echo/body/FreeFormObject/response_string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.body
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestEchoBodyPetRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *BodyAPIService
|
||||
pet *Pet
|
||||
}
|
||||
|
||||
// Pet object that needs to be added to the store
|
||||
func (r ApiTestEchoBodyPetRequest) Pet(pet Pet) ApiTestEchoBodyPetRequest {
|
||||
r.pet = &pet
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestEchoBodyPetRequest) Execute() (*Pet, *http.Response, error) {
|
||||
return r.ApiService.TestEchoBodyPetExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestEchoBodyPet Test body parameter(s)
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestEchoBodyPetRequest
|
||||
*/
|
||||
func (a *BodyAPIService) TestEchoBodyPet(ctx context.Context) ApiTestEchoBodyPetRequest {
|
||||
return ApiTestEchoBodyPetRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return Pet
|
||||
func (a *BodyAPIService) TestEchoBodyPetExecute(r ApiTestEchoBodyPetRequest) (*Pet, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue *Pet
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyPet")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/echo/body/Pet"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
// 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
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.pet
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestEchoBodyPetResponseStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *BodyAPIService
|
||||
pet *Pet
|
||||
}
|
||||
|
||||
// Pet object that needs to be added to the store
|
||||
func (r ApiTestEchoBodyPetResponseStringRequest) Pet(pet Pet) ApiTestEchoBodyPetResponseStringRequest {
|
||||
r.pet = &pet
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestEchoBodyPetResponseStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestEchoBodyPetResponseStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestEchoBodyPetResponseString Test empty response body
|
||||
|
||||
Test empty response body
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestEchoBodyPetResponseStringRequest
|
||||
*/
|
||||
func (a *BodyAPIService) TestEchoBodyPetResponseString(ctx context.Context) ApiTestEchoBodyPetResponseStringRequest {
|
||||
return ApiTestEchoBodyPetResponseStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *BodyAPIService) TestEchoBodyPetResponseStringExecute(r ApiTestEchoBodyPetResponseStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyPetResponseString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/echo/body/Pet/response_string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.pet
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestEchoBodyTagResponseStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *BodyAPIService
|
||||
tag *Tag
|
||||
}
|
||||
|
||||
// Tag object
|
||||
func (r ApiTestEchoBodyTagResponseStringRequest) Tag(tag Tag) ApiTestEchoBodyTagResponseStringRequest {
|
||||
r.tag = &tag
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestEchoBodyTagResponseStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestEchoBodyTagResponseStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestEchoBodyTagResponseString Test empty json (request body)
|
||||
|
||||
Test empty json (request body)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestEchoBodyTagResponseStringRequest
|
||||
*/
|
||||
func (a *BodyAPIService) TestEchoBodyTagResponseString(ctx context.Context) ApiTestEchoBodyTagResponseStringRequest {
|
||||
return ApiTestEchoBodyTagResponseStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *BodyAPIService) TestEchoBodyTagResponseStringExecute(r ApiTestEchoBodyTagResponseStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BodyAPIService.TestEchoBodyTagResponseString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/echo/body/Tag/response_string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.tag
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
303
samples/client/echo_api/go/api_form.go
Normal file
303
samples/client/echo_api/go/api_form.go
Normal file
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
|
||||
// FormAPIService FormAPI service
|
||||
type FormAPIService service
|
||||
|
||||
type ApiTestFormIntegerBooleanStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *FormAPIService
|
||||
integerForm *int32
|
||||
booleanForm *bool
|
||||
stringForm *string
|
||||
}
|
||||
|
||||
func (r ApiTestFormIntegerBooleanStringRequest) IntegerForm(integerForm int32) ApiTestFormIntegerBooleanStringRequest {
|
||||
r.integerForm = &integerForm
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormIntegerBooleanStringRequest) BooleanForm(booleanForm bool) ApiTestFormIntegerBooleanStringRequest {
|
||||
r.booleanForm = &booleanForm
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormIntegerBooleanStringRequest) StringForm(stringForm string) ApiTestFormIntegerBooleanStringRequest {
|
||||
r.stringForm = &stringForm
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormIntegerBooleanStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestFormIntegerBooleanStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestFormIntegerBooleanString Test form parameter(s)
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestFormIntegerBooleanStringRequest
|
||||
*/
|
||||
func (a *FormAPIService) TestFormIntegerBooleanString(ctx context.Context) ApiTestFormIntegerBooleanStringRequest {
|
||||
return ApiTestFormIntegerBooleanStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *FormAPIService) TestFormIntegerBooleanStringExecute(r ApiTestFormIntegerBooleanStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FormAPIService.TestFormIntegerBooleanString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/form/integer/boolean/string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
if r.integerForm != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "integer_form", r.integerForm, "")
|
||||
}
|
||||
if r.booleanForm != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "boolean_form", r.booleanForm, "")
|
||||
}
|
||||
if r.stringForm != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "string_form", r.stringForm, "")
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestFormOneofRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *FormAPIService
|
||||
form1 *string
|
||||
form2 *int32
|
||||
form3 *string
|
||||
form4 *bool
|
||||
id *int64
|
||||
name *string
|
||||
}
|
||||
|
||||
func (r ApiTestFormOneofRequest) Form1(form1 string) ApiTestFormOneofRequest {
|
||||
r.form1 = &form1
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormOneofRequest) Form2(form2 int32) ApiTestFormOneofRequest {
|
||||
r.form2 = &form2
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormOneofRequest) Form3(form3 string) ApiTestFormOneofRequest {
|
||||
r.form3 = &form3
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormOneofRequest) Form4(form4 bool) ApiTestFormOneofRequest {
|
||||
r.form4 = &form4
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormOneofRequest) Id(id int64) ApiTestFormOneofRequest {
|
||||
r.id = &id
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormOneofRequest) Name(name string) ApiTestFormOneofRequest {
|
||||
r.name = &name
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestFormOneofRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestFormOneofExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestFormOneof Test form parameter(s) for oneOf schema
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestFormOneofRequest
|
||||
*/
|
||||
func (a *FormAPIService) TestFormOneof(ctx context.Context) ApiTestFormOneofRequest {
|
||||
return ApiTestFormOneofRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *FormAPIService) TestFormOneofExecute(r ApiTestFormOneofRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodPost
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FormAPIService.TestFormOneof")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/form/oneof"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
if r.form1 != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "form1", r.form1, "")
|
||||
}
|
||||
if r.form2 != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "form2", r.form2, "")
|
||||
}
|
||||
if r.form3 != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "form3", r.form3, "")
|
||||
}
|
||||
if r.form4 != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "form4", r.form4, "")
|
||||
}
|
||||
if r.id != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "id", r.id, "")
|
||||
}
|
||||
if r.name != nil {
|
||||
parameterAddToHeaderOrQuery(localVarFormParams, "name", r.name, "")
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
150
samples/client/echo_api/go/api_header.go
Normal file
150
samples/client/echo_api/go/api_header.go
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
|
||||
// HeaderAPIService HeaderAPI service
|
||||
type HeaderAPIService service
|
||||
|
||||
type ApiTestHeaderIntegerBooleanStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *HeaderAPIService
|
||||
integerHeader *int32
|
||||
booleanHeader *bool
|
||||
stringHeader *string
|
||||
}
|
||||
|
||||
func (r ApiTestHeaderIntegerBooleanStringRequest) IntegerHeader(integerHeader int32) ApiTestHeaderIntegerBooleanStringRequest {
|
||||
r.integerHeader = &integerHeader
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestHeaderIntegerBooleanStringRequest) BooleanHeader(booleanHeader bool) ApiTestHeaderIntegerBooleanStringRequest {
|
||||
r.booleanHeader = &booleanHeader
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestHeaderIntegerBooleanStringRequest) StringHeader(stringHeader string) ApiTestHeaderIntegerBooleanStringRequest {
|
||||
r.stringHeader = &stringHeader
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestHeaderIntegerBooleanStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestHeaderIntegerBooleanStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestHeaderIntegerBooleanString Test header parameter(s)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestHeaderIntegerBooleanStringRequest
|
||||
*/
|
||||
func (a *HeaderAPIService) TestHeaderIntegerBooleanString(ctx context.Context) ApiTestHeaderIntegerBooleanStringRequest {
|
||||
return ApiTestHeaderIntegerBooleanStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *HeaderAPIService) TestHeaderIntegerBooleanStringExecute(r ApiTestHeaderIntegerBooleanStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HeaderAPIService.TestHeaderIntegerBooleanString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/header/integer/boolean/string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
if r.integerHeader != nil {
|
||||
parameterAddToHeaderOrQuery(localVarHeaderParams, "integer_header", r.integerHeader, "")
|
||||
}
|
||||
if r.booleanHeader != nil {
|
||||
parameterAddToHeaderOrQuery(localVarHeaderParams, "boolean_header", r.booleanHeader, "")
|
||||
}
|
||||
if r.stringHeader != nil {
|
||||
parameterAddToHeaderOrQuery(localVarHeaderParams, "string_header", r.stringHeader, "")
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
132
samples/client/echo_api/go/api_path.go
Normal file
132
samples/client/echo_api/go/api_path.go
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
||||
// PathAPIService PathAPI service
|
||||
type PathAPIService service
|
||||
|
||||
type ApiTestsPathStringPathStringIntegerPathIntegerRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *PathAPIService
|
||||
pathString string
|
||||
pathInteger int32
|
||||
}
|
||||
|
||||
func (r ApiTestsPathStringPathStringIntegerPathIntegerRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestsPathStringPathStringIntegerPathIntegerExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestsPathStringPathStringIntegerPathInteger Test path parameter(s)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@param pathString
|
||||
@param pathInteger
|
||||
@return ApiTestsPathStringPathStringIntegerPathIntegerRequest
|
||||
*/
|
||||
func (a *PathAPIService) TestsPathStringPathStringIntegerPathInteger(ctx context.Context, pathString string, pathInteger int32) ApiTestsPathStringPathStringIntegerPathIntegerRequest {
|
||||
return ApiTestsPathStringPathStringIntegerPathIntegerRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
pathString: pathString,
|
||||
pathInteger: pathInteger,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *PathAPIService) TestsPathStringPathStringIntegerPathIntegerExecute(r ApiTestsPathStringPathStringIntegerPathIntegerRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PathAPIService.TestsPathStringPathStringIntegerPathInteger")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/path/string/{path_string}/integer/{path_integer}"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"path_string"+"}", url.PathEscape(parameterValueToString(r.pathString, "pathString")), -1)
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"path_integer"+"}", url.PathEscape(parameterValueToString(r.pathInteger, "pathInteger")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
925
samples/client/echo_api/go/api_query.go
Normal file
925
samples/client/echo_api/go/api_query.go
Normal file
@@ -0,0 +1,925 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
// QueryAPIService QueryAPI service
|
||||
type QueryAPIService service
|
||||
|
||||
type ApiTestEnumRefStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
enumRefStringQuery *StringEnumRef
|
||||
}
|
||||
|
||||
func (r ApiTestEnumRefStringRequest) EnumRefStringQuery(enumRefStringQuery StringEnumRef) ApiTestEnumRefStringRequest {
|
||||
r.enumRefStringQuery = &enumRefStringQuery
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestEnumRefStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestEnumRefStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestEnumRefString Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestEnumRefStringRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestEnumRefString(ctx context.Context) ApiTestEnumRefStringRequest {
|
||||
return ApiTestEnumRefStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestEnumRefStringExecute(r ApiTestEnumRefStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestEnumRefString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/enum_ref_string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.enumRefStringQuery != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "enum_ref_string_query", r.enumRefStringQuery, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestQueryDatetimeDateStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
datetimeQuery *time.Time
|
||||
dateQuery *string
|
||||
stringQuery *string
|
||||
}
|
||||
|
||||
func (r ApiTestQueryDatetimeDateStringRequest) DatetimeQuery(datetimeQuery time.Time) ApiTestQueryDatetimeDateStringRequest {
|
||||
r.datetimeQuery = &datetimeQuery
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryDatetimeDateStringRequest) DateQuery(dateQuery string) ApiTestQueryDatetimeDateStringRequest {
|
||||
r.dateQuery = &dateQuery
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryDatetimeDateStringRequest) StringQuery(stringQuery string) ApiTestQueryDatetimeDateStringRequest {
|
||||
r.stringQuery = &stringQuery
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryDatetimeDateStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestQueryDatetimeDateStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestQueryDatetimeDateString Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestQueryDatetimeDateStringRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestQueryDatetimeDateString(ctx context.Context) ApiTestQueryDatetimeDateStringRequest {
|
||||
return ApiTestQueryDatetimeDateStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestQueryDatetimeDateStringExecute(r ApiTestQueryDatetimeDateStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryDatetimeDateString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/datetime/date/string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.datetimeQuery != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "datetime_query", r.datetimeQuery, "")
|
||||
}
|
||||
if r.dateQuery != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "date_query", r.dateQuery, "")
|
||||
}
|
||||
if r.stringQuery != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "string_query", r.stringQuery, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestQueryIntegerBooleanStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
integerQuery *int32
|
||||
booleanQuery *bool
|
||||
stringQuery *string
|
||||
}
|
||||
|
||||
func (r ApiTestQueryIntegerBooleanStringRequest) IntegerQuery(integerQuery int32) ApiTestQueryIntegerBooleanStringRequest {
|
||||
r.integerQuery = &integerQuery
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryIntegerBooleanStringRequest) BooleanQuery(booleanQuery bool) ApiTestQueryIntegerBooleanStringRequest {
|
||||
r.booleanQuery = &booleanQuery
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryIntegerBooleanStringRequest) StringQuery(stringQuery string) ApiTestQueryIntegerBooleanStringRequest {
|
||||
r.stringQuery = &stringQuery
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryIntegerBooleanStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestQueryIntegerBooleanStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestQueryIntegerBooleanString Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestQueryIntegerBooleanStringRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestQueryIntegerBooleanString(ctx context.Context) ApiTestQueryIntegerBooleanStringRequest {
|
||||
return ApiTestQueryIntegerBooleanStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestQueryIntegerBooleanStringExecute(r ApiTestQueryIntegerBooleanStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryIntegerBooleanString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/integer/boolean/string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.integerQuery != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "integer_query", r.integerQuery, "")
|
||||
}
|
||||
if r.booleanQuery != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "boolean_query", r.booleanQuery, "")
|
||||
}
|
||||
if r.stringQuery != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "string_query", r.stringQuery, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
queryObject *Pet
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest) QueryObject(queryObject Pet) ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest {
|
||||
r.queryObject = &queryObject
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestQueryStyleDeepObjectExplodeTrueObjectExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestQueryStyleDeepObjectExplodeTrueObject Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObject(ctx context.Context) ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest {
|
||||
return ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObjectExecute(r ApiTestQueryStyleDeepObjectExplodeTrueObjectRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleDeepObjectExplodeTrueObject")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/style_deepObject/explode_true/object"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.queryObject != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
queryObject *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest) QueryObject(queryObject TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest {
|
||||
r.queryObject = &queryObject
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestQueryStyleDeepObjectExplodeTrueObjectAllOfExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOf Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObjectAllOf(ctx context.Context) ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest {
|
||||
return ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestQueryStyleDeepObjectExplodeTrueObjectAllOfExecute(r ApiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleDeepObjectExplodeTrueObjectAllOf")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/style_deepObject/explode_true/object/allOf"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.queryObject != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestQueryStyleFormExplodeTrueArrayStringRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
queryObject *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleFormExplodeTrueArrayStringRequest) QueryObject(queryObject TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) ApiTestQueryStyleFormExplodeTrueArrayStringRequest {
|
||||
r.queryObject = &queryObject
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleFormExplodeTrueArrayStringRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestQueryStyleFormExplodeTrueArrayStringExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestQueryStyleFormExplodeTrueArrayString Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestQueryStyleFormExplodeTrueArrayStringRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestQueryStyleFormExplodeTrueArrayString(ctx context.Context) ApiTestQueryStyleFormExplodeTrueArrayStringRequest {
|
||||
return ApiTestQueryStyleFormExplodeTrueArrayStringRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestQueryStyleFormExplodeTrueArrayStringExecute(r ApiTestQueryStyleFormExplodeTrueArrayStringRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeTrueArrayString")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/style_form/explode_true/array_string"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.queryObject != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestQueryStyleFormExplodeTrueObjectRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
queryObject *Pet
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleFormExplodeTrueObjectRequest) QueryObject(queryObject Pet) ApiTestQueryStyleFormExplodeTrueObjectRequest {
|
||||
r.queryObject = &queryObject
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleFormExplodeTrueObjectRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestQueryStyleFormExplodeTrueObjectExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestQueryStyleFormExplodeTrueObject Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestQueryStyleFormExplodeTrueObjectRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObject(ctx context.Context) ApiTestQueryStyleFormExplodeTrueObjectRequest {
|
||||
return ApiTestQueryStyleFormExplodeTrueObjectRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObjectExecute(r ApiTestQueryStyleFormExplodeTrueObjectRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeTrueObject")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/style_form/explode_true/object"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.queryObject != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
|
||||
type ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest struct {
|
||||
ctx context.Context
|
||||
ApiService *QueryAPIService
|
||||
queryObject *DataQuery
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest) QueryObject(queryObject DataQuery) ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest {
|
||||
r.queryObject = &queryObject
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest) Execute() (string, *http.Response, error) {
|
||||
return r.ApiService.TestQueryStyleFormExplodeTrueObjectAllOfExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
TestQueryStyleFormExplodeTrueObjectAllOf Test query parameter(s)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@return ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest
|
||||
*/
|
||||
func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObjectAllOf(ctx context.Context) ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest {
|
||||
return ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// Execute executes the request
|
||||
// @return string
|
||||
func (a *QueryAPIService) TestQueryStyleFormExplodeTrueObjectAllOfExecute(r ApiTestQueryStyleFormExplodeTrueObjectAllOfRequest) (string, *http.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = http.MethodGet
|
||||
localVarPostBody interface{}
|
||||
formFiles []formFile
|
||||
localVarReturnValue string
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryAPIService.TestQueryStyleFormExplodeTrueObjectAllOf")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/query/style_form/explode_true/object/allOf"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
if r.queryObject != nil {
|
||||
parameterAddToHeaderOrQuery(localVarQueryParams, "query_object", r.queryObject, "")
|
||||
}
|
||||
// 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{"text/plain"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = io.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
|
||||
}
|
||||
683
samples/client/echo_api/go/client.go
Normal file
683
samples/client/echo_api/go/client.go
Normal file
@@ -0,0 +1,683 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
)
|
||||
|
||||
var (
|
||||
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
|
||||
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
|
||||
queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`)
|
||||
queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" )
|
||||
)
|
||||
|
||||
// APIClient manages communication with the Echo Server API API v0.1.0
|
||||
// In most cases there should be only one, shared, APIClient.
|
||||
type APIClient struct {
|
||||
cfg *Configuration
|
||||
common service // Reuse a single struct instead of allocating one for each service on the heap.
|
||||
|
||||
// API Services
|
||||
|
||||
AuthAPI *AuthAPIService
|
||||
|
||||
BodyAPI *BodyAPIService
|
||||
|
||||
FormAPI *FormAPIService
|
||||
|
||||
HeaderAPI *HeaderAPIService
|
||||
|
||||
PathAPI *PathAPIService
|
||||
|
||||
QueryAPI *QueryAPIService
|
||||
}
|
||||
|
||||
type service struct {
|
||||
client *APIClient
|
||||
}
|
||||
|
||||
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
|
||||
// optionally a custom http.Client to allow for advanced features such as caching.
|
||||
func NewAPIClient(cfg *Configuration) *APIClient {
|
||||
if cfg.HTTPClient == nil {
|
||||
cfg.HTTPClient = http.DefaultClient
|
||||
}
|
||||
|
||||
c := &APIClient{}
|
||||
c.cfg = cfg
|
||||
c.common.client = c
|
||||
|
||||
// API Services
|
||||
c.AuthAPI = (*AuthAPIService)(&c.common)
|
||||
c.BodyAPI = (*BodyAPIService)(&c.common)
|
||||
c.FormAPI = (*FormAPIService)(&c.common)
|
||||
c.HeaderAPI = (*HeaderAPIService)(&c.common)
|
||||
c.PathAPI = (*PathAPIService)(&c.common)
|
||||
c.QueryAPI = (*QueryAPIService)(&c.common)
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func atoi(in string) (int, error) {
|
||||
return strconv.Atoi(in)
|
||||
}
|
||||
|
||||
// selectHeaderContentType select a content type from the available list.
|
||||
func selectHeaderContentType(contentTypes []string) string {
|
||||
if len(contentTypes) == 0 {
|
||||
return ""
|
||||
}
|
||||
if contains(contentTypes, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||
}
|
||||
|
||||
// selectHeaderAccept join all accept types and return
|
||||
func selectHeaderAccept(accepts []string) string {
|
||||
if len(accepts) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if contains(accepts, "application/json") {
|
||||
return "application/json"
|
||||
}
|
||||
|
||||
return strings.Join(accepts, ",")
|
||||
}
|
||||
|
||||
// contains is a case insensitive match, finding needle in a haystack
|
||||
func contains(haystack []string, needle string) bool {
|
||||
for _, a := range haystack {
|
||||
if strings.EqualFold(a, needle) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Verify optional parameters are of the correct type.
|
||||
func typeCheckParameter(obj interface{}, expected string, name string) error {
|
||||
// Make sure there is an object.
|
||||
if obj == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the type is as expected.
|
||||
if reflect.TypeOf(obj).String() != expected {
|
||||
return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func parameterValueToString( obj interface{}, key string ) string {
|
||||
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
|
||||
return fmt.Sprintf("%v", obj)
|
||||
}
|
||||
var param,ok = obj.(MappedNullable)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
dataMap,err := param.ToMap()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%v", dataMap[key])
|
||||
}
|
||||
|
||||
// parameterAddToHeaderOrQuery adds the provided object to the request header or url query
|
||||
// supporting deep object syntax
|
||||
func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
|
||||
var v = reflect.ValueOf(obj)
|
||||
var value = ""
|
||||
if v == reflect.ValueOf(nil) {
|
||||
value = "null"
|
||||
} else {
|
||||
switch v.Kind() {
|
||||
case reflect.Invalid:
|
||||
value = "invalid"
|
||||
|
||||
case reflect.Struct:
|
||||
if t,ok := obj.(MappedNullable); ok {
|
||||
dataMap,err := t.ToMap()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType)
|
||||
return
|
||||
}
|
||||
if t, ok := obj.(time.Time); ok {
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType)
|
||||
return
|
||||
}
|
||||
value = v.Type().String() + " value"
|
||||
case reflect.Slice:
|
||||
var indValue = reflect.ValueOf(obj)
|
||||
if indValue == reflect.ValueOf(nil) {
|
||||
return
|
||||
}
|
||||
var lenIndValue = indValue.Len()
|
||||
for i:=0;i<lenIndValue;i++ {
|
||||
var arrayValue = indValue.Index(i)
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType)
|
||||
}
|
||||
return
|
||||
|
||||
case reflect.Map:
|
||||
var indValue = reflect.ValueOf(obj)
|
||||
if indValue == reflect.ValueOf(nil) {
|
||||
return
|
||||
}
|
||||
iter := indValue.MapRange()
|
||||
for iter.Next() {
|
||||
k,v := iter.Key(), iter.Value()
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType)
|
||||
}
|
||||
return
|
||||
|
||||
case reflect.Interface:
|
||||
fallthrough
|
||||
case reflect.Ptr:
|
||||
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType)
|
||||
return
|
||||
|
||||
case reflect.Int, reflect.Int8, reflect.Int16,
|
||||
reflect.Int32, reflect.Int64:
|
||||
value = strconv.FormatInt(v.Int(), 10)
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16,
|
||||
reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
value = strconv.FormatUint(v.Uint(), 10)
|
||||
case reflect.Float32, reflect.Float64:
|
||||
value = strconv.FormatFloat(v.Float(), 'g', -1, 32)
|
||||
case reflect.Bool:
|
||||
value = strconv.FormatBool(v.Bool())
|
||||
case reflect.String:
|
||||
value = v.String()
|
||||
default:
|
||||
value = v.Type().String() + " value"
|
||||
}
|
||||
}
|
||||
|
||||
switch valuesMap := headerOrQueryParams.(type) {
|
||||
case url.Values:
|
||||
if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" {
|
||||
valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix) + "," + value)
|
||||
} else {
|
||||
valuesMap.Add(keyPrefix, value)
|
||||
}
|
||||
break
|
||||
case map[string]string:
|
||||
valuesMap[keyPrefix] = value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// helper for converting interface{} parameters to json strings
|
||||
func parameterToJson(obj interface{}) (string, error) {
|
||||
jsonBuf, err := json.Marshal(obj)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(jsonBuf), err
|
||||
}
|
||||
|
||||
// callAPI do the request.
|
||||
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
|
||||
if c.cfg.Debug {
|
||||
dump, err := httputil.DumpRequestOut(request, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Printf("\n%s\n", string(dump))
|
||||
}
|
||||
|
||||
resp, err := c.cfg.HTTPClient.Do(request)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
if c.cfg.Debug {
|
||||
dump, err := httputil.DumpResponse(resp, true)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
log.Printf("\n%s\n", string(dump))
|
||||
}
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// Allow modification of underlying config for alternate implementations and testing
|
||||
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
|
||||
func (c *APIClient) GetConfig() *Configuration {
|
||||
return c.cfg
|
||||
}
|
||||
|
||||
type formFile struct {
|
||||
fileBytes []byte
|
||||
fileName string
|
||||
formFileName string
|
||||
}
|
||||
|
||||
// prepareRequest build the request
|
||||
func (c *APIClient) prepareRequest(
|
||||
ctx context.Context,
|
||||
path string, method string,
|
||||
postBody interface{},
|
||||
headerParams map[string]string,
|
||||
queryParams url.Values,
|
||||
formParams url.Values,
|
||||
formFiles []formFile) (localVarRequest *http.Request, err error) {
|
||||
|
||||
var body *bytes.Buffer
|
||||
|
||||
// Detect postBody type and post.
|
||||
if postBody != nil {
|
||||
contentType := headerParams["Content-Type"]
|
||||
if contentType == "" {
|
||||
contentType = detectContentType(postBody)
|
||||
headerParams["Content-Type"] = contentType
|
||||
}
|
||||
|
||||
body, err = setBody(postBody, contentType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// add form parameters and file if available.
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
w := multipart.NewWriter(body)
|
||||
|
||||
for k, v := range formParams {
|
||||
for _, iv := range v {
|
||||
if strings.HasPrefix(k, "@") { // file
|
||||
err = addFile(w, k[1:], iv)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else { // form value
|
||||
w.WriteField(k, iv)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, formFile := range formFiles {
|
||||
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
|
||||
w.Boundary()
|
||||
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = part.Write(formFile.fileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Boundary in the Content-Type
|
||||
headerParams["Content-Type"] = w.FormDataContentType()
|
||||
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
w.Close()
|
||||
}
|
||||
|
||||
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
|
||||
if body != nil {
|
||||
return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.")
|
||||
}
|
||||
body = &bytes.Buffer{}
|
||||
body.WriteString(formParams.Encode())
|
||||
// Set Content-Length
|
||||
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
|
||||
}
|
||||
|
||||
// Setup path and query parameters
|
||||
url, err := url.Parse(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Override request host, if applicable
|
||||
if c.cfg.Host != "" {
|
||||
url.Host = c.cfg.Host
|
||||
}
|
||||
|
||||
// Override request scheme, if applicable
|
||||
if c.cfg.Scheme != "" {
|
||||
url.Scheme = c.cfg.Scheme
|
||||
}
|
||||
|
||||
// Adding Query Param
|
||||
query := url.Query()
|
||||
for k, v := range queryParams {
|
||||
for _, iv := range v {
|
||||
query.Add(k, iv)
|
||||
}
|
||||
}
|
||||
|
||||
// Encode the parameters.
|
||||
url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string {
|
||||
pieces := strings.Split(s, "=")
|
||||
pieces[0] = queryDescape.Replace(pieces[0])
|
||||
return strings.Join(pieces, "=")
|
||||
})
|
||||
|
||||
// Generate a new request
|
||||
if body != nil {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), body)
|
||||
} else {
|
||||
localVarRequest, err = http.NewRequest(method, url.String(), nil)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// add header parameters, if any
|
||||
if len(headerParams) > 0 {
|
||||
headers := http.Header{}
|
||||
for h, v := range headerParams {
|
||||
headers[h] = []string{v}
|
||||
}
|
||||
localVarRequest.Header = headers
|
||||
}
|
||||
|
||||
// Add the user agent to the request.
|
||||
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
|
||||
|
||||
if ctx != nil {
|
||||
// add context to the request
|
||||
localVarRequest = localVarRequest.WithContext(ctx)
|
||||
|
||||
// Walk through any authentication.
|
||||
|
||||
// Basic HTTP Authentication
|
||||
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
|
||||
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for header, value := range c.cfg.DefaultHeader {
|
||||
localVarRequest.Header.Add(header, value)
|
||||
}
|
||||
return localVarRequest, nil
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if len(b) == 0 {
|
||||
return nil
|
||||
}
|
||||
if s, ok := v.(*string); ok {
|
||||
*s = string(b)
|
||||
return nil
|
||||
}
|
||||
if f, ok := v.(*os.File); ok {
|
||||
f, err = os.CreateTemp("", "HttpClientFile")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = f.Write(b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = f.Seek(0, io.SeekStart)
|
||||
err = os.Remove(f.Name())
|
||||
return
|
||||
}
|
||||
if f, ok := v.(**os.File); ok {
|
||||
*f, err = os.CreateTemp("", "HttpClientFile")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = (*f).Write(b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = (*f).Seek(0, io.SeekStart)
|
||||
err = os.Remove((*f).Name())
|
||||
return
|
||||
}
|
||||
if xmlCheck.MatchString(contentType) {
|
||||
if err = xml.Unmarshal(b, v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if jsonCheck.MatchString(contentType) {
|
||||
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
|
||||
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
|
||||
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined")
|
||||
}
|
||||
} else if err = json.Unmarshal(b, v); err != nil { // simple model
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return errors.New("undefined response type")
|
||||
}
|
||||
|
||||
// Add a file to the multipart request
|
||||
func addFile(w *multipart.Writer, fieldName, path string) error {
|
||||
file, err := os.Open(filepath.Clean(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = file.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = io.Copy(part, file)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Prevent trying to import "fmt"
|
||||
func reportError(format string, a ...interface{}) error {
|
||||
return fmt.Errorf(format, a...)
|
||||
}
|
||||
|
||||
// A wrapper for strict JSON decoding
|
||||
func newStrictDecoder(data []byte) *json.Decoder {
|
||||
dec := json.NewDecoder(bytes.NewBuffer(data))
|
||||
dec.DisallowUnknownFields()
|
||||
return dec
|
||||
}
|
||||
|
||||
// Set request body from an interface{}
|
||||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
|
||||
if bodyBuf == nil {
|
||||
bodyBuf = &bytes.Buffer{}
|
||||
}
|
||||
|
||||
if reader, ok := body.(io.Reader); ok {
|
||||
_, err = bodyBuf.ReadFrom(reader)
|
||||
} else if fp, ok := body.(*os.File); ok {
|
||||
_, err = bodyBuf.ReadFrom(fp)
|
||||
} else if b, ok := body.([]byte); ok {
|
||||
_, err = bodyBuf.Write(b)
|
||||
} else if s, ok := body.(string); ok {
|
||||
_, err = bodyBuf.WriteString(s)
|
||||
} else if s, ok := body.(*string); ok {
|
||||
_, err = bodyBuf.WriteString(*s)
|
||||
} else if jsonCheck.MatchString(contentType) {
|
||||
err = json.NewEncoder(bodyBuf).Encode(body)
|
||||
} else if xmlCheck.MatchString(contentType) {
|
||||
var bs []byte
|
||||
bs, err = xml.Marshal(body)
|
||||
if err == nil {
|
||||
bodyBuf.Write(bs)
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if bodyBuf.Len() == 0 {
|
||||
err = fmt.Errorf("invalid body type %s\n", contentType)
|
||||
return nil, err
|
||||
}
|
||||
return bodyBuf, nil
|
||||
}
|
||||
|
||||
// detectContentType method is used to figure out `Request.Body` content type for request header
|
||||
func detectContentType(body interface{}) string {
|
||||
contentType := "text/plain; charset=utf-8"
|
||||
kind := reflect.TypeOf(body).Kind()
|
||||
|
||||
switch kind {
|
||||
case reflect.Struct, reflect.Map, reflect.Ptr:
|
||||
contentType = "application/json; charset=utf-8"
|
||||
case reflect.String:
|
||||
contentType = "text/plain; charset=utf-8"
|
||||
default:
|
||||
if b, ok := body.([]byte); ok {
|
||||
contentType = http.DetectContentType(b)
|
||||
} else if kind == reflect.Slice {
|
||||
contentType = "application/json; charset=utf-8"
|
||||
}
|
||||
}
|
||||
|
||||
return contentType
|
||||
}
|
||||
|
||||
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
|
||||
type cacheControl map[string]string
|
||||
|
||||
func parseCacheControl(headers http.Header) cacheControl {
|
||||
cc := cacheControl{}
|
||||
ccHeader := headers.Get("Cache-Control")
|
||||
for _, part := range strings.Split(ccHeader, ",") {
|
||||
part = strings.Trim(part, " ")
|
||||
if part == "" {
|
||||
continue
|
||||
}
|
||||
if strings.ContainsRune(part, '=') {
|
||||
keyval := strings.Split(part, "=")
|
||||
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
|
||||
} else {
|
||||
cc[part] = ""
|
||||
}
|
||||
}
|
||||
return cc
|
||||
}
|
||||
|
||||
// CacheExpires helper function to determine remaining time before repeating a request.
|
||||
func CacheExpires(r *http.Response) time.Time {
|
||||
// Figure out when the cache expires.
|
||||
var expires time.Time
|
||||
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
|
||||
if err != nil {
|
||||
return time.Now()
|
||||
}
|
||||
respCacheControl := parseCacheControl(r.Header)
|
||||
|
||||
if maxAge, ok := respCacheControl["max-age"]; ok {
|
||||
lifetime, err := time.ParseDuration(maxAge + "s")
|
||||
if err != nil {
|
||||
expires = now
|
||||
} else {
|
||||
expires = now.Add(lifetime)
|
||||
}
|
||||
} else {
|
||||
expiresHeader := r.Header.Get("Expires")
|
||||
if expiresHeader != "" {
|
||||
expires, err = time.Parse(time.RFC1123, expiresHeader)
|
||||
if err != nil {
|
||||
expires = now
|
||||
}
|
||||
}
|
||||
}
|
||||
return expires
|
||||
}
|
||||
|
||||
func strlen(s string) int {
|
||||
return utf8.RuneCountInString(s)
|
||||
}
|
||||
|
||||
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
|
||||
type GenericOpenAPIError struct {
|
||||
body []byte
|
||||
error string
|
||||
model interface{}
|
||||
}
|
||||
|
||||
// Error returns non-empty string if there was an error.
|
||||
func (e GenericOpenAPIError) Error() string {
|
||||
return e.error
|
||||
}
|
||||
|
||||
// Body returns the raw bytes of the response
|
||||
func (e GenericOpenAPIError) Body() []byte {
|
||||
return e.body
|
||||
}
|
||||
|
||||
// Model returns the unpacked model of the error
|
||||
func (e GenericOpenAPIError) Model() interface{} {
|
||||
return e.model
|
||||
}
|
||||
|
||||
// format error message using title and detail when model implements rfc7807
|
||||
func formatErrorMessage(status string, v interface{}) string {
|
||||
str := ""
|
||||
metaValue := reflect.ValueOf(v).Elem()
|
||||
|
||||
if metaValue.Kind() == reflect.Struct {
|
||||
field := metaValue.FieldByName("Title")
|
||||
if field != (reflect.Value{}) {
|
||||
str = fmt.Sprintf("%s", field.Interface())
|
||||
}
|
||||
|
||||
field = metaValue.FieldByName("Detail")
|
||||
if field != (reflect.Value{}) {
|
||||
str = fmt.Sprintf("%s (%s)", str, field.Interface())
|
||||
}
|
||||
}
|
||||
|
||||
return strings.TrimSpace(fmt.Sprintf("%s %s", status, str))
|
||||
}
|
||||
219
samples/client/echo_api/go/configuration.go
Normal file
219
samples/client/echo_api/go/configuration.go
Normal file
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// contextKeys are used to identify the type of value in the context.
|
||||
// Since these are string, it is possible to get a short description of the
|
||||
// context key for logging and debugging using key.String().
|
||||
|
||||
type contextKey string
|
||||
|
||||
func (c contextKey) String() string {
|
||||
return "auth " + string(c)
|
||||
}
|
||||
|
||||
var (
|
||||
// ContextBasicAuth takes BasicAuth as authentication for the request.
|
||||
ContextBasicAuth = contextKey("basic")
|
||||
|
||||
// ContextServerIndex uses a server configuration from the index.
|
||||
ContextServerIndex = contextKey("serverIndex")
|
||||
|
||||
// ContextOperationServerIndices uses a server configuration from the index mapping.
|
||||
ContextOperationServerIndices = contextKey("serverOperationIndices")
|
||||
|
||||
// ContextServerVariables overrides a server configuration variables.
|
||||
ContextServerVariables = contextKey("serverVariables")
|
||||
|
||||
// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
|
||||
ContextOperationServerVariables = contextKey("serverOperationVariables")
|
||||
)
|
||||
|
||||
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
|
||||
type BasicAuth struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
}
|
||||
|
||||
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
|
||||
type APIKey struct {
|
||||
Key string
|
||||
Prefix string
|
||||
}
|
||||
|
||||
// ServerVariable stores the information about a server variable
|
||||
type ServerVariable struct {
|
||||
Description string
|
||||
DefaultValue string
|
||||
EnumValues []string
|
||||
}
|
||||
|
||||
// ServerConfiguration stores the information about a server
|
||||
type ServerConfiguration struct {
|
||||
URL string
|
||||
Description string
|
||||
Variables map[string]ServerVariable
|
||||
}
|
||||
|
||||
// ServerConfigurations stores multiple ServerConfiguration items
|
||||
type ServerConfigurations []ServerConfiguration
|
||||
|
||||
// Configuration stores the configuration of the API client
|
||||
type Configuration struct {
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
|
||||
UserAgent string `json:"userAgent,omitempty"`
|
||||
Debug bool `json:"debug,omitempty"`
|
||||
Servers ServerConfigurations
|
||||
OperationServers map[string]ServerConfigurations
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// NewConfiguration returns a new Configuration object
|
||||
func NewConfiguration() *Configuration {
|
||||
cfg := &Configuration{
|
||||
DefaultHeader: make(map[string]string),
|
||||
UserAgent: "OpenAPI-Generator/1.0.0/go",
|
||||
Debug: false,
|
||||
Servers: ServerConfigurations{
|
||||
{
|
||||
URL: "http://localhost:3000",
|
||||
Description: "No description provided",
|
||||
},
|
||||
},
|
||||
OperationServers: map[string]ServerConfigurations{
|
||||
},
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// AddDefaultHeader adds a new HTTP header to the default header in the request
|
||||
func (c *Configuration) AddDefaultHeader(key string, value string) {
|
||||
c.DefaultHeader[key] = value
|
||||
}
|
||||
|
||||
// URL formats template on a index using given variables
|
||||
func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) {
|
||||
if index < 0 || len(sc) <= index {
|
||||
return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1)
|
||||
}
|
||||
server := sc[index]
|
||||
url := server.URL
|
||||
|
||||
// go through variables and replace placeholders
|
||||
for name, variable := range server.Variables {
|
||||
if value, ok := variables[name]; ok {
|
||||
found := bool(len(variable.EnumValues) == 0)
|
||||
for _, enumValue := range variable.EnumValues {
|
||||
if value == enumValue {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
|
||||
}
|
||||
url = strings.Replace(url, "{"+name+"}", value, -1)
|
||||
} else {
|
||||
url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1)
|
||||
}
|
||||
}
|
||||
return url, nil
|
||||
}
|
||||
|
||||
// ServerURL returns URL based on server settings
|
||||
func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) {
|
||||
return c.Servers.URL(index, variables)
|
||||
}
|
||||
|
||||
func getServerIndex(ctx context.Context) (int, error) {
|
||||
si := ctx.Value(ContextServerIndex)
|
||||
if si != nil {
|
||||
if index, ok := si.(int); ok {
|
||||
return index, nil
|
||||
}
|
||||
return 0, reportError("Invalid type %T should be int", si)
|
||||
}
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) {
|
||||
osi := ctx.Value(ContextOperationServerIndices)
|
||||
if osi != nil {
|
||||
if operationIndices, ok := osi.(map[string]int); !ok {
|
||||
return 0, reportError("Invalid type %T should be map[string]int", osi)
|
||||
} else {
|
||||
index, ok := operationIndices[endpoint]
|
||||
if ok {
|
||||
return index, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return getServerIndex(ctx)
|
||||
}
|
||||
|
||||
func getServerVariables(ctx context.Context) (map[string]string, error) {
|
||||
sv := ctx.Value(ContextServerVariables)
|
||||
if sv != nil {
|
||||
if variables, ok := sv.(map[string]string); ok {
|
||||
return variables, nil
|
||||
}
|
||||
return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) {
|
||||
osv := ctx.Value(ContextOperationServerVariables)
|
||||
if osv != nil {
|
||||
if operationVariables, ok := osv.(map[string]map[string]string); !ok {
|
||||
return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv)
|
||||
} else {
|
||||
variables, ok := operationVariables[endpoint]
|
||||
if ok {
|
||||
return variables, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return getServerVariables(ctx)
|
||||
}
|
||||
|
||||
// ServerURLWithContext returns a new server URL given an endpoint
|
||||
func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) {
|
||||
sc, ok := c.OperationServers[endpoint]
|
||||
if !ok {
|
||||
sc = c.Servers
|
||||
}
|
||||
|
||||
if ctx == nil {
|
||||
return sc.URL(0, nil)
|
||||
}
|
||||
|
||||
index, err := getServerOperationIndex(ctx, endpoint)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
variables, err := getServerOperationVariables(ctx, endpoint)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return sc.URL(index, variables)
|
||||
}
|
||||
70
samples/client/echo_api/go/docs/AuthAPI.md
Normal file
70
samples/client/echo_api/go/docs/AuthAPI.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# \AuthAPI
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**TestAuthHttpBasic**](AuthAPI.md#TestAuthHttpBasic) | **Post** /auth/http/basic | To test HTTP basic authentication
|
||||
|
||||
|
||||
|
||||
## TestAuthHttpBasic
|
||||
|
||||
> string TestAuthHttpBasic(ctx).Execute()
|
||||
|
||||
To test HTTP basic authentication
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.AuthAPI.TestAuthHttpBasic(context.Background()).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `AuthAPI.TestAuthHttpBasic``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestAuthHttpBasic`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `AuthAPI.TestAuthHttpBasic`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestAuthHttpBasicRequest struct via the builder pattern
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
[http_auth](../README.md#http_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
82
samples/client/echo_api/go/docs/Bird.md
Normal file
82
samples/client/echo_api/go/docs/Bird.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Bird
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Size** | Pointer to **string** | | [optional]
|
||||
**Color** | Pointer to **string** | | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewBird
|
||||
|
||||
`func NewBird() *Bird`
|
||||
|
||||
NewBird instantiates a new Bird object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewBirdWithDefaults
|
||||
|
||||
`func NewBirdWithDefaults() *Bird`
|
||||
|
||||
NewBirdWithDefaults instantiates a new Bird object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetSize
|
||||
|
||||
`func (o *Bird) GetSize() string`
|
||||
|
||||
GetSize returns the Size field if non-nil, zero value otherwise.
|
||||
|
||||
### GetSizeOk
|
||||
|
||||
`func (o *Bird) GetSizeOk() (*string, bool)`
|
||||
|
||||
GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetSize
|
||||
|
||||
`func (o *Bird) SetSize(v string)`
|
||||
|
||||
SetSize sets Size field to given value.
|
||||
|
||||
### HasSize
|
||||
|
||||
`func (o *Bird) HasSize() bool`
|
||||
|
||||
HasSize returns a boolean if a field has been set.
|
||||
|
||||
### GetColor
|
||||
|
||||
`func (o *Bird) GetColor() string`
|
||||
|
||||
GetColor returns the Color field if non-nil, zero value otherwise.
|
||||
|
||||
### GetColorOk
|
||||
|
||||
`func (o *Bird) GetColorOk() (*string, bool)`
|
||||
|
||||
GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetColor
|
||||
|
||||
`func (o *Bird) SetColor(v string)`
|
||||
|
||||
SetColor sets Color field to given value.
|
||||
|
||||
### HasColor
|
||||
|
||||
`func (o *Bird) HasColor() bool`
|
||||
|
||||
HasColor returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
472
samples/client/echo_api/go/docs/BodyAPI.md
Normal file
472
samples/client/echo_api/go/docs/BodyAPI.md
Normal file
@@ -0,0 +1,472 @@
|
||||
# \BodyAPI
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**TestBinaryGif**](BodyAPI.md#TestBinaryGif) | **Post** /binary/gif | Test binary (gif) response body
|
||||
[**TestBodyApplicationOctetstreamBinary**](BodyAPI.md#TestBodyApplicationOctetstreamBinary) | **Post** /body/application/octetstream/binary | Test body parameter(s)
|
||||
[**TestBodyMultipartFormdataArrayOfBinary**](BodyAPI.md#TestBodyMultipartFormdataArrayOfBinary) | **Post** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime
|
||||
[**TestEchoBodyFreeFormObjectResponseString**](BodyAPI.md#TestEchoBodyFreeFormObjectResponseString) | **Post** /echo/body/FreeFormObject/response_string | Test free form object
|
||||
[**TestEchoBodyPet**](BodyAPI.md#TestEchoBodyPet) | **Post** /echo/body/Pet | Test body parameter(s)
|
||||
[**TestEchoBodyPetResponseString**](BodyAPI.md#TestEchoBodyPetResponseString) | **Post** /echo/body/Pet/response_string | Test empty response body
|
||||
[**TestEchoBodyTagResponseString**](BodyAPI.md#TestEchoBodyTagResponseString) | **Post** /echo/body/Tag/response_string | Test empty json (request body)
|
||||
|
||||
|
||||
|
||||
## TestBinaryGif
|
||||
|
||||
> *os.File TestBinaryGif(ctx).Execute()
|
||||
|
||||
Test binary (gif) response body
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.BodyAPI.TestBinaryGif(context.Background()).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBinaryGif``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestBinaryGif`: *os.File
|
||||
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBinaryGif`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestBinaryGifRequest struct via the builder pattern
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
[***os.File**](*os.File.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: image/gif
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestBodyApplicationOctetstreamBinary
|
||||
|
||||
> string TestBodyApplicationOctetstreamBinary(ctx).Body(body).Execute()
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
body := os.NewFile(1234, "some_file") // *os.File | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.BodyAPI.TestBodyApplicationOctetstreamBinary(context.Background()).Body(body).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBodyApplicationOctetstreamBinary``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestBodyApplicationOctetstreamBinary`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBodyApplicationOctetstreamBinary`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestBodyApplicationOctetstreamBinaryRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | ***os.File** | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/octet-stream
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestBodyMultipartFormdataArrayOfBinary
|
||||
|
||||
> string TestBodyMultipartFormdataArrayOfBinary(ctx).Files(files).Execute()
|
||||
|
||||
Test array of binary in multipart mime
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
files := []*os.File{"TODO"} // []*os.File |
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.BodyAPI.TestBodyMultipartFormdataArrayOfBinary(context.Background()).Files(files).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestBodyMultipartFormdataArrayOfBinary``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestBodyMultipartFormdataArrayOfBinary`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestBodyMultipartFormdataArrayOfBinary`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestBodyMultipartFormdataArrayOfBinaryRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**files** | **[]*os.File** | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestEchoBodyFreeFormObjectResponseString
|
||||
|
||||
> string TestEchoBodyFreeFormObjectResponseString(ctx).Body(body).Execute()
|
||||
|
||||
Test free form object
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
body := map[string]interface{}{ ... } // map[string]interface{} | Free form object (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.BodyAPI.TestEchoBodyFreeFormObjectResponseString(context.Background()).Body(body).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyFreeFormObjectResponseString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestEchoBodyFreeFormObjectResponseString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyFreeFormObjectResponseString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestEchoBodyFreeFormObjectResponseStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | **map[string]interface{}** | Free form object |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestEchoBodyPet
|
||||
|
||||
> Pet TestEchoBodyPet(ctx).Pet(pet).Execute()
|
||||
|
||||
Test body parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.BodyAPI.TestEchoBodyPet(context.Background()).Pet(pet).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyPet``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestEchoBodyPet`: Pet
|
||||
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyPet`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestEchoBodyPetRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **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)
|
||||
|
||||
|
||||
## TestEchoBodyPetResponseString
|
||||
|
||||
> string TestEchoBodyPetResponseString(ctx).Pet(pet).Execute()
|
||||
|
||||
Test empty response body
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
pet := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.BodyAPI.TestEchoBodyPetResponseString(context.Background()).Pet(pet).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyPetResponseString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestEchoBodyPetResponseString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyPetResponseString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestEchoBodyPetResponseStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestEchoBodyTagResponseString
|
||||
|
||||
> string TestEchoBodyTagResponseString(ctx).Tag(tag).Execute()
|
||||
|
||||
Test empty json (request body)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
tag := *openapiclient.NewTag() // Tag | Tag object (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.BodyAPI.TestEchoBodyTagResponseString(context.Background()).Tag(tag).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `BodyAPI.TestEchoBodyTagResponseString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestEchoBodyTagResponseString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `BodyAPI.TestEchoBodyTagResponseString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestEchoBodyTagResponseStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tag** | [**Tag**](Tag.md) | Tag object |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
82
samples/client/echo_api/go/docs/Category.md
Normal file
82
samples/client/echo_api/go/docs/Category.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Category
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Id** | Pointer to **int64** | | [optional]
|
||||
**Name** | Pointer to **string** | | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewCategory
|
||||
|
||||
`func NewCategory() *Category`
|
||||
|
||||
NewCategory instantiates a new Category object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewCategoryWithDefaults
|
||||
|
||||
`func NewCategoryWithDefaults() *Category`
|
||||
|
||||
NewCategoryWithDefaults instantiates a new Category object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetId
|
||||
|
||||
`func (o *Category) GetId() int64`
|
||||
|
||||
GetId returns the Id field if non-nil, zero value otherwise.
|
||||
|
||||
### GetIdOk
|
||||
|
||||
`func (o *Category) GetIdOk() (*int64, bool)`
|
||||
|
||||
GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetId
|
||||
|
||||
`func (o *Category) SetId(v int64)`
|
||||
|
||||
SetId sets Id field to given value.
|
||||
|
||||
### HasId
|
||||
|
||||
`func (o *Category) HasId() bool`
|
||||
|
||||
HasId returns a boolean if a field has been set.
|
||||
|
||||
### GetName
|
||||
|
||||
`func (o *Category) GetName() string`
|
||||
|
||||
GetName returns the Name field if non-nil, zero value otherwise.
|
||||
|
||||
### GetNameOk
|
||||
|
||||
`func (o *Category) GetNameOk() (*string, bool)`
|
||||
|
||||
GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetName
|
||||
|
||||
`func (o *Category) SetName(v string)`
|
||||
|
||||
SetName sets Name field to given value.
|
||||
|
||||
### HasName
|
||||
|
||||
`func (o *Category) HasName() bool`
|
||||
|
||||
HasName returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
108
samples/client/echo_api/go/docs/DataQuery.md
Normal file
108
samples/client/echo_api/go/docs/DataQuery.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# DataQuery
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Suffix** | Pointer to **string** | test suffix | [optional]
|
||||
**Text** | Pointer to **string** | Some text containing white spaces | [optional]
|
||||
**Date** | Pointer to **time.Time** | A date | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewDataQuery
|
||||
|
||||
`func NewDataQuery() *DataQuery`
|
||||
|
||||
NewDataQuery instantiates a new DataQuery object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewDataQueryWithDefaults
|
||||
|
||||
`func NewDataQueryWithDefaults() *DataQuery`
|
||||
|
||||
NewDataQueryWithDefaults instantiates a new DataQuery object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetSuffix
|
||||
|
||||
`func (o *DataQuery) GetSuffix() string`
|
||||
|
||||
GetSuffix returns the Suffix field if non-nil, zero value otherwise.
|
||||
|
||||
### GetSuffixOk
|
||||
|
||||
`func (o *DataQuery) GetSuffixOk() (*string, bool)`
|
||||
|
||||
GetSuffixOk returns a tuple with the Suffix field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetSuffix
|
||||
|
||||
`func (o *DataQuery) SetSuffix(v string)`
|
||||
|
||||
SetSuffix sets Suffix field to given value.
|
||||
|
||||
### HasSuffix
|
||||
|
||||
`func (o *DataQuery) HasSuffix() bool`
|
||||
|
||||
HasSuffix returns a boolean if a field has been set.
|
||||
|
||||
### GetText
|
||||
|
||||
`func (o *DataQuery) GetText() string`
|
||||
|
||||
GetText returns the Text field if non-nil, zero value otherwise.
|
||||
|
||||
### GetTextOk
|
||||
|
||||
`func (o *DataQuery) GetTextOk() (*string, bool)`
|
||||
|
||||
GetTextOk returns a tuple with the Text field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetText
|
||||
|
||||
`func (o *DataQuery) SetText(v string)`
|
||||
|
||||
SetText sets Text field to given value.
|
||||
|
||||
### HasText
|
||||
|
||||
`func (o *DataQuery) HasText() bool`
|
||||
|
||||
HasText returns a boolean if a field has been set.
|
||||
|
||||
### GetDate
|
||||
|
||||
`func (o *DataQuery) GetDate() time.Time`
|
||||
|
||||
GetDate returns the Date field if non-nil, zero value otherwise.
|
||||
|
||||
### GetDateOk
|
||||
|
||||
`func (o *DataQuery) GetDateOk() (*time.Time, bool)`
|
||||
|
||||
GetDateOk returns a tuple with the Date field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetDate
|
||||
|
||||
`func (o *DataQuery) SetDate(v time.Time)`
|
||||
|
||||
SetDate sets Date field to given value.
|
||||
|
||||
### HasDate
|
||||
|
||||
`func (o *DataQuery) HasDate() bool`
|
||||
|
||||
HasDate returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
268
samples/client/echo_api/go/docs/DefaultValue.md
Normal file
268
samples/client/echo_api/go/docs/DefaultValue.md
Normal file
@@ -0,0 +1,268 @@
|
||||
# DefaultValue
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**ArrayStringEnumRefDefault** | Pointer to [**[]StringEnumRef**](StringEnumRef.md) | | [optional] [default to ["success","failure"]]
|
||||
**ArrayStringEnumDefault** | Pointer to **[]string** | | [optional] [default to ["success","failure"]]
|
||||
**ArrayStringDefault** | Pointer to **[]string** | | [optional] [default to ["failure","skipped"]]
|
||||
**ArrayIntegerDefault** | Pointer to **[]int32** | | [optional] [default to [1,3]]
|
||||
**ArrayString** | Pointer to **[]string** | | [optional]
|
||||
**ArrayStringNullable** | Pointer to **[]string** | | [optional]
|
||||
**ArrayStringExtensionNullable** | Pointer to **[]string** | | [optional]
|
||||
**StringNullable** | Pointer to **NullableString** | | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewDefaultValue
|
||||
|
||||
`func NewDefaultValue() *DefaultValue`
|
||||
|
||||
NewDefaultValue instantiates a new DefaultValue object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewDefaultValueWithDefaults
|
||||
|
||||
`func NewDefaultValueWithDefaults() *DefaultValue`
|
||||
|
||||
NewDefaultValueWithDefaults instantiates a new DefaultValue object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetArrayStringEnumRefDefault
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringEnumRefDefault() []StringEnumRef`
|
||||
|
||||
GetArrayStringEnumRefDefault returns the ArrayStringEnumRefDefault field if non-nil, zero value otherwise.
|
||||
|
||||
### GetArrayStringEnumRefDefaultOk
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringEnumRefDefaultOk() (*[]StringEnumRef, bool)`
|
||||
|
||||
GetArrayStringEnumRefDefaultOk returns a tuple with the ArrayStringEnumRefDefault field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetArrayStringEnumRefDefault
|
||||
|
||||
`func (o *DefaultValue) SetArrayStringEnumRefDefault(v []StringEnumRef)`
|
||||
|
||||
SetArrayStringEnumRefDefault sets ArrayStringEnumRefDefault field to given value.
|
||||
|
||||
### HasArrayStringEnumRefDefault
|
||||
|
||||
`func (o *DefaultValue) HasArrayStringEnumRefDefault() bool`
|
||||
|
||||
HasArrayStringEnumRefDefault returns a boolean if a field has been set.
|
||||
|
||||
### GetArrayStringEnumDefault
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringEnumDefault() []string`
|
||||
|
||||
GetArrayStringEnumDefault returns the ArrayStringEnumDefault field if non-nil, zero value otherwise.
|
||||
|
||||
### GetArrayStringEnumDefaultOk
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringEnumDefaultOk() (*[]string, bool)`
|
||||
|
||||
GetArrayStringEnumDefaultOk returns a tuple with the ArrayStringEnumDefault field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetArrayStringEnumDefault
|
||||
|
||||
`func (o *DefaultValue) SetArrayStringEnumDefault(v []string)`
|
||||
|
||||
SetArrayStringEnumDefault sets ArrayStringEnumDefault field to given value.
|
||||
|
||||
### HasArrayStringEnumDefault
|
||||
|
||||
`func (o *DefaultValue) HasArrayStringEnumDefault() bool`
|
||||
|
||||
HasArrayStringEnumDefault returns a boolean if a field has been set.
|
||||
|
||||
### GetArrayStringDefault
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringDefault() []string`
|
||||
|
||||
GetArrayStringDefault returns the ArrayStringDefault field if non-nil, zero value otherwise.
|
||||
|
||||
### GetArrayStringDefaultOk
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringDefaultOk() (*[]string, bool)`
|
||||
|
||||
GetArrayStringDefaultOk returns a tuple with the ArrayStringDefault field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetArrayStringDefault
|
||||
|
||||
`func (o *DefaultValue) SetArrayStringDefault(v []string)`
|
||||
|
||||
SetArrayStringDefault sets ArrayStringDefault field to given value.
|
||||
|
||||
### HasArrayStringDefault
|
||||
|
||||
`func (o *DefaultValue) HasArrayStringDefault() bool`
|
||||
|
||||
HasArrayStringDefault returns a boolean if a field has been set.
|
||||
|
||||
### GetArrayIntegerDefault
|
||||
|
||||
`func (o *DefaultValue) GetArrayIntegerDefault() []int32`
|
||||
|
||||
GetArrayIntegerDefault returns the ArrayIntegerDefault field if non-nil, zero value otherwise.
|
||||
|
||||
### GetArrayIntegerDefaultOk
|
||||
|
||||
`func (o *DefaultValue) GetArrayIntegerDefaultOk() (*[]int32, bool)`
|
||||
|
||||
GetArrayIntegerDefaultOk returns a tuple with the ArrayIntegerDefault field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetArrayIntegerDefault
|
||||
|
||||
`func (o *DefaultValue) SetArrayIntegerDefault(v []int32)`
|
||||
|
||||
SetArrayIntegerDefault sets ArrayIntegerDefault field to given value.
|
||||
|
||||
### HasArrayIntegerDefault
|
||||
|
||||
`func (o *DefaultValue) HasArrayIntegerDefault() bool`
|
||||
|
||||
HasArrayIntegerDefault returns a boolean if a field has been set.
|
||||
|
||||
### GetArrayString
|
||||
|
||||
`func (o *DefaultValue) GetArrayString() []string`
|
||||
|
||||
GetArrayString returns the ArrayString field if non-nil, zero value otherwise.
|
||||
|
||||
### GetArrayStringOk
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringOk() (*[]string, bool)`
|
||||
|
||||
GetArrayStringOk returns a tuple with the ArrayString field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetArrayString
|
||||
|
||||
`func (o *DefaultValue) SetArrayString(v []string)`
|
||||
|
||||
SetArrayString sets ArrayString field to given value.
|
||||
|
||||
### HasArrayString
|
||||
|
||||
`func (o *DefaultValue) HasArrayString() bool`
|
||||
|
||||
HasArrayString returns a boolean if a field has been set.
|
||||
|
||||
### GetArrayStringNullable
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringNullable() []string`
|
||||
|
||||
GetArrayStringNullable returns the ArrayStringNullable field if non-nil, zero value otherwise.
|
||||
|
||||
### GetArrayStringNullableOk
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringNullableOk() (*[]string, bool)`
|
||||
|
||||
GetArrayStringNullableOk returns a tuple with the ArrayStringNullable field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetArrayStringNullable
|
||||
|
||||
`func (o *DefaultValue) SetArrayStringNullable(v []string)`
|
||||
|
||||
SetArrayStringNullable sets ArrayStringNullable field to given value.
|
||||
|
||||
### HasArrayStringNullable
|
||||
|
||||
`func (o *DefaultValue) HasArrayStringNullable() bool`
|
||||
|
||||
HasArrayStringNullable returns a boolean if a field has been set.
|
||||
|
||||
### SetArrayStringNullableNil
|
||||
|
||||
`func (o *DefaultValue) SetArrayStringNullableNil(b bool)`
|
||||
|
||||
SetArrayStringNullableNil sets the value for ArrayStringNullable to be an explicit nil
|
||||
|
||||
### UnsetArrayStringNullable
|
||||
`func (o *DefaultValue) UnsetArrayStringNullable()`
|
||||
|
||||
UnsetArrayStringNullable ensures that no value is present for ArrayStringNullable, not even an explicit nil
|
||||
### GetArrayStringExtensionNullable
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringExtensionNullable() []string`
|
||||
|
||||
GetArrayStringExtensionNullable returns the ArrayStringExtensionNullable field if non-nil, zero value otherwise.
|
||||
|
||||
### GetArrayStringExtensionNullableOk
|
||||
|
||||
`func (o *DefaultValue) GetArrayStringExtensionNullableOk() (*[]string, bool)`
|
||||
|
||||
GetArrayStringExtensionNullableOk returns a tuple with the ArrayStringExtensionNullable field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetArrayStringExtensionNullable
|
||||
|
||||
`func (o *DefaultValue) SetArrayStringExtensionNullable(v []string)`
|
||||
|
||||
SetArrayStringExtensionNullable sets ArrayStringExtensionNullable field to given value.
|
||||
|
||||
### HasArrayStringExtensionNullable
|
||||
|
||||
`func (o *DefaultValue) HasArrayStringExtensionNullable() bool`
|
||||
|
||||
HasArrayStringExtensionNullable returns a boolean if a field has been set.
|
||||
|
||||
### SetArrayStringExtensionNullableNil
|
||||
|
||||
`func (o *DefaultValue) SetArrayStringExtensionNullableNil(b bool)`
|
||||
|
||||
SetArrayStringExtensionNullableNil sets the value for ArrayStringExtensionNullable to be an explicit nil
|
||||
|
||||
### UnsetArrayStringExtensionNullable
|
||||
`func (o *DefaultValue) UnsetArrayStringExtensionNullable()`
|
||||
|
||||
UnsetArrayStringExtensionNullable ensures that no value is present for ArrayStringExtensionNullable, not even an explicit nil
|
||||
### GetStringNullable
|
||||
|
||||
`func (o *DefaultValue) GetStringNullable() string`
|
||||
|
||||
GetStringNullable returns the StringNullable field if non-nil, zero value otherwise.
|
||||
|
||||
### GetStringNullableOk
|
||||
|
||||
`func (o *DefaultValue) GetStringNullableOk() (*string, bool)`
|
||||
|
||||
GetStringNullableOk returns a tuple with the StringNullable field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetStringNullable
|
||||
|
||||
`func (o *DefaultValue) SetStringNullable(v string)`
|
||||
|
||||
SetStringNullable sets StringNullable field to given value.
|
||||
|
||||
### HasStringNullable
|
||||
|
||||
`func (o *DefaultValue) HasStringNullable() bool`
|
||||
|
||||
HasStringNullable returns a boolean if a field has been set.
|
||||
|
||||
### SetStringNullableNil
|
||||
|
||||
`func (o *DefaultValue) SetStringNullableNil(b bool)`
|
||||
|
||||
SetStringNullableNil sets the value for StringNullable to be an explicit nil
|
||||
|
||||
### UnsetStringNullable
|
||||
`func (o *DefaultValue) UnsetStringNullable()`
|
||||
|
||||
UnsetStringNullable ensures that no value is present for StringNullable, not even an explicit nil
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
156
samples/client/echo_api/go/docs/FormAPI.md
Normal file
156
samples/client/echo_api/go/docs/FormAPI.md
Normal file
@@ -0,0 +1,156 @@
|
||||
# \FormAPI
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**TestFormIntegerBooleanString**](FormAPI.md#TestFormIntegerBooleanString) | **Post** /form/integer/boolean/string | Test form parameter(s)
|
||||
[**TestFormOneof**](FormAPI.md#TestFormOneof) | **Post** /form/oneof | Test form parameter(s) for oneOf schema
|
||||
|
||||
|
||||
|
||||
## TestFormIntegerBooleanString
|
||||
|
||||
> string TestFormIntegerBooleanString(ctx).IntegerForm(integerForm).BooleanForm(booleanForm).StringForm(stringForm).Execute()
|
||||
|
||||
Test form parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
integerForm := int32(56) // int32 | (optional)
|
||||
booleanForm := true // bool | (optional)
|
||||
stringForm := "stringForm_example" // string | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.FormAPI.TestFormIntegerBooleanString(context.Background()).IntegerForm(integerForm).BooleanForm(booleanForm).StringForm(stringForm).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `FormAPI.TestFormIntegerBooleanString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestFormIntegerBooleanString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `FormAPI.TestFormIntegerBooleanString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestFormIntegerBooleanStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**integerForm** | **int32** | |
|
||||
**booleanForm** | **bool** | |
|
||||
**stringForm** | **string** | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestFormOneof
|
||||
|
||||
> string TestFormOneof(ctx).Form1(form1).Form2(form2).Form3(form3).Form4(form4).Id(id).Name(name).Execute()
|
||||
|
||||
Test form parameter(s) for oneOf schema
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
form1 := "form1_example" // string | (optional)
|
||||
form2 := int32(56) // int32 | (optional)
|
||||
form3 := "form3_example" // string | (optional)
|
||||
form4 := true // bool | (optional)
|
||||
id := int64(789) // int64 | (optional)
|
||||
name := "name_example" // string | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.FormAPI.TestFormOneof(context.Background()).Form1(form1).Form2(form2).Form3(form3).Form4(form4).Id(id).Name(name).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `FormAPI.TestFormOneof``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestFormOneof`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `FormAPI.TestFormOneof`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestFormOneofRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**form1** | **string** | |
|
||||
**form2** | **int32** | |
|
||||
**form3** | **string** | |
|
||||
**form4** | **bool** | |
|
||||
**id** | **int64** | |
|
||||
**name** | **string** | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
79
samples/client/echo_api/go/docs/HeaderAPI.md
Normal file
79
samples/client/echo_api/go/docs/HeaderAPI.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# \HeaderAPI
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**TestHeaderIntegerBooleanString**](HeaderAPI.md#TestHeaderIntegerBooleanString) | **Get** /header/integer/boolean/string | Test header parameter(s)
|
||||
|
||||
|
||||
|
||||
## TestHeaderIntegerBooleanString
|
||||
|
||||
> string TestHeaderIntegerBooleanString(ctx).IntegerHeader(integerHeader).BooleanHeader(booleanHeader).StringHeader(stringHeader).Execute()
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
integerHeader := int32(56) // int32 | (optional)
|
||||
booleanHeader := true // bool | (optional)
|
||||
stringHeader := "stringHeader_example" // string | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.HeaderAPI.TestHeaderIntegerBooleanString(context.Background()).IntegerHeader(integerHeader).BooleanHeader(booleanHeader).StringHeader(stringHeader).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `HeaderAPI.TestHeaderIntegerBooleanString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestHeaderIntegerBooleanString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `HeaderAPI.TestHeaderIntegerBooleanString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestHeaderIntegerBooleanStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**integerHeader** | **int32** | |
|
||||
**booleanHeader** | **bool** | |
|
||||
**stringHeader** | **string** | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
108
samples/client/echo_api/go/docs/NumberPropertiesOnly.md
Normal file
108
samples/client/echo_api/go/docs/NumberPropertiesOnly.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# NumberPropertiesOnly
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Number** | Pointer to **float32** | | [optional]
|
||||
**Float** | Pointer to **float32** | | [optional]
|
||||
**Double** | Pointer to **float64** | | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewNumberPropertiesOnly
|
||||
|
||||
`func NewNumberPropertiesOnly() *NumberPropertiesOnly`
|
||||
|
||||
NewNumberPropertiesOnly instantiates a new NumberPropertiesOnly object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewNumberPropertiesOnlyWithDefaults
|
||||
|
||||
`func NewNumberPropertiesOnlyWithDefaults() *NumberPropertiesOnly`
|
||||
|
||||
NewNumberPropertiesOnlyWithDefaults instantiates a new NumberPropertiesOnly object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetNumber
|
||||
|
||||
`func (o *NumberPropertiesOnly) GetNumber() float32`
|
||||
|
||||
GetNumber returns the Number field if non-nil, zero value otherwise.
|
||||
|
||||
### GetNumberOk
|
||||
|
||||
`func (o *NumberPropertiesOnly) GetNumberOk() (*float32, bool)`
|
||||
|
||||
GetNumberOk returns a tuple with the Number field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetNumber
|
||||
|
||||
`func (o *NumberPropertiesOnly) SetNumber(v float32)`
|
||||
|
||||
SetNumber sets Number field to given value.
|
||||
|
||||
### HasNumber
|
||||
|
||||
`func (o *NumberPropertiesOnly) HasNumber() bool`
|
||||
|
||||
HasNumber returns a boolean if a field has been set.
|
||||
|
||||
### GetFloat
|
||||
|
||||
`func (o *NumberPropertiesOnly) GetFloat() float32`
|
||||
|
||||
GetFloat returns the Float field if non-nil, zero value otherwise.
|
||||
|
||||
### GetFloatOk
|
||||
|
||||
`func (o *NumberPropertiesOnly) GetFloatOk() (*float32, bool)`
|
||||
|
||||
GetFloatOk returns a tuple with the Float field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetFloat
|
||||
|
||||
`func (o *NumberPropertiesOnly) SetFloat(v float32)`
|
||||
|
||||
SetFloat sets Float field to given value.
|
||||
|
||||
### HasFloat
|
||||
|
||||
`func (o *NumberPropertiesOnly) HasFloat() bool`
|
||||
|
||||
HasFloat returns a boolean if a field has been set.
|
||||
|
||||
### GetDouble
|
||||
|
||||
`func (o *NumberPropertiesOnly) GetDouble() float64`
|
||||
|
||||
GetDouble returns the Double field if non-nil, zero value otherwise.
|
||||
|
||||
### GetDoubleOk
|
||||
|
||||
`func (o *NumberPropertiesOnly) GetDoubleOk() (*float64, bool)`
|
||||
|
||||
GetDoubleOk returns a tuple with the Double field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetDouble
|
||||
|
||||
`func (o *NumberPropertiesOnly) SetDouble(v float64)`
|
||||
|
||||
SetDouble sets Double field to given value.
|
||||
|
||||
### HasDouble
|
||||
|
||||
`func (o *NumberPropertiesOnly) HasDouble() bool`
|
||||
|
||||
HasDouble returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
82
samples/client/echo_api/go/docs/PathAPI.md
Normal file
82
samples/client/echo_api/go/docs/PathAPI.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# \PathAPI
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**TestsPathStringPathStringIntegerPathInteger**](PathAPI.md#TestsPathStringPathStringIntegerPathInteger) | **Get** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||
|
||||
|
||||
|
||||
## TestsPathStringPathStringIntegerPathInteger
|
||||
|
||||
> string TestsPathStringPathStringIntegerPathInteger(ctx, pathString, pathInteger).Execute()
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
pathString := "pathString_example" // string |
|
||||
pathInteger := int32(56) // int32 |
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.PathAPI.TestsPathStringPathStringIntegerPathInteger(context.Background(), pathString, pathInteger).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `PathAPI.TestsPathStringPathStringIntegerPathInteger``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestsPathStringPathStringIntegerPathInteger`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `PathAPI.TestsPathStringPathStringIntegerPathInteger`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**pathString** | **string** | |
|
||||
**pathInteger** | **int32** | |
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestsPathStringPathStringIntegerPathIntegerRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
176
samples/client/echo_api/go/docs/Pet.md
Normal file
176
samples/client/echo_api/go/docs/Pet.md
Normal file
@@ -0,0 +1,176 @@
|
||||
# Pet
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Id** | Pointer to **int64** | | [optional]
|
||||
**Name** | **string** | |
|
||||
**Category** | Pointer to [**Category**](Category.md) | | [optional]
|
||||
**PhotoUrls** | **[]string** | |
|
||||
**Tags** | Pointer to [**[]Tag**](Tag.md) | | [optional]
|
||||
**Status** | Pointer to **string** | pet status in the store | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewPet
|
||||
|
||||
`func NewPet(name string, photoUrls []string, ) *Pet`
|
||||
|
||||
NewPet instantiates a new Pet object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewPetWithDefaults
|
||||
|
||||
`func NewPetWithDefaults() *Pet`
|
||||
|
||||
NewPetWithDefaults instantiates a new Pet object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetId
|
||||
|
||||
`func (o *Pet) GetId() int64`
|
||||
|
||||
GetId returns the Id field if non-nil, zero value otherwise.
|
||||
|
||||
### GetIdOk
|
||||
|
||||
`func (o *Pet) GetIdOk() (*int64, bool)`
|
||||
|
||||
GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetId
|
||||
|
||||
`func (o *Pet) SetId(v int64)`
|
||||
|
||||
SetId sets Id field to given value.
|
||||
|
||||
### HasId
|
||||
|
||||
`func (o *Pet) HasId() bool`
|
||||
|
||||
HasId returns a boolean if a field has been set.
|
||||
|
||||
### GetName
|
||||
|
||||
`func (o *Pet) GetName() string`
|
||||
|
||||
GetName returns the Name field if non-nil, zero value otherwise.
|
||||
|
||||
### GetNameOk
|
||||
|
||||
`func (o *Pet) GetNameOk() (*string, bool)`
|
||||
|
||||
GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetName
|
||||
|
||||
`func (o *Pet) SetName(v string)`
|
||||
|
||||
SetName sets Name field to given value.
|
||||
|
||||
|
||||
### GetCategory
|
||||
|
||||
`func (o *Pet) GetCategory() Category`
|
||||
|
||||
GetCategory returns the Category field if non-nil, zero value otherwise.
|
||||
|
||||
### GetCategoryOk
|
||||
|
||||
`func (o *Pet) GetCategoryOk() (*Category, bool)`
|
||||
|
||||
GetCategoryOk returns a tuple with the Category field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetCategory
|
||||
|
||||
`func (o *Pet) SetCategory(v Category)`
|
||||
|
||||
SetCategory sets Category field to given value.
|
||||
|
||||
### HasCategory
|
||||
|
||||
`func (o *Pet) HasCategory() bool`
|
||||
|
||||
HasCategory returns a boolean if a field has been set.
|
||||
|
||||
### GetPhotoUrls
|
||||
|
||||
`func (o *Pet) GetPhotoUrls() []string`
|
||||
|
||||
GetPhotoUrls returns the PhotoUrls field if non-nil, zero value otherwise.
|
||||
|
||||
### GetPhotoUrlsOk
|
||||
|
||||
`func (o *Pet) GetPhotoUrlsOk() (*[]string, bool)`
|
||||
|
||||
GetPhotoUrlsOk returns a tuple with the PhotoUrls field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetPhotoUrls
|
||||
|
||||
`func (o *Pet) SetPhotoUrls(v []string)`
|
||||
|
||||
SetPhotoUrls sets PhotoUrls field to given value.
|
||||
|
||||
|
||||
### GetTags
|
||||
|
||||
`func (o *Pet) GetTags() []Tag`
|
||||
|
||||
GetTags returns the Tags field if non-nil, zero value otherwise.
|
||||
|
||||
### GetTagsOk
|
||||
|
||||
`func (o *Pet) GetTagsOk() (*[]Tag, bool)`
|
||||
|
||||
GetTagsOk returns a tuple with the Tags field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetTags
|
||||
|
||||
`func (o *Pet) SetTags(v []Tag)`
|
||||
|
||||
SetTags sets Tags field to given value.
|
||||
|
||||
### HasTags
|
||||
|
||||
`func (o *Pet) HasTags() bool`
|
||||
|
||||
HasTags returns a boolean if a field has been set.
|
||||
|
||||
### GetStatus
|
||||
|
||||
`func (o *Pet) GetStatus() string`
|
||||
|
||||
GetStatus returns the Status field if non-nil, zero value otherwise.
|
||||
|
||||
### GetStatusOk
|
||||
|
||||
`func (o *Pet) GetStatusOk() (*string, bool)`
|
||||
|
||||
GetStatusOk returns a tuple with the Status field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetStatus
|
||||
|
||||
`func (o *Pet) SetStatus(v string)`
|
||||
|
||||
SetStatus sets Status field to given value.
|
||||
|
||||
### HasStatus
|
||||
|
||||
`func (o *Pet) HasStatus() bool`
|
||||
|
||||
HasStatus returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
82
samples/client/echo_api/go/docs/Query.md
Normal file
82
samples/client/echo_api/go/docs/Query.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Query
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Id** | Pointer to **int64** | Query | [optional]
|
||||
**Outcomes** | Pointer to **[]string** | | [optional] [default to ["SUCCESS","FAILURE"]]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewQuery
|
||||
|
||||
`func NewQuery() *Query`
|
||||
|
||||
NewQuery instantiates a new Query object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewQueryWithDefaults
|
||||
|
||||
`func NewQueryWithDefaults() *Query`
|
||||
|
||||
NewQueryWithDefaults instantiates a new Query object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetId
|
||||
|
||||
`func (o *Query) GetId() int64`
|
||||
|
||||
GetId returns the Id field if non-nil, zero value otherwise.
|
||||
|
||||
### GetIdOk
|
||||
|
||||
`func (o *Query) GetIdOk() (*int64, bool)`
|
||||
|
||||
GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetId
|
||||
|
||||
`func (o *Query) SetId(v int64)`
|
||||
|
||||
SetId sets Id field to given value.
|
||||
|
||||
### HasId
|
||||
|
||||
`func (o *Query) HasId() bool`
|
||||
|
||||
HasId returns a boolean if a field has been set.
|
||||
|
||||
### GetOutcomes
|
||||
|
||||
`func (o *Query) GetOutcomes() []string`
|
||||
|
||||
GetOutcomes returns the Outcomes field if non-nil, zero value otherwise.
|
||||
|
||||
### GetOutcomesOk
|
||||
|
||||
`func (o *Query) GetOutcomesOk() (*[]string, bool)`
|
||||
|
||||
GetOutcomesOk returns a tuple with the Outcomes field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetOutcomes
|
||||
|
||||
`func (o *Query) SetOutcomes(v []string)`
|
||||
|
||||
SetOutcomes sets Outcomes field to given value.
|
||||
|
||||
### HasOutcomes
|
||||
|
||||
`func (o *Query) HasOutcomes() bool`
|
||||
|
||||
HasOutcomes returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
553
samples/client/echo_api/go/docs/QueryAPI.md
Normal file
553
samples/client/echo_api/go/docs/QueryAPI.md
Normal file
@@ -0,0 +1,553 @@
|
||||
# \QueryAPI
|
||||
|
||||
All URIs are relative to *http://localhost:3000*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**TestEnumRefString**](QueryAPI.md#TestEnumRefString) | **Get** /query/enum_ref_string | Test query parameter(s)
|
||||
[**TestQueryDatetimeDateString**](QueryAPI.md#TestQueryDatetimeDateString) | **Get** /query/datetime/date/string | Test query parameter(s)
|
||||
[**TestQueryIntegerBooleanString**](QueryAPI.md#TestQueryIntegerBooleanString) | **Get** /query/integer/boolean/string | Test query parameter(s)
|
||||
[**TestQueryStyleDeepObjectExplodeTrueObject**](QueryAPI.md#TestQueryStyleDeepObjectExplodeTrueObject) | **Get** /query/style_deepObject/explode_true/object | Test query parameter(s)
|
||||
[**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryAPI.md#TestQueryStyleDeepObjectExplodeTrueObjectAllOf) | **Get** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeTrueArrayString**](QueryAPI.md#TestQueryStyleFormExplodeTrueArrayString) | **Get** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeTrueObject**](QueryAPI.md#TestQueryStyleFormExplodeTrueObject) | **Get** /query/style_form/explode_true/object | Test query parameter(s)
|
||||
[**TestQueryStyleFormExplodeTrueObjectAllOf**](QueryAPI.md#TestQueryStyleFormExplodeTrueObjectAllOf) | **Get** /query/style_form/explode_true/object/allOf | Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
## TestEnumRefString
|
||||
|
||||
> string TestEnumRefString(ctx).EnumRefStringQuery(enumRefStringQuery).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
enumRefStringQuery := openapiclient.StringEnumRef("success") // StringEnumRef | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestEnumRefString(context.Background()).EnumRefStringQuery(enumRefStringQuery).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestEnumRefString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestEnumRefString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestEnumRefString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestEnumRefStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enumRefStringQuery** | [**StringEnumRef**](StringEnumRef.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestQueryDatetimeDateString
|
||||
|
||||
> string TestQueryDatetimeDateString(ctx).DatetimeQuery(datetimeQuery).DateQuery(dateQuery).StringQuery(stringQuery).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
datetimeQuery := time.Now() // time.Time | (optional)
|
||||
dateQuery := time.Now() // string | (optional)
|
||||
stringQuery := "stringQuery_example" // string | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestQueryDatetimeDateString(context.Background()).DatetimeQuery(datetimeQuery).DateQuery(dateQuery).StringQuery(stringQuery).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryDatetimeDateString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestQueryDatetimeDateString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryDatetimeDateString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestQueryDatetimeDateStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**datetimeQuery** | **time.Time** | |
|
||||
**dateQuery** | **string** | |
|
||||
**stringQuery** | **string** | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestQueryIntegerBooleanString
|
||||
|
||||
> string TestQueryIntegerBooleanString(ctx).IntegerQuery(integerQuery).BooleanQuery(booleanQuery).StringQuery(stringQuery).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
integerQuery := int32(56) // int32 | (optional)
|
||||
booleanQuery := true // bool | (optional)
|
||||
stringQuery := "stringQuery_example" // string | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestQueryIntegerBooleanString(context.Background()).IntegerQuery(integerQuery).BooleanQuery(booleanQuery).StringQuery(stringQuery).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryIntegerBooleanString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestQueryIntegerBooleanString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryIntegerBooleanString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestQueryIntegerBooleanStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**integerQuery** | **int32** | |
|
||||
**booleanQuery** | **bool** | |
|
||||
**stringQuery** | **string** | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestQueryStyleDeepObjectExplodeTrueObject
|
||||
|
||||
> string TestQueryStyleDeepObjectExplodeTrueObject(ctx).QueryObject(queryObject).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
queryObject := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestQueryStyleDeepObjectExplodeTrueObject(context.Background()).QueryObject(queryObject).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObject``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestQueryStyleDeepObjectExplodeTrueObject`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObject`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestQueryStyleDeepObjectExplodeTrueObjectRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**queryObject** | [**Pet**](Pet.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestQueryStyleDeepObjectExplodeTrueObjectAllOf
|
||||
|
||||
> string TestQueryStyleDeepObjectExplodeTrueObjectAllOf(ctx).QueryObject(queryObject).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
queryObject := *openapiclient.NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() // TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestQueryStyleDeepObjectExplodeTrueObjectAllOf(context.Background()).QueryObject(queryObject).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObjectAllOf``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestQueryStyleDeepObjectExplodeTrueObjectAllOf`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleDeepObjectExplodeTrueObjectAllOf`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestQueryStyleDeepObjectExplodeTrueObjectAllOfRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**queryObject** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestQueryStyleFormExplodeTrueArrayString
|
||||
|
||||
> string TestQueryStyleFormExplodeTrueArrayString(ctx).QueryObject(queryObject).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
queryObject := *openapiclient.NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueArrayString(context.Background()).QueryObject(queryObject).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeTrueArrayString``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestQueryStyleFormExplodeTrueArrayString`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeTrueArrayString`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeTrueArrayStringRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestQueryStyleFormExplodeTrueObject
|
||||
|
||||
> string TestQueryStyleFormExplodeTrueObject(ctx).QueryObject(queryObject).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
queryObject := *openapiclient.NewPet("doggie", []string{"PhotoUrls_example"}) // Pet | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueObject(context.Background()).QueryObject(queryObject).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeTrueObject``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestQueryStyleFormExplodeTrueObject`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeTrueObject`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeTrueObjectRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**queryObject** | [**Pet**](Pet.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## TestQueryStyleFormExplodeTrueObjectAllOf
|
||||
|
||||
> string TestQueryStyleFormExplodeTrueObjectAllOf(ctx).QueryObject(queryObject).Execute()
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
|
||||
)
|
||||
|
||||
func main() {
|
||||
queryObject := *openapiclient.NewDataQuery() // DataQuery | (optional)
|
||||
|
||||
configuration := openapiclient.NewConfiguration()
|
||||
apiClient := openapiclient.NewAPIClient(configuration)
|
||||
resp, r, err := apiClient.QueryAPI.TestQueryStyleFormExplodeTrueObjectAllOf(context.Background()).QueryObject(queryObject).Execute()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error when calling `QueryAPI.TestQueryStyleFormExplodeTrueObjectAllOf``: %v\n", err)
|
||||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
|
||||
}
|
||||
// response from `TestQueryStyleFormExplodeTrueObjectAllOf`: string
|
||||
fmt.Fprintf(os.Stdout, "Response from `QueryAPI.TestQueryStyleFormExplodeTrueObjectAllOf`: %v\n", resp)
|
||||
}
|
||||
```
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
|
||||
### Other Parameters
|
||||
|
||||
Other parameters are passed through a pointer to a apiTestQueryStyleFormExplodeTrueObjectAllOfRequest struct via the builder pattern
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**queryObject** | [**DataQuery**](DataQuery.md) | |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: text/plain
|
||||
|
||||
[[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)
|
||||
|
||||
15
samples/client/echo_api/go/docs/StringEnumRef.md
Normal file
15
samples/client/echo_api/go/docs/StringEnumRef.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# StringEnumRef
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `SUCCESS` (value: `"success"`)
|
||||
|
||||
* `FAILURE` (value: `"failure"`)
|
||||
|
||||
* `UNCLASSIFIED` (value: `"unclassified"`)
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
82
samples/client/echo_api/go/docs/Tag.md
Normal file
82
samples/client/echo_api/go/docs/Tag.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# Tag
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Id** | Pointer to **int64** | | [optional]
|
||||
**Name** | Pointer to **string** | | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewTag
|
||||
|
||||
`func NewTag() *Tag`
|
||||
|
||||
NewTag instantiates a new Tag object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewTagWithDefaults
|
||||
|
||||
`func NewTagWithDefaults() *Tag`
|
||||
|
||||
NewTagWithDefaults instantiates a new Tag object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetId
|
||||
|
||||
`func (o *Tag) GetId() int64`
|
||||
|
||||
GetId returns the Id field if non-nil, zero value otherwise.
|
||||
|
||||
### GetIdOk
|
||||
|
||||
`func (o *Tag) GetIdOk() (*int64, bool)`
|
||||
|
||||
GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetId
|
||||
|
||||
`func (o *Tag) SetId(v int64)`
|
||||
|
||||
SetId sets Id field to given value.
|
||||
|
||||
### HasId
|
||||
|
||||
`func (o *Tag) HasId() bool`
|
||||
|
||||
HasId returns a boolean if a field has been set.
|
||||
|
||||
### GetName
|
||||
|
||||
`func (o *Tag) GetName() string`
|
||||
|
||||
GetName returns the Name field if non-nil, zero value otherwise.
|
||||
|
||||
### GetNameOk
|
||||
|
||||
`func (o *Tag) GetNameOk() (*string, bool)`
|
||||
|
||||
GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetName
|
||||
|
||||
`func (o *Tag) SetName(v string)`
|
||||
|
||||
SetName sets Name field to given value.
|
||||
|
||||
### HasName
|
||||
|
||||
`func (o *Tag) HasName() bool`
|
||||
|
||||
HasName returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Size** | Pointer to **string** | | [optional]
|
||||
**Color** | Pointer to **string** | | [optional]
|
||||
**Id** | Pointer to **int64** | | [optional]
|
||||
**Name** | Pointer to **string** | | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
|
||||
|
||||
`func NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`
|
||||
|
||||
NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter instantiates a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults
|
||||
|
||||
`func NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults() *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`
|
||||
|
||||
NewTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterWithDefaults instantiates a new TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetSize
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetSize() string`
|
||||
|
||||
GetSize returns the Size field if non-nil, zero value otherwise.
|
||||
|
||||
### GetSizeOk
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetSizeOk() (*string, bool)`
|
||||
|
||||
GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetSize
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetSize(v string)`
|
||||
|
||||
SetSize sets Size field to given value.
|
||||
|
||||
### HasSize
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasSize() bool`
|
||||
|
||||
HasSize returns a boolean if a field has been set.
|
||||
|
||||
### GetColor
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetColor() string`
|
||||
|
||||
GetColor returns the Color field if non-nil, zero value otherwise.
|
||||
|
||||
### GetColorOk
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetColorOk() (*string, bool)`
|
||||
|
||||
GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetColor
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetColor(v string)`
|
||||
|
||||
SetColor sets Color field to given value.
|
||||
|
||||
### HasColor
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasColor() bool`
|
||||
|
||||
HasColor returns a boolean if a field has been set.
|
||||
|
||||
### GetId
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetId() int64`
|
||||
|
||||
GetId returns the Id field if non-nil, zero value otherwise.
|
||||
|
||||
### GetIdOk
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetIdOk() (*int64, bool)`
|
||||
|
||||
GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetId
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetId(v int64)`
|
||||
|
||||
SetId sets Id field to given value.
|
||||
|
||||
### HasId
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasId() bool`
|
||||
|
||||
HasId returns a boolean if a field has been set.
|
||||
|
||||
### GetName
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetName() string`
|
||||
|
||||
GetName returns the Name field if non-nil, zero value otherwise.
|
||||
|
||||
### GetNameOk
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) GetNameOk() (*string, bool)`
|
||||
|
||||
GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetName
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) SetName(v string)`
|
||||
|
||||
SetName sets Name field to given value.
|
||||
|
||||
### HasName
|
||||
|
||||
`func (o *TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) HasName() bool`
|
||||
|
||||
HasName returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Values** | Pointer to **[]string** | | [optional]
|
||||
|
||||
## Methods
|
||||
|
||||
### NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||
|
||||
`func NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`
|
||||
|
||||
NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter instantiates a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object
|
||||
This constructor will assign default values to properties that have it defined,
|
||||
and makes sure properties required by API are set, but the set of arguments
|
||||
will change when the set of required properties is changed
|
||||
|
||||
### NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults
|
||||
|
||||
`func NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults() *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`
|
||||
|
||||
NewTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterWithDefaults instantiates a new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object
|
||||
This constructor will only assign default values to properties that have it defined,
|
||||
but it doesn't guarantee that properties required by API are set
|
||||
|
||||
### GetValues
|
||||
|
||||
`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) GetValues() []string`
|
||||
|
||||
GetValues returns the Values field if non-nil, zero value otherwise.
|
||||
|
||||
### GetValuesOk
|
||||
|
||||
`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) GetValuesOk() (*[]string, bool)`
|
||||
|
||||
GetValuesOk returns a tuple with the Values field if it's non-nil, zero value otherwise
|
||||
and a boolean to check if the value has been set.
|
||||
|
||||
### SetValues
|
||||
|
||||
`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) SetValues(v []string)`
|
||||
|
||||
SetValues sets Values field to given value.
|
||||
|
||||
### HasValues
|
||||
|
||||
`func (o *TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) HasValues() bool`
|
||||
|
||||
HasValues returns a boolean if a field has been set.
|
||||
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
57
samples/client/echo_api/go/git_push.sh
Normal file
57
samples/client/echo_api/go/git_push.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_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'
|
||||
6
samples/client/echo_api/go/go.mod
Normal file
6
samples/client/echo_api/go/go.mod
Normal file
@@ -0,0 +1,6 @@
|
||||
module github.com/GIT_USER_ID/GIT_REPO_ID
|
||||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
)
|
||||
11
samples/client/echo_api/go/go.sum
Normal file
11
samples/client/echo_api/go/go.sum
Normal file
@@ -0,0 +1,11 @@
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
163
samples/client/echo_api/go/model_bird.go
Normal file
163
samples/client/echo_api/go/model_bird.go
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Bird type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Bird{}
|
||||
|
||||
// Bird struct for Bird
|
||||
type Bird struct {
|
||||
Size *string `json:"size,omitempty"`
|
||||
Color *string `json:"color,omitempty"`
|
||||
}
|
||||
|
||||
// NewBird instantiates a new Bird object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewBird() *Bird {
|
||||
this := Bird{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewBirdWithDefaults instantiates a new Bird object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewBirdWithDefaults() *Bird {
|
||||
this := Bird{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetSize returns the Size field value if set, zero value otherwise.
|
||||
func (o *Bird) GetSize() string {
|
||||
if o == nil || IsNil(o.Size) {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.Size
|
||||
}
|
||||
|
||||
// GetSizeOk returns a tuple with the Size field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Bird) GetSizeOk() (*string, bool) {
|
||||
if o == nil || IsNil(o.Size) {
|
||||
return nil, false
|
||||
}
|
||||
return o.Size, true
|
||||
}
|
||||
|
||||
// HasSize returns a boolean if a field has been set.
|
||||
func (o *Bird) HasSize() bool {
|
||||
if o != nil && !IsNil(o.Size) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetSize gets a reference to the given string and assigns it to the Size field.
|
||||
func (o *Bird) SetSize(v string) {
|
||||
o.Size = &v
|
||||
}
|
||||
|
||||
// GetColor returns the Color field value if set, zero value otherwise.
|
||||
func (o *Bird) GetColor() string {
|
||||
if o == nil || IsNil(o.Color) {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.Color
|
||||
}
|
||||
|
||||
// GetColorOk returns a tuple with the Color field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Bird) GetColorOk() (*string, bool) {
|
||||
if o == nil || IsNil(o.Color) {
|
||||
return nil, false
|
||||
}
|
||||
return o.Color, true
|
||||
}
|
||||
|
||||
// HasColor returns a boolean if a field has been set.
|
||||
func (o *Bird) HasColor() bool {
|
||||
if o != nil && !IsNil(o.Color) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetColor gets a reference to the given string and assigns it to the Color field.
|
||||
func (o *Bird) SetColor(v string) {
|
||||
o.Color = &v
|
||||
}
|
||||
|
||||
func (o Bird) MarshalJSON() ([]byte, error) {
|
||||
toSerialize,err := o.ToMap()
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
func (o Bird) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if !IsNil(o.Size) {
|
||||
toSerialize["size"] = o.Size
|
||||
}
|
||||
if !IsNil(o.Color) {
|
||||
toSerialize["color"] = o.Color
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableBird struct {
|
||||
value *Bird
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableBird) Get() *Bird {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableBird) Set(val *Bird) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableBird) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableBird) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableBird(val *Bird) *NullableBird {
|
||||
return &NullableBird{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableBird) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableBird) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
163
samples/client/echo_api/go/model_category.go
Normal file
163
samples/client/echo_api/go/model_category.go
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
Echo Server API
|
||||
|
||||
Echo Server API
|
||||
|
||||
API version: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Category type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Category{}
|
||||
|
||||
// Category struct for Category
|
||||
type Category struct {
|
||||
Id *int64 `json:"id,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// NewCategory instantiates a new Category object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewCategory() *Category {
|
||||
this := Category{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCategoryWithDefaults instantiates a new Category object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewCategoryWithDefaults() *Category {
|
||||
this := Category{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetId returns the Id field value if set, zero value otherwise.
|
||||
func (o *Category) GetId() int64 {
|
||||
if o == nil || IsNil(o.Id) {
|
||||
var ret int64
|
||||
return ret
|
||||
}
|
||||
return *o.Id
|
||||
}
|
||||
|
||||
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Category) GetIdOk() (*int64, bool) {
|
||||
if o == nil || IsNil(o.Id) {
|
||||
return nil, false
|
||||
}
|
||||
return o.Id, true
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
func (o *Category) HasId() bool {
|
||||
if o != nil && !IsNil(o.Id) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetId gets a reference to the given int64 and assigns it to the Id field.
|
||||
func (o *Category) SetId(v int64) {
|
||||
o.Id = &v
|
||||
}
|
||||
|
||||
// GetName returns the Name field value if set, zero value otherwise.
|
||||
func (o *Category) GetName() string {
|
||||
if o == nil || IsNil(o.Name) {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.Name
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Category) GetNameOk() (*string, bool) {
|
||||
if o == nil || IsNil(o.Name) {
|
||||
return nil, false
|
||||
}
|
||||
return o.Name, true
|
||||
}
|
||||
|
||||
// HasName returns a boolean if a field has been set.
|
||||
func (o *Category) HasName() bool {
|
||||
if o != nil && !IsNil(o.Name) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetName gets a reference to the given string and assigns it to the Name field.
|
||||
func (o *Category) SetName(v string) {
|
||||
o.Name = &v
|
||||
}
|
||||
|
||||
func (o Category) MarshalJSON() ([]byte, error) {
|
||||
toSerialize,err := o.ToMap()
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
func (o Category) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if !IsNil(o.Id) {
|
||||
toSerialize["id"] = o.Id
|
||||
}
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCategory struct {
|
||||
value *Category
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCategory) Get() *Category {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCategory) Set(val *Category) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCategory) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCategory) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCategory(val *Category) *NullableCategory {
|
||||
return &NullableCategory{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCategory) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCategory) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user